ccdeck 3.82.1 → 3.82.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-5txXQWqr.js → BrowserWatchModal-2_oD4OEZ.js} +1 -1
- package/dist/web/assets/{IntegrationModal-2caOGb1q.js → IntegrationModal-C5Hg-4qW.js} +1 -1
- package/dist/web/assets/{RadioPanel-DuvwS-TT.js → RadioPanel-D_qTIO0G.js} +1 -1
- package/dist/web/assets/{TrafficRadar-BD_S2b0e.js → TrafficRadar-Br6HVrU-.js} +1 -1
- package/dist/web/assets/{UsageHistoryModal-CXDbKfIt.js → UsageHistoryModal-HQY6FX_t.js} +1 -1
- package/dist/web/assets/{app-CoVinTuS.js → app-BP4tkqfl.js} +6 -6
- package/dist/web/assets/{index-DpfbtL3r.js → index-BR00GbtO.js} +1 -1
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/release-notes.json +8 -1
- package/src/server/tui-network.mjs +3 -1
|
@@ -126,7 +126,7 @@ ${e.sessionTitle}`:e.sessionTitle:e.cwd,g=wT(e),f=m.useRef(null),b=m.useRef(null
|
|
|
126
126
|
${t("board.node.modelCovers")}
|
|
127
127
|
${g.join(`
|
|
128
128
|
`)}`:Au(e.model,e.effort)),A=Fm(e.sessionName,e.sessionTitle),q=fU(e),_=(q==null?void 0:q.note)??null,I=q?q.key:null,z=ute(I),F=q!=null&&!z,U=(_==null?void 0:_.kind)==="recap",O=uee(e);return s.jsxs("div",{className:i,style:{"--session-hue":c},children:[s.jsx("span",{className:"accent-stripe"}),s.jsx(Mr,{type:"target",position:it.Left,style:{background:"transparent",border:"none"}}),s.jsxs("div",{className:"head",children:[s.jsxs("div",{className:"title",children:[s.jsx(Sne,{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:P=>{P.stopPropagation(),dte(I)},children:s.jsx(Gg,{recap:U})})]}),s.jsx("div",{className:"head-right",children:u&&e.onOpenContext&&s.jsx(nte,{currentContextTokens:d,modelId:e.model,contextWindow:e.contextWindow,onClick:()=>e.onOpenContext(e.sessionId)})})]}),s.jsxs("div",{className:"sub",title:_ee(e,t),children:[s.jsxs("span",{className:"sub-details",ref:f,children:[S.kind&&s.jsx("span",{children:Dm(e,t)}),e.childCount>0&&s.jsxs("span",{className:"spawn-badge",title:qee(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":Om(e.model),title:T,children:[Mm(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(Cne,{start:e.startedAt,end:e.endedAt})]})]}),e.kind==="root"&&A.face&&s.jsx("div",{className:"session-name",title:A.tooltip,children:A.face}),e.kind==="root"&&e.stopFailure&&s.jsx(Nne,{data:e,stop:e.stopFailure}),e.kind==="root"&&!e.stopFailure&&s.jsx(bne,{data:e}),e.waiting&&!(e.stopFailure&&e.waiting.kind==="idle")&&s.jsx(jne,{waiting:e.waiting}),(()=>{const P=Q2(e);return P?s.jsxs("div",{className:"approval-blind-row",title:P.detail,children:[s.jsx("span",{className:"approval-blind-dot","aria-hidden":!0}),s.jsx("span",{className:"approval-blind-said",children:P.label})]}):null})(),(()=>{const P=ai(e.plan);return P&&e.plan?s.jsx(yne,{plan:P,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:It(e.usage.inputTokens+e.usage.outputTokens)})," ",t("board.meta.tok")]}),(O==null?void 0:O.kind)==="unpriced"&&s.jsx("span",{className:"cost-unpriced",title:O.tt,children:t("insights.cost.notPriced")}),(O==null?void 0:O.kind)==="spent"&&s.jsx("span",{className:"cost-meta",title:O.tt,children:s.jsxs("b",{children:[St(O.total),O.floor?"+":""]})})]}),s.jsx(xne,{data:e,title:e.kind==="root"?A.face:void 0}),s.jsx(Mr,{type:"source",position:it.Right,style:{background:"transparent",border:"none"}})]})}const wne=m.memo(kne);function yne({plan:e,items:t}){const n=se();return s.jsxs("div",{className:e.allDone?"plan-row plan-done":"plan-row",title:_m(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 xne({data:e,title:t}){const n=se(),a=e.kind==="root"&&Qn(e.waiting),i=kte(e,e.branch,{sayWaiting:o=>Bg(o,n),describeCall:o=>({name:NT(o.name).label,subject:Gte(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(SU,{kind:wN(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(TT,{})]}),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 Cne({start:e,end:t}){const n=si(1e3);return s.jsx(s.Fragment,{children:bl(e,t,n)})}function Sne({state:e}){const t=se();return s.jsx("span",{className:`state-pill state-${e}`,children:jo(e,t)})}function Nne({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:nU(t,n)}),s.jsx(fne,{data:e})]})}function jne({waiting:e}){const t=se(),n=si(1e3),a=Qn(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}=Xte(e,t,a,n),r=Uv/sl;return s.jsxs("div",{className:"tool-spark-row",title:o,children:[s.jsx("svg",{className:"tool-spark",width:Uv,height:bg,viewBox:`0 0 ${Uv} ${bg}`,"aria-hidden":!0,children:i.map((c,d)=>{const u=ene(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 Ane({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 zT="agent-dag.single-key-shortcuts";function PU(e){return e!=="0"}function OU(e){return e.length===1}function Rne(e,t){return!t&&OU(e)}function qn(e,t,n){return n?`${e} (${t})`:e}let Er=null;const Yd=new Set;function MU(){for(const e of Yd)e()}function NN(){return Er===null&&(Er=PU(ht(zT))),Er}function Ene(e){Er!==e&&(Er=e,pt(zT,e?"1":"0"),MU())}function O1(e){if(e.key!==zT)return;const t=PU(e.newValue);t!==Er&&(Er=t,MU())}function qne(e){var t;return Yd.add(e),Yd.size===1&&typeof window<"u"&&((t=window.addEventListener)==null||t.call(window,"storage",O1)),()=>{var n;Yd.delete(e),Yd.size===0&&typeof window<"u"&&((n=window.removeEventListener)==null||n.call(window,"storage",O1))}}function Kg(e,t=x){const n=Math.max(0,Math.floor(e));return t("board.pill.events",{count:n})}const M1=99;function _ne(e){const t=Math.max(0,Math.floor(e));return t>M1?`${M1}+`:String(t)}const zne=(e=x)=>e("board.pill.pause");function Lne(e,t=x){const n=e.singleKeys??!0;if(!e.paused)return qn(t("board.pill.title.pause"),"Space",n);const a=Math.max(0,Math.floor(e.dropped??0));return a>0?qn(t("board.pill.title.full",{held:Kg(e.held,t),count:a}),"Space",n):e.held<=0?qn(t("board.pill.title.nothing"),"Space",n):qn(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 IU=e=>e("board.pill.pausedFull"),One=(e,t,n)=>t>0?IU(n):e>0?n("board.pill.pausedCount",{held:_ne(e)}):n("board.pill.paused");function Mne(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:One(e.held,n,t),widest:IU(t),title:qn(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 zn(){return m.useSyncExternalStore(qne,NN,NN)}const Ine=e=>e.transform[2]>=e.maxZoom,Dne=e=>e.transform[2]<=e.minZoom;function Fne({autoFitDisabled:e,enableAutoFitAndRefit:t,paused:n,pauseGate:a,togglePause:i,handleRelayout:o,requestClear:r,setKeyHelpOpen:c}){const d=se(),u=Cl(),h=Nt(Ine),g=Nt(Dne),f=zn();return s.jsxs(y8,{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:Lne({paused:n,held:a.size,dropped:a.dropped,singleKeys:f},d),"aria-label":zne(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:qn(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:qn(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?qn(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 Une="modulepreload",Bne=function(e){return"/"+e},I1={},Wr=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=Bne(u),u in I1)return;I1[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":Une,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)})},D1="agent-dag.fm-custom-stations",F1="agent-dag.fm-muted",jN="custom:",Hne=/^UC[A-Za-z0-9_-]{22}$/,Wne=/^[A-Za-z0-9_-]{11}$/,DU=/^[A-Za-z0-9_-]{1,80}$/,Gne=/\.(mp3|aac|ogg)$/i,$ne=/\.m3u8$/i,Vne=2048,FU=80;function kl(e){return`${jN}${e}`}function Km(e){if(!e.startsWith(jN))return null;const t=e.slice(jN.length);return DU.test(t)?t:null}function U1(e){return Km(e)??e}function LT(e){var r,c;const t=e.trim();if(t.length>Vne)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&&Hne.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(Wne.test(h))return{kind:"youtube-video",url:a,video:h}}return null}return $ne.test(n.pathname)?{kind:"direct-audio",url:a,format:"hls"}:Gne.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 Kne(e){return e==="1"}function Jne(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=LT(c);if(!DU.test(o)||n.has(o)||!r||r.length>FU||!d)continue;n.add(o);const u=UU(i.radio);a.push({id:o,name:r,url:d.url,...u?{radio:u}:{}})}return a}function Yne(e,t,n){const a=Km(e??"");return a&&t.some(i=>i.id===a)?kl(a):n(e)}function Zne(e,t){return e===kl(t)?"claude-fm":e}function UU(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 Xne(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 Qne(e="claude-fm"){return JSON.stringify({event:"listening",id:e,channel:"widget"})}const eae=[1],tae=[0,2],nae=[2,5,100,101,150,153];function aae(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:eae.includes(i)?{kind:"playing",playing:!0}:i===3?{kind:"buffering"}:tae.includes(i)?{kind:"playing",playing:!1}:null}return null}const zd=new Set;let B1="";function H1(e){const t=new Date().toISOString().slice(0,10);if(t!==B1&&(zd.clear(),B1=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 W1=864e5,sae=6e4;function jn(e,t=!0){m.useEffect(()=>{if(!t)return;H1(e);let n;const a=()=>{n=setTimeout(()=>{H1(e),a()},W1-Date.now()%W1+sae)};return a(),()=>clearTimeout(n)},[e,t])}const iae={"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 oae({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);jn("claude-fm",k);const j=m.useRef(o),S=m.useRef(null),T=m.useRef(null),A=m.useRef(void 0),q=m.useRef(null),_=m.useCallback(()=>{var P;clearTimeout(A.current),(P=T.current)==null||P.destroy(),T.current=null;const R=S.current;R&&(R.pause(),R.removeAttribute("src"),R.load(),S.current=null)},[]),I=m.useCallback(R=>{var P,D;(D=(P=q.current)==null?void 0:P.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,P,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(A.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()}};A.current=setTimeout(()=>{G()&&!B&&W()},15e3),$.addEventListener("playing",()=>{G()&&(clearTimeout(A.current),B=!0,y(!0),w(!1),c==null||c(D,!1))});const X=()=>{G()&&(y(!1),w(B),clearTimeout(A.current),A.current=setTimeout(()=>{G()&&W()},15e3))};$.addEventListener("waiting",X),$.addEventListener("stalled",X),$.addEventListener("ended",()=>{G()&&Z()}),$.addEventListener("error",W,{once:!0}),P&&!$.canPlayType("application/vnd.apple.mpegurl")?Wr(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;T.current=Q,Q.on(V.Events.ERROR,(J,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 P=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?LT(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 P(`/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(Km(i))return g(!0),c==null||c(i,!0),()=>{R=!1};const B=i,G=iae[B];if(G)P(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-","");P(`/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 P("/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 P=()=>{clearTimeout(R),R=void 0,b(!1),y(!1),w(!1),g(!0),c==null||c(i,!0)},D=()=>{R??(R=setTimeout(P,15e3))};D();const $=B=>{var Z;if(B.origin!==TN||B.source!==((Z=q.current)==null?void 0:Z.contentWindow))return;const G=aae(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}nae.includes(G.code)&&P()}};return window.addEventListener("message",$),()=>{clearTimeout(R),window.removeEventListener("message",$)}},[f,d==null?void 0:d.audio,o,c,I,i]);const O=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:O}),[d,h,f,k,N,I,O])}const G1="agent-dag.radio-favorites",$1="agent-dag.radio-recent",V1="agent-dag.radio-catalogue";function rae(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"?LT(a.url):null,c=UU(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 K1(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 cae(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 BU(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 lae(){const[e,t]=m.useState(()=>K1(ht(G1))),[n,a]=m.useState(()=>K1(ht($1))),[i,o]=m.useState(()=>{try{return rae(JSON.parse(ht(V1)??"[]"))}catch{return[]}});m.useEffect(()=>{pt(G1,JSON.stringify(e))},[e]),m.useEffect(()=>{pt($1,JSON.stringify(n))},[n]);const r=m.useCallback(u=>a(h=>cae(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(V1,JSON.stringify(u))},[]);return{favorites:e,recent:n,catalogue:i,remember:r,toggleFavorite:c,updateCatalogue:d}}function dae(e,t,n,a){const i=BU(e,t,n);if(!i)return()=>{};const o=setTimeout(()=>{n.add(t),a(i)},1e3);return()=>clearTimeout(o)}const Jm=148,J1=6e3,uae=16e3,HU=46,yo=34;function hae(e,t,n=Jm){let a=-Math.round(t()*n);if(Math.abs(a-e)<yo){const i=e-yo>=-n?-yo:yo;a=Math.max(-n,Math.min(0,Math.round(e+i)))}return{to:a,ms:Math.round(Math.abs(a-e)*HU)}}function pae(e){return Math.round(J1+e()*(uae-J1))}const Y1=[{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 gae(e){const t=Y1.reduce((a,i)=>a+i.weight,0);let n=e()*t;for(const a of Y1)if(n-=a.weight,n<0)return a.kind;return"stroll"}const mae=720,fae=260,bae=620,vae=220,Z1=520,WU=1600,X1=7e3,kae=15e3,Q1=6e3,wae=14e3;function zc(e,t,n=Jm){let a=-Math.round(t()*n);if(Math.abs(a-e)<yo){const i=e-yo>=-n?-yo:yo;a=Math.max(-n,Math.min(0,Math.round(e+i)))}return a}const bn=(e,t)=>Math.round(Math.abs(t-e)*HU),yae=120,Dp=0;function xae(e,t){const n=a=>({kind:"litter",at:t,...a});return[{x:t,prop:n({}),act:"walk",ms:bn(e,t)},{x:t,prop:n({}),act:"stoop",ms:mae},{x:Dp,prop:n({held:!0}),act:"carry",ms:bn(t,Dp)},{x:Dp,prop:n({held:!0}),act:"windup",ms:fae},{x:Dp,prop:n({held:!0,leaving:!0}),act:"toss",ms:bae}]}function Cae(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:bn(e,a)},{x:a,prop:i(),act:"windup",ms:vae,facing:n>0?"right":"left"},{x:a,prop:i({leaving:!0}),act:"kick",ms:Z1,facing:n>0?"right":"left"},{x:a,prop:i({leaving:!0}),act:"stand",ms:WU-Z1}]}const GU=640;function Sae(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:bn(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:bn(a,0)}]}function Nae(e,t,n){const a=Math.max(-110,Math.min(-30,t)),i={x:a,prop:null};return[{...i,act:"walk",ms:bn(e,a)},{...i,act:"skip-ready",ms:500},{...i,act:"skip",ms:GU*(6+Math.floor(n()*5))},{...i,act:"skip-rest",ms:600},{...i,act:"stand",ms:350},{x:0,prop:null,act:"walk",ms:bn(a,0)}]}function jae(e,t,n){return[{x:t,prop:null,act:"walk",ms:bn(e,t)},{x:t,prop:null,act:"sit",ms:Math.round(Q1+n()*(wae-Q1))},{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:bn(e,t)},{x:t,prop:a(),act:"watch",ms:Math.round(X1+n()*(kae-X1))},{x:t,prop:a(),act:"scope-pack",ms:480},{x:t,prop:null,act:"stand",ms:240}]}function Hv(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 Aae=1500,Rae=e=>Math.round(1e3*Math.sqrt(2*e/Aae)),Eae=115,qae=e=>Math.round(e/Eae*1e3),_ae=620,zae=200,Lae=760,Pae=600,Oae=240;function Mae(e,t,n){const i=-(t.ledgeSpan??Jm),o=Rae(t.ledgeH),r=qae(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:bn(e,i)},{x:i,act:"peer",prop:null,ms:_ae},{x:i,act:"fall",prop:null,ms:o,place:"floor"},{x:i,act:"land",prop:null,ms:zae,place:"floor"},{x:u,act:"walk",prop:null,ms:bn(i,u),place:"floor",floorFrac:c},{x:h,act:"walk",prop:null,ms:bn(u,h),place:"floor",floorFrac:d},{x:i,act:"walk",prop:null,ms:bn(h,i),place:"floor"},{x:i,act:"lasso",prop:null,ms:Lae,place:"floor"},{x:i,act:"rope-throw",prop:null,ms:Pae,place:"floor"},{x:i,act:"rope-catch",prop:null,ms:Oae,place:"floor"},{x:i,act:"climb",prop:null,ms:r},{x:i,act:"pull-up",prop:null,ms:480}]}function Iae(e,t,n){const a=(n==null?void 0:n.ledgeSpan)??Jm;switch(gae(t)){case"tidy":return xae(e,zc(e,t,a));case"kick":return Cae(e,zc(e,t,a));case"sit":return jae(e,zc(e,t,a),t);case"watch":return Tae(e,zc(e,t,a),t);case"fish":return Sae(e,zc(e,t,a),t);case"skip":return Nae(e,zc(e,t,a),t);case"leave":{if(!n||!(n.ledgeH>0)||!(n.floorSpan>0))break;return Mae(e,n,t)}}const o=hae(e,t,a);return[{x:o.to,prop:null,act:"walk",ms:o.ms}]}const Dae=420;function Fae(e,t,n){const a=t==="right"?n-e-18:e-18;return(t==="right"?1:-1)*Math.min(Dae,Math.max(0,a))}const Uae=260,Bae=200;function Hae(e,t,n){const a=(h,g=bn(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,bn(e,c)),{...u,x:c,act:"mount",ms:Uae},{...u,x:d,act:"walk",ms:bn(c,d)},{x:d,prop:null,act:"dismount",ms:Bae,place:"floor"},{x:t,prop:null,act:"walk",ms:bn(d,t),place:"floor"}]}const $U=["bob","sway","groove"],eq=9e3,Wae=16e3,VU=1e3,Gae=.08;function $ae(e,t){const n=$U.filter(o=>o!==e),a=n[Math.min(n.length-1,Math.floor(t()*n.length))],i=(t()*2-1)*Gae;return{dance:a,beatMs:Math.round(VU*(1+i))}}function Vae(e){return Math.round(eq+e()*(Wae-eq))}const PT=["......aaaaaa......","....aa......aa....","...a..bbbbbs..a...","...cpcbbbbbscpc...","...cpcbebbescpc...","...cpcbbbbbscpc...","...cpcbbbbbscpc...","....ccbbbbbscc....","....bbbbbbbbbs....","....bbbbbbbbbs....","......bbbbbs......","......bb..bs......","......bb..bs......","......bb..bs......"],tq=18,Kae=PT.length,KU="M6 9H4V1H5V0H7V-1H9V1H7V2H5V7H6V8H7V9Z",JU="M12 9H14V6H13V3H11V2H9V4H12Z",OT=new Set(["a","c","p"]);function Oo(e=PT){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 Jae=[".xx.","xxxx",".xx."],Yae=["..xx..",".xsxx.","xssxxx","xxxxsx",".xxxx.","..xx.."],Zae=["...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."],Wv={litter:Jae,ball:Yae,scope:Zae},Xae=["...hhhhhh...","...hhhhhh...","...kkkkkk...","hhhhhhhhhhhh"],Qae=3,ese=-1,AN=11,nq=9;function aq(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 tse(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),[T,A]=m.useState(()=>document.hidden);m.useEffect(()=>{const O=new Set,L=()=>{var R;if(document.hidden){for(const P of((R=S.current)==null?void 0:R.getAnimations({subtree:!0}))??[])if(P.playState==="running"||P.pending){const D=P.currentTime;P.pause(),D!==null&&(P.currentTime=D),O.add(P)}}else{for(const P of O)P.playState==="paused"&&P.play();O.clear()}A(document.hidden)};return L(),document.addEventListener("visibilitychange",L),()=>document.removeEventListener("visibilitychange",L)},[e,t]);const[q,_]=m.useState(null),[I,z]=m.useState(VU),[F,U]=m.useState(()=>{var O;return((O=window.matchMedia)==null?void 0:O.call(window,"(prefers-reduced-motion: reduce)").matches)??!1});return m.useEffect(()=>{var R;const O=(R=window.matchMedia)==null?void 0:R.call(window,"(prefers-reduced-motion: reduce)");if(!O)return;const L=()=>U(O.matches);return L(),O.addEventListener("change",L),()=>O.removeEventListener("change",L)},[]),m.useEffect(()=>{var K;if(!e||t||F)return;const O=aq(document);let L=0;i(ee=>L=ee);let R=null,P=0,D=0;const $=ee=>{var pe,ae;const[te,...le]=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 ue=(ae=(pe=S.current)==null?void 0:pe.querySelector('.fm-prop[data-prop="ball"]'))==null?void 0:ae.getBoundingClientRect();ue&&f({x:Fae(ue.x,Hv(te,ge,"left"),window.innerWidth),drop:Math.max(48,window.innerHeight-ue.y+24)})}D=te.act==="walk"?Math.max(bn(ge,ve),yae):te.ms,te.act==="carry"&&(D=bn(ge,ve)),r(D),N(ue=>Hv({...te,x:ve},ge,ue)),i(ve),L=ve,R=te,P=Date.now(),O.schedule(()=>$(le),D)},B=()=>{const ee=S.current,te=ee==null?void 0:ee.querySelector(".fm-sprite"),le=ee==null?void 0:ee.parentElement;if(!ee||!te||!le)return null;const ge=ee.getBoundingClientRect(),ve=le.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"),le=B();if(!ee||!te||le==null)return;const ge=ee.getBoundingClientRect().bottom-te.getBoundingClientRect().bottom;if(ge>0)return{ledgeH:ge,floorSpan:le,ledgeSpan:G()}},W=()=>{const ee=S.current,te=document.querySelector(".canvas-notices");if(!ee||!te)return null;const le=ee.getBoundingClientRect(),ge=te.getBoundingClientRect();return ge.width<=0||ge.height<=0?null:{left:ge.left-le.right,right:ge.right-le.right,height:ge.height}},H=ee=>{const te=(ee.place??"ledge")==="floor",le=te?B()??G():G(),ge=te&&ee.floorFrac!=null?-Math.round(ee.floorFrac*le):ee.x;return Math.max(-le,Math.min(0,ge))},X=()=>{if(!R)return;const ee=H(R);ee!==L&&(r(Math.max(0,P+D-Date.now())),N(te=>Hv({...R,x:ee},L,te)),i(ee),L=ee)},V=()=>{O.schedule(()=>{const ee=Iae(L,Math.random,Z()),te=ee.some(ve=>ve.place==="floor")?W():null;let le=L;const ge=ee.flatMap(ve=>{const pe=le;if(le=ve.x,!(ve.place==="floor"&&ve.act==="walk"))return[ve];const ae=Hae(pe,ve.x,te),ue=ae.length-1;return ve.floorFrac==null?ae:ae.map((Se,ke)=>ke===ue?{...Se,floorFrac:ve.floorFrac}:Se)});$(ge)},pae(Math.random))},Q=(K=S.current)==null?void 0:K.parentElement,J=typeof ResizeObserver>"u"?null:new ResizeObserver(X);return Q&&J&&J.observe(Q),V(),()=>{O.dispose(),J==null||J.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 O=aq(document),L=R=>{const P=$ae(R,Math.random);_(P.dance),z(P.beatMs),O.schedule(()=>L(P.dance),Vae(Math.random))};return L(null),()=>O.dispose()},[n,F]),{scene:S,suspended:T,x:a,walkMs:o,act:c,prop:u,ballFlight:g,place:b,facing:y,riser:w,dance:q,beatMs:I}}const Gv={e:"fm-eye",s:"fm-shade",p:"fm-pad"},Jg=Oo().filter(e=>!OT.has(e.cell)),nse=Oo().filter(e=>OT.has(e.cell)),sq=Jg.filter(e=>e.cell==="e"),ase=Oo(Xae),sse=Jg.filter(e=>e.y<AN&&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),ise={left:Jg.filter(e=>e.y>=AN&&e.x<nq),right:Jg.filter(e=>e.y>=AN&&e.x>=nq)},ose=m.memo(function({act:t,facing:n}){return s.jsxs("svg",{viewBox:`0 0 ${tq} ${Kae}`,shapeRendering:"crispEdges","aria-hidden":!0,children:[s.jsx("g",{className:"fm-gear",children:s.jsx("g",{className:"fm-gear-motion",children:nse.map(a=>s.jsx("rect",{x:a.x,y:a.y,width:a.w,height:1,className:Gv[a.cell]},`g${a.y}-${a.x}`))})}),s.jsxs("g",{className:"fm-body",children:[sq.map(a=>s.jsx("rect",{x:a.x,y:a.y,width:a.w,height:1,fill:"var(--accent)"},`eye-bed-${a.x}`)),sse.map(a=>s.jsx("rect",{x:a.x,y:a.y,width:a.w,height:1,className:Gv[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"})]}),sq.map(a=>s.jsx("rect",{x:a.x-(a.x>=tq/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:ase.map(a=>s.jsx("rect",{x:Qae+a.x,y:ese+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:KU}),s.jsx("path",{className:"fm-grip-right",d:JU})]}),(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:ise[a].map(i=>s.jsx("rect",{x:i.x,y:i.y,width:i.w,height:1,className:Gv[i.cell]},`${a}${i.y}-${i.x}`))},a))]})}),rse=["...o........o.....","...of......fo.....","...owffffffwo.....","...offfffffso.....","...ofefffefso.....","....owwnwwso......",".....wwwww........",".....fwwwfs.......","....ffwwwffs...ww.","....ffwwwffs..wfs.","......fwwfssfffs..","......ff..fsffs...","......ff..fs......","......oo..oo......"],cse=[".....aaaaaaa......","...aa.......aa....","..a...........a...","..cp.........pc...","..cp.........pc...","..cp.........pc...","..c...........c..."],Gs={f:"#d88735",s:"#a55b24",o:"#63351e",w:"#ffe2aa",n:"#372821"},lse={p:"fm-pad"},Ru=Oo(rse),dse=Oo(cse);function RN(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 use=RN(Ru.filter(e=>e.y>=8),12,18),hse=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),iq=Ru.filter(e=>e.cell==="e"),pse={left:RN(Ru.filter(e=>e.y>=11),0,9),right:RN(Ru.filter(e=>e.y>=11),9,12)},gse=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:use.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:dse.map(r=>s.jsx("rect",{x:r.x,y:r.y,width:r.w,height:1,className:lse[r.cell]},`g${r.y}-${r.x}`))})}),s.jsxs("g",{className:"fm-body",children:[hse.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}`)),iq.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})]}),iq.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:KU}),s.jsx("path",{className:"fm-grip-right",d:JU})]}),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:pse[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))]})}),mse=[".......dddd.......","......dhhhhd......",".....dhhhhhhd.....","....dhwwhhwwhd....","....dhwewwewhd....","....dhwwbbwwhd....","....dhwwwwwwhd....","....dhwwwwwwhd....","....dhwwwwwwhd....",".....dhwwwwhd.....",".....dhwwwwhd.....","......dhhhhd......","......bb..bb......",".....bbb..bbb....."],Ci={d:"#3b4855",h:"#657b8b",w:"#f4f0df",e:"#19242b",b:"#f0b44b",s:"#c88736"},fse={p:"fm-pad"},Yg=Oo(mse),bse=Oo(PT).filter(e=>OT.has(e.cell)),oq=Yg.filter(e=>e.cell==="e"),vse=Yg.filter(e=>e.y<12&&e.cell!=="e"),kse={left:Yg.filter(e=>e.y>=12&&e.x<9),right:Yg.filter(e=>e.y>=12&&e.x>=9)},wse=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:bse.map(o=>s.jsx("rect",{x:o.x,y:o.y,width:o.w,height:1,className:fse[o.cell]},`g${o.y}-${o.x}`))})}),s.jsxs("g",{className:"fm-body",children:[vse.map(o=>s.jsx("rect",{x:o.x,y:o.y,width:o.w,height:1,fill:Ci[o.cell]},`b${o.y}-${o.x}`)),oq.map(o=>s.jsx("rect",{x:o.x,y:o.y,width:o.w,height:1,fill:Ci.w},`bed${o.x}`)),s.jsxs("g",{className:"fm-arms",fill:Ci.d,children:[s.jsx("path",{d:"M4 8H6V10H5V11H4Z"}),s.jsx("path",{d:"M12 8H14V11H13V10H12Z"})]}),oq.map(o=>s.jsx("rect",{x:o.x,y:o.y,width:o.w,height:1,className:"fm-eye",style:{fill:Ci.e}},`e${o.x}`))]}),n&&s.jsxs("g",{className:"fm-grip",style:{fill:Ci.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:Ci.b},children:[s.jsx("path",{d:"M5 12H8V13H5Z"}),s.jsx("path",{d:"M10 12H13V13H10Z"})]}),i&&s.jsxs("g",{className:"fm-seated-legs",style:{fill:Ci.b},children:[s.jsx("path",{className:"fm-seated-far",style:{fill:Ci.s},d:"M10 11H12V12H13V14H10V13H11V12H10Z"}),s.jsx("path",{d:"M6 11H8V12H7V13H8V14H4V13H5V12H6Z"})]}),["left","right"].map(o=>s.jsx("g",{className:"fm-leg","data-side":o,children:kse[o].map(r=>s.jsx("rect",{x:r.x,y:r.y,width:r.w,height:1,fill:Ci.b},`${r.y}-${r.x}`))},o))]})});function YU({character:e,act:t,facing:n}){return e==="penguin"?s.jsx(wse,{act:t,facing:n}):e==="fox"?s.jsx(gse,{act:t,facing:n}):s.jsx(ose,{act:t,facing:n})}const yse={"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 ZU(e,t,n=x){return t&&kl(t.id)===e?t.name:Km(e)?n("radio.fm.custom"):yse[e]}function $v(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 rq={litter:$v(Wv.litter,"litter"),ball:$v(Wv.ball,"ball"),scope:$v(Wv.scope,"scope")};function xse(e,t=x){try{return new URL(e).host}catch{return t("radio.fm.server")}}const Cse=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:T,beatMs:A}=tse(r,c,d);if(!r||c)return null;const q=ZU(n,a,o),_=r.audio?xse(r.audio,o):"YouTube";return s.jsxs("div",{ref:h,className:"fm","data-suspended":g?"":void 0,"data-place":w,style:{"--fm-beat":`${A}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":`${WU}ms`,"--fm-ball-turn":j==="right"?"1080deg":"-1080deg"},children:rq[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":`${GU}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:rq[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?T??$U[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(YU,{character:i,act:k,facing:j})})]})]})});function Sse({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:Xne(n.channel,window.location.origin,n.video),onLoad:()=>o(Qne()),allow:"autoplay; encrypted-media",sandbox:"allow-scripts allow-same-origin allow-presentation"})}):null}const Nse={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 jse({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:Nse[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 Ase({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:Hee,children:[s.jsx("button",{type:"button",className:"icon-btn","aria-label":t("radio.close"),onClick:e,children:s.jsx(jse,{name:"close"})}),s.jsx(Tse,{opening:!0})]})}const Rse=m.lazy(()=>Wr(()=>import("./RadioPanel-DuvwS-TT.js"),[]));function Ese({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=lae(),[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=oae({volume:e.fmVolume,muted:e.fmMuted,source:e.fmSource,playRequest:e.fmPlayRequest,customStation:y,enabled:o,onAvailabilityChange:e.markFmStationAvailability}),j=ZU(e.fmSource,y,c),S=o&&N&&w.dead&&e.fmPlayRequest>0?BU(f??g.catalogue,N.id,k.current):null,{remember:T}=g,A=(y==null?void 0:y.id)??e.fmSource;m.useEffect(()=>{w.playing&&T(A)},[A,w.playing,T]);const q=i,_=At(i),I=m.useCallback((z,F=!1)=>{var R;if(!o)return;F||k.current.clear();const U=kl(z.id),O=U===e.fmSource;if(O&&w.armed&&!w.dead){w.press();return}const L=O&&!!y&&(y.url!==z.url||((R=y.radio)==null?void 0:R.hls)!==z.radio.hls);e.addFmStation(z,!0),O&&!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 dae(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(Cse,{character:n,player:w,source:e.fmSource,customStation:y}),s.jsx(Sse,{player:w,label:j}),a&&qt.createPortal(s.jsx("div",{className:"modal-backdrop radio-backdrop",..._,children:s.jsx(m.Suspense,{fallback:s.jsx(Ase,{onClose:q}),children:s.jsx(Rse,{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 qse({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:Wm(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(),lte(e.noteKey)},children:"×"})]}),a&&s.jsx("p",{className:"recap-note-text",title:wte(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(cq,{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(cq,{plan:i,head:a!=null,face:!0})]}),s.jsx(Mr,{type:"source",position:it.Right,style:{background:"transparent",border:"none"}})]})}const _se={completed:"board.state.done",in_progress:"board.detail.now",pending:"board.detail.todo"};function cq({plan:e,head:t,face:n=!1}){const a=se(),i=ai(e);if(!i)return null;const o=uQ(e.items);return s.jsxs("div",{className:n?"recap-face-plan":"recap-note-plan",title:n?void 0:_m(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(_se[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 Mo(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 zse(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 Lse(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 lq=7e3,Pse=2e3,Ose=140,Mse=(e=x)=>e("board.rearrange.text"),Ise=(e=x)=>e("board.rearrange.said"),dq=(e=x)=>e("board.rearrange.restored"),Dse={set:(e,t)=>setTimeout(e,t),clear:e=>clearTimeout(e),now:()=>Date.now()};function Fse(e,t=Dse){let n=null,a=null,i=0,o=lq;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=lq,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 Use(e){return(e.key==="z"||e.key==="Z")&&(e.metaKey||e.ctrlKey)&&!e.altKey&&!e.shiftKey}function Bse(e){return Mo(e)?"⌘Z":"Ctrl+Z"}function Hse({undo:e}){const t=se(),{open:n,said:a,undo:i,dismiss:o,hold:r,release:c}=e,d=Vc(n,Ose),u=m.useRef(null);return m.useEffect(()=>n?Nn.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}),wo(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:Mse(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:Bse(Ao())})]})]})]})}function Wse({sourceX:e,sourceY:t,targetX:n,targetY:a,sourcePosition:i,targetPosition:o,style:r}){const[c]=Xj({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 EN(e){return e.replace(/[^a-zA-Z0-9]/g,"")}function Xg(e,t){const n=EN(e);return n?n.slice(-t):e.slice(-t)}function XU(e,t,n=4){const a=EN(e);if(!a)return Xg(e,n);let i=n;for(const o of t){if(o===e)continue;const r=EN(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 QU(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(Cr);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}=Xte(e,t,a,n),r=Uv/sl;return s.jsxs("div",{className:"tool-spark-row",title:o,children:[s.jsx("svg",{className:"tool-spark",width:Uv,height:bg,viewBox:`0 0 ${Uv} ${bg}`,"aria-hidden":!0,children:i.map((c,d)=>{const u=ene(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 Ane({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 zT="agent-dag.single-key-shortcuts";function PU(e){return e!=="0"}function OU(e){return e.length===1}function Rne(e,t){return!t&&OU(e)}function qn(e,t,n){return n?`${e} (${t})`:e}let Er=null;const Yd=new Set;function MU(){for(const e of Yd)e()}function NN(){return Er===null&&(Er=PU(ht(zT))),Er}function Ene(e){Er!==e&&(Er=e,pt(zT,e?"1":"0"),MU())}function O1(e){if(e.key!==zT)return;const t=PU(e.newValue);t!==Er&&(Er=t,MU())}function qne(e){var t;return Yd.add(e),Yd.size===1&&typeof window<"u"&&((t=window.addEventListener)==null||t.call(window,"storage",O1)),()=>{var n;Yd.delete(e),Yd.size===0&&typeof window<"u"&&((n=window.removeEventListener)==null||n.call(window,"storage",O1))}}function Kg(e,t=x){const n=Math.max(0,Math.floor(e));return t("board.pill.events",{count:n})}const M1=99;function _ne(e){const t=Math.max(0,Math.floor(e));return t>M1?`${M1}+`:String(t)}const zne=(e=x)=>e("board.pill.pause");function Lne(e,t=x){const n=e.singleKeys??!0;if(!e.paused)return qn(t("board.pill.title.pause"),"Space",n);const a=Math.max(0,Math.floor(e.dropped??0));return a>0?qn(t("board.pill.title.full",{held:Kg(e.held,t),count:a}),"Space",n):e.held<=0?qn(t("board.pill.title.nothing"),"Space",n):qn(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 IU=e=>e("board.pill.pausedFull"),One=(e,t,n)=>t>0?IU(n):e>0?n("board.pill.pausedCount",{held:_ne(e)}):n("board.pill.paused");function Mne(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:One(e.held,n,t),widest:IU(t),title:qn(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 zn(){return m.useSyncExternalStore(qne,NN,NN)}const Ine=e=>e.transform[2]>=e.maxZoom,Dne=e=>e.transform[2]<=e.minZoom;function Fne({autoFitDisabled:e,enableAutoFitAndRefit:t,paused:n,pauseGate:a,togglePause:i,handleRelayout:o,requestClear:r,setKeyHelpOpen:c}){const d=se(),u=Cl(),h=Nt(Ine),g=Nt(Dne),f=zn();return s.jsxs(y8,{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:Lne({paused:n,held:a.size,dropped:a.dropped,singleKeys:f},d),"aria-label":zne(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:qn(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:qn(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?qn(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 Une="modulepreload",Bne=function(e){return"/"+e},I1={},Wr=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=Bne(u),u in I1)return;I1[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":Une,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)})},D1="agent-dag.fm-custom-stations",F1="agent-dag.fm-muted",jN="custom:",Hne=/^UC[A-Za-z0-9_-]{22}$/,Wne=/^[A-Za-z0-9_-]{11}$/,DU=/^[A-Za-z0-9_-]{1,80}$/,Gne=/\.(mp3|aac|ogg)$/i,$ne=/\.m3u8$/i,Vne=2048,FU=80;function kl(e){return`${jN}${e}`}function Km(e){if(!e.startsWith(jN))return null;const t=e.slice(jN.length);return DU.test(t)?t:null}function U1(e){return Km(e)??e}function LT(e){var r,c;const t=e.trim();if(t.length>Vne)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&&Hne.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(Wne.test(h))return{kind:"youtube-video",url:a,video:h}}return null}return $ne.test(n.pathname)?{kind:"direct-audio",url:a,format:"hls"}:Gne.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 Kne(e){return e==="1"}function Jne(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=LT(c);if(!DU.test(o)||n.has(o)||!r||r.length>FU||!d)continue;n.add(o);const u=UU(i.radio);a.push({id:o,name:r,url:d.url,...u?{radio:u}:{}})}return a}function Yne(e,t,n){const a=Km(e??"");return a&&t.some(i=>i.id===a)?kl(a):n(e)}function Zne(e,t){return e===kl(t)?"claude-fm":e}function UU(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 Xne(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 Qne(e="claude-fm"){return JSON.stringify({event:"listening",id:e,channel:"widget"})}const eae=[1],tae=[0,2],nae=[2,5,100,101,150,153];function aae(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:eae.includes(i)?{kind:"playing",playing:!0}:i===3?{kind:"buffering"}:tae.includes(i)?{kind:"playing",playing:!1}:null}return null}const zd=new Set;let B1="";function H1(e){const t=new Date().toISOString().slice(0,10);if(t!==B1&&(zd.clear(),B1=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 W1=864e5,sae=6e4;function jn(e,t=!0){m.useEffect(()=>{if(!t)return;H1(e);let n;const a=()=>{n=setTimeout(()=>{H1(e),a()},W1-Date.now()%W1+sae)};return a(),()=>clearTimeout(n)},[e,t])}const iae={"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 oae({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);jn("claude-fm",k);const j=m.useRef(o),S=m.useRef(null),T=m.useRef(null),A=m.useRef(void 0),q=m.useRef(null),_=m.useCallback(()=>{var P;clearTimeout(A.current),(P=T.current)==null||P.destroy(),T.current=null;const R=S.current;R&&(R.pause(),R.removeAttribute("src"),R.load(),S.current=null)},[]),I=m.useCallback(R=>{var P,D;(D=(P=q.current)==null?void 0:P.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,P,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(A.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()}};A.current=setTimeout(()=>{G()&&!B&&W()},15e3),$.addEventListener("playing",()=>{G()&&(clearTimeout(A.current),B=!0,y(!0),w(!1),c==null||c(D,!1))});const X=()=>{G()&&(y(!1),w(B),clearTimeout(A.current),A.current=setTimeout(()=>{G()&&W()},15e3))};$.addEventListener("waiting",X),$.addEventListener("stalled",X),$.addEventListener("ended",()=>{G()&&Z()}),$.addEventListener("error",W,{once:!0}),P&&!$.canPlayType("application/vnd.apple.mpegurl")?Wr(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;T.current=Q,Q.on(V.Events.ERROR,(J,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 P=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?LT(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 P(`/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(Km(i))return g(!0),c==null||c(i,!0),()=>{R=!1};const B=i,G=iae[B];if(G)P(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-","");P(`/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 P("/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 P=()=>{clearTimeout(R),R=void 0,b(!1),y(!1),w(!1),g(!0),c==null||c(i,!0)},D=()=>{R??(R=setTimeout(P,15e3))};D();const $=B=>{var Z;if(B.origin!==TN||B.source!==((Z=q.current)==null?void 0:Z.contentWindow))return;const G=aae(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}nae.includes(G.code)&&P()}};return window.addEventListener("message",$),()=>{clearTimeout(R),window.removeEventListener("message",$)}},[f,d==null?void 0:d.audio,o,c,I,i]);const O=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:O}),[d,h,f,k,N,I,O])}const G1="agent-dag.radio-favorites",$1="agent-dag.radio-recent",V1="agent-dag.radio-catalogue";function rae(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"?LT(a.url):null,c=UU(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 K1(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 cae(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 BU(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 lae(){const[e,t]=m.useState(()=>K1(ht(G1))),[n,a]=m.useState(()=>K1(ht($1))),[i,o]=m.useState(()=>{try{return rae(JSON.parse(ht(V1)??"[]"))}catch{return[]}});m.useEffect(()=>{pt(G1,JSON.stringify(e))},[e]),m.useEffect(()=>{pt($1,JSON.stringify(n))},[n]);const r=m.useCallback(u=>a(h=>cae(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(V1,JSON.stringify(u))},[]);return{favorites:e,recent:n,catalogue:i,remember:r,toggleFavorite:c,updateCatalogue:d}}function dae(e,t,n,a){const i=BU(e,t,n);if(!i)return()=>{};const o=setTimeout(()=>{n.add(t),a(i)},1e3);return()=>clearTimeout(o)}const Jm=148,J1=6e3,uae=16e3,HU=46,yo=34;function hae(e,t,n=Jm){let a=-Math.round(t()*n);if(Math.abs(a-e)<yo){const i=e-yo>=-n?-yo:yo;a=Math.max(-n,Math.min(0,Math.round(e+i)))}return{to:a,ms:Math.round(Math.abs(a-e)*HU)}}function pae(e){return Math.round(J1+e()*(uae-J1))}const Y1=[{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 gae(e){const t=Y1.reduce((a,i)=>a+i.weight,0);let n=e()*t;for(const a of Y1)if(n-=a.weight,n<0)return a.kind;return"stroll"}const mae=720,fae=260,bae=620,vae=220,Z1=520,WU=1600,X1=7e3,kae=15e3,Q1=6e3,wae=14e3;function zc(e,t,n=Jm){let a=-Math.round(t()*n);if(Math.abs(a-e)<yo){const i=e-yo>=-n?-yo:yo;a=Math.max(-n,Math.min(0,Math.round(e+i)))}return a}const bn=(e,t)=>Math.round(Math.abs(t-e)*HU),yae=120,Dp=0;function xae(e,t){const n=a=>({kind:"litter",at:t,...a});return[{x:t,prop:n({}),act:"walk",ms:bn(e,t)},{x:t,prop:n({}),act:"stoop",ms:mae},{x:Dp,prop:n({held:!0}),act:"carry",ms:bn(t,Dp)},{x:Dp,prop:n({held:!0}),act:"windup",ms:fae},{x:Dp,prop:n({held:!0,leaving:!0}),act:"toss",ms:bae}]}function Cae(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:bn(e,a)},{x:a,prop:i(),act:"windup",ms:vae,facing:n>0?"right":"left"},{x:a,prop:i({leaving:!0}),act:"kick",ms:Z1,facing:n>0?"right":"left"},{x:a,prop:i({leaving:!0}),act:"stand",ms:WU-Z1}]}const GU=640;function Sae(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:bn(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:bn(a,0)}]}function Nae(e,t,n){const a=Math.max(-110,Math.min(-30,t)),i={x:a,prop:null};return[{...i,act:"walk",ms:bn(e,a)},{...i,act:"skip-ready",ms:500},{...i,act:"skip",ms:GU*(6+Math.floor(n()*5))},{...i,act:"skip-rest",ms:600},{...i,act:"stand",ms:350},{x:0,prop:null,act:"walk",ms:bn(a,0)}]}function jae(e,t,n){return[{x:t,prop:null,act:"walk",ms:bn(e,t)},{x:t,prop:null,act:"sit",ms:Math.round(Q1+n()*(wae-Q1))},{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:bn(e,t)},{x:t,prop:a(),act:"watch",ms:Math.round(X1+n()*(kae-X1))},{x:t,prop:a(),act:"scope-pack",ms:480},{x:t,prop:null,act:"stand",ms:240}]}function Hv(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 Aae=1500,Rae=e=>Math.round(1e3*Math.sqrt(2*e/Aae)),Eae=115,qae=e=>Math.round(e/Eae*1e3),_ae=620,zae=200,Lae=760,Pae=600,Oae=240;function Mae(e,t,n){const i=-(t.ledgeSpan??Jm),o=Rae(t.ledgeH),r=qae(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:bn(e,i)},{x:i,act:"peer",prop:null,ms:_ae},{x:i,act:"fall",prop:null,ms:o,place:"floor"},{x:i,act:"land",prop:null,ms:zae,place:"floor"},{x:u,act:"walk",prop:null,ms:bn(i,u),place:"floor",floorFrac:c},{x:h,act:"walk",prop:null,ms:bn(u,h),place:"floor",floorFrac:d},{x:i,act:"walk",prop:null,ms:bn(h,i),place:"floor"},{x:i,act:"lasso",prop:null,ms:Lae,place:"floor"},{x:i,act:"rope-throw",prop:null,ms:Pae,place:"floor"},{x:i,act:"rope-catch",prop:null,ms:Oae,place:"floor"},{x:i,act:"climb",prop:null,ms:r},{x:i,act:"pull-up",prop:null,ms:480}]}function Iae(e,t,n){const a=(n==null?void 0:n.ledgeSpan)??Jm;switch(gae(t)){case"tidy":return xae(e,zc(e,t,a));case"kick":return Cae(e,zc(e,t,a));case"sit":return jae(e,zc(e,t,a),t);case"watch":return Tae(e,zc(e,t,a),t);case"fish":return Sae(e,zc(e,t,a),t);case"skip":return Nae(e,zc(e,t,a),t);case"leave":{if(!n||!(n.ledgeH>0)||!(n.floorSpan>0))break;return Mae(e,n,t)}}const o=hae(e,t,a);return[{x:o.to,prop:null,act:"walk",ms:o.ms}]}const Dae=420;function Fae(e,t,n){const a=t==="right"?n-e-18:e-18;return(t==="right"?1:-1)*Math.min(Dae,Math.max(0,a))}const Uae=260,Bae=200;function Hae(e,t,n){const a=(h,g=bn(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,bn(e,c)),{...u,x:c,act:"mount",ms:Uae},{...u,x:d,act:"walk",ms:bn(c,d)},{x:d,prop:null,act:"dismount",ms:Bae,place:"floor"},{x:t,prop:null,act:"walk",ms:bn(d,t),place:"floor"}]}const $U=["bob","sway","groove"],eq=9e3,Wae=16e3,VU=1e3,Gae=.08;function $ae(e,t){const n=$U.filter(o=>o!==e),a=n[Math.min(n.length-1,Math.floor(t()*n.length))],i=(t()*2-1)*Gae;return{dance:a,beatMs:Math.round(VU*(1+i))}}function Vae(e){return Math.round(eq+e()*(Wae-eq))}const PT=["......aaaaaa......","....aa......aa....","...a..bbbbbs..a...","...cpcbbbbbscpc...","...cpcbebbescpc...","...cpcbbbbbscpc...","...cpcbbbbbscpc...","....ccbbbbbscc....","....bbbbbbbbbs....","....bbbbbbbbbs....","......bbbbbs......","......bb..bs......","......bb..bs......","......bb..bs......"],tq=18,Kae=PT.length,KU="M6 9H4V1H5V0H7V-1H9V1H7V2H5V7H6V8H7V9Z",JU="M12 9H14V6H13V3H11V2H9V4H12Z",OT=new Set(["a","c","p"]);function Oo(e=PT){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 Jae=[".xx.","xxxx",".xx."],Yae=["..xx..",".xsxx.","xssxxx","xxxxsx",".xxxx.","..xx.."],Zae=["...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."],Wv={litter:Jae,ball:Yae,scope:Zae},Xae=["...hhhhhh...","...hhhhhh...","...kkkkkk...","hhhhhhhhhhhh"],Qae=3,ese=-1,AN=11,nq=9;function aq(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 tse(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),[T,A]=m.useState(()=>document.hidden);m.useEffect(()=>{const O=new Set,L=()=>{var R;if(document.hidden){for(const P of((R=S.current)==null?void 0:R.getAnimations({subtree:!0}))??[])if(P.playState==="running"||P.pending){const D=P.currentTime;P.pause(),D!==null&&(P.currentTime=D),O.add(P)}}else{for(const P of O)P.playState==="paused"&&P.play();O.clear()}A(document.hidden)};return L(),document.addEventListener("visibilitychange",L),()=>document.removeEventListener("visibilitychange",L)},[e,t]);const[q,_]=m.useState(null),[I,z]=m.useState(VU),[F,U]=m.useState(()=>{var O;return((O=window.matchMedia)==null?void 0:O.call(window,"(prefers-reduced-motion: reduce)").matches)??!1});return m.useEffect(()=>{var R;const O=(R=window.matchMedia)==null?void 0:R.call(window,"(prefers-reduced-motion: reduce)");if(!O)return;const L=()=>U(O.matches);return L(),O.addEventListener("change",L),()=>O.removeEventListener("change",L)},[]),m.useEffect(()=>{var K;if(!e||t||F)return;const O=aq(document);let L=0;i(ee=>L=ee);let R=null,P=0,D=0;const $=ee=>{var pe,ae;const[te,...le]=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 ue=(ae=(pe=S.current)==null?void 0:pe.querySelector('.fm-prop[data-prop="ball"]'))==null?void 0:ae.getBoundingClientRect();ue&&f({x:Fae(ue.x,Hv(te,ge,"left"),window.innerWidth),drop:Math.max(48,window.innerHeight-ue.y+24)})}D=te.act==="walk"?Math.max(bn(ge,ve),yae):te.ms,te.act==="carry"&&(D=bn(ge,ve)),r(D),N(ue=>Hv({...te,x:ve},ge,ue)),i(ve),L=ve,R=te,P=Date.now(),O.schedule(()=>$(le),D)},B=()=>{const ee=S.current,te=ee==null?void 0:ee.querySelector(".fm-sprite"),le=ee==null?void 0:ee.parentElement;if(!ee||!te||!le)return null;const ge=ee.getBoundingClientRect(),ve=le.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"),le=B();if(!ee||!te||le==null)return;const ge=ee.getBoundingClientRect().bottom-te.getBoundingClientRect().bottom;if(ge>0)return{ledgeH:ge,floorSpan:le,ledgeSpan:G()}},W=()=>{const ee=S.current,te=document.querySelector(".canvas-notices");if(!ee||!te)return null;const le=ee.getBoundingClientRect(),ge=te.getBoundingClientRect();return ge.width<=0||ge.height<=0?null:{left:ge.left-le.right,right:ge.right-le.right,height:ge.height}},H=ee=>{const te=(ee.place??"ledge")==="floor",le=te?B()??G():G(),ge=te&&ee.floorFrac!=null?-Math.round(ee.floorFrac*le):ee.x;return Math.max(-le,Math.min(0,ge))},X=()=>{if(!R)return;const ee=H(R);ee!==L&&(r(Math.max(0,P+D-Date.now())),N(te=>Hv({...R,x:ee},L,te)),i(ee),L=ee)},V=()=>{O.schedule(()=>{const ee=Iae(L,Math.random,Z()),te=ee.some(ve=>ve.place==="floor")?W():null;let le=L;const ge=ee.flatMap(ve=>{const pe=le;if(le=ve.x,!(ve.place==="floor"&&ve.act==="walk"))return[ve];const ae=Hae(pe,ve.x,te),ue=ae.length-1;return ve.floorFrac==null?ae:ae.map((Se,ke)=>ke===ue?{...Se,floorFrac:ve.floorFrac}:Se)});$(ge)},pae(Math.random))},Q=(K=S.current)==null?void 0:K.parentElement,J=typeof ResizeObserver>"u"?null:new ResizeObserver(X);return Q&&J&&J.observe(Q),V(),()=>{O.dispose(),J==null||J.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 O=aq(document),L=R=>{const P=$ae(R,Math.random);_(P.dance),z(P.beatMs),O.schedule(()=>L(P.dance),Vae(Math.random))};return L(null),()=>O.dispose()},[n,F]),{scene:S,suspended:T,x:a,walkMs:o,act:c,prop:u,ballFlight:g,place:b,facing:y,riser:w,dance:q,beatMs:I}}const Gv={e:"fm-eye",s:"fm-shade",p:"fm-pad"},Jg=Oo().filter(e=>!OT.has(e.cell)),nse=Oo().filter(e=>OT.has(e.cell)),sq=Jg.filter(e=>e.cell==="e"),ase=Oo(Xae),sse=Jg.filter(e=>e.y<AN&&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),ise={left:Jg.filter(e=>e.y>=AN&&e.x<nq),right:Jg.filter(e=>e.y>=AN&&e.x>=nq)},ose=m.memo(function({act:t,facing:n}){return s.jsxs("svg",{viewBox:`0 0 ${tq} ${Kae}`,shapeRendering:"crispEdges","aria-hidden":!0,children:[s.jsx("g",{className:"fm-gear",children:s.jsx("g",{className:"fm-gear-motion",children:nse.map(a=>s.jsx("rect",{x:a.x,y:a.y,width:a.w,height:1,className:Gv[a.cell]},`g${a.y}-${a.x}`))})}),s.jsxs("g",{className:"fm-body",children:[sq.map(a=>s.jsx("rect",{x:a.x,y:a.y,width:a.w,height:1,fill:"var(--accent)"},`eye-bed-${a.x}`)),sse.map(a=>s.jsx("rect",{x:a.x,y:a.y,width:a.w,height:1,className:Gv[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"})]}),sq.map(a=>s.jsx("rect",{x:a.x-(a.x>=tq/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:ase.map(a=>s.jsx("rect",{x:Qae+a.x,y:ese+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:KU}),s.jsx("path",{className:"fm-grip-right",d:JU})]}),(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:ise[a].map(i=>s.jsx("rect",{x:i.x,y:i.y,width:i.w,height:1,className:Gv[i.cell]},`${a}${i.y}-${i.x}`))},a))]})}),rse=["...o........o.....","...of......fo.....","...owffffffwo.....","...offfffffso.....","...ofefffefso.....","....owwnwwso......",".....wwwww........",".....fwwwfs.......","....ffwwwffs...ww.","....ffwwwffs..wfs.","......fwwfssfffs..","......ff..fsffs...","......ff..fs......","......oo..oo......"],cse=[".....aaaaaaa......","...aa.......aa....","..a...........a...","..cp.........pc...","..cp.........pc...","..cp.........pc...","..c...........c..."],Gs={f:"#d88735",s:"#a55b24",o:"#63351e",w:"#ffe2aa",n:"#372821"},lse={p:"fm-pad"},Ru=Oo(rse),dse=Oo(cse);function RN(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 use=RN(Ru.filter(e=>e.y>=8),12,18),hse=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),iq=Ru.filter(e=>e.cell==="e"),pse={left:RN(Ru.filter(e=>e.y>=11),0,9),right:RN(Ru.filter(e=>e.y>=11),9,12)},gse=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:use.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:dse.map(r=>s.jsx("rect",{x:r.x,y:r.y,width:r.w,height:1,className:lse[r.cell]},`g${r.y}-${r.x}`))})}),s.jsxs("g",{className:"fm-body",children:[hse.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}`)),iq.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})]}),iq.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:KU}),s.jsx("path",{className:"fm-grip-right",d:JU})]}),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:pse[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))]})}),mse=[".......dddd.......","......dhhhhd......",".....dhhhhhhd.....","....dhwwhhwwhd....","....dhwewwewhd....","....dhwwbbwwhd....","....dhwwwwwwhd....","....dhwwwwwwhd....","....dhwwwwwwhd....",".....dhwwwwhd.....",".....dhwwwwhd.....","......dhhhhd......","......bb..bb......",".....bbb..bbb....."],Ci={d:"#3b4855",h:"#657b8b",w:"#f4f0df",e:"#19242b",b:"#f0b44b",s:"#c88736"},fse={p:"fm-pad"},Yg=Oo(mse),bse=Oo(PT).filter(e=>OT.has(e.cell)),oq=Yg.filter(e=>e.cell==="e"),vse=Yg.filter(e=>e.y<12&&e.cell!=="e"),kse={left:Yg.filter(e=>e.y>=12&&e.x<9),right:Yg.filter(e=>e.y>=12&&e.x>=9)},wse=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:bse.map(o=>s.jsx("rect",{x:o.x,y:o.y,width:o.w,height:1,className:fse[o.cell]},`g${o.y}-${o.x}`))})}),s.jsxs("g",{className:"fm-body",children:[vse.map(o=>s.jsx("rect",{x:o.x,y:o.y,width:o.w,height:1,fill:Ci[o.cell]},`b${o.y}-${o.x}`)),oq.map(o=>s.jsx("rect",{x:o.x,y:o.y,width:o.w,height:1,fill:Ci.w},`bed${o.x}`)),s.jsxs("g",{className:"fm-arms",fill:Ci.d,children:[s.jsx("path",{d:"M4 8H6V10H5V11H4Z"}),s.jsx("path",{d:"M12 8H14V11H13V10H12Z"})]}),oq.map(o=>s.jsx("rect",{x:o.x,y:o.y,width:o.w,height:1,className:"fm-eye",style:{fill:Ci.e}},`e${o.x}`))]}),n&&s.jsxs("g",{className:"fm-grip",style:{fill:Ci.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:Ci.b},children:[s.jsx("path",{d:"M5 12H8V13H5Z"}),s.jsx("path",{d:"M10 12H13V13H10Z"})]}),i&&s.jsxs("g",{className:"fm-seated-legs",style:{fill:Ci.b},children:[s.jsx("path",{className:"fm-seated-far",style:{fill:Ci.s},d:"M10 11H12V12H13V14H10V13H11V12H10Z"}),s.jsx("path",{d:"M6 11H8V12H7V13H8V14H4V13H5V12H6Z"})]}),["left","right"].map(o=>s.jsx("g",{className:"fm-leg","data-side":o,children:kse[o].map(r=>s.jsx("rect",{x:r.x,y:r.y,width:r.w,height:1,fill:Ci.b},`${r.y}-${r.x}`))},o))]})});function YU({character:e,act:t,facing:n}){return e==="penguin"?s.jsx(wse,{act:t,facing:n}):e==="fox"?s.jsx(gse,{act:t,facing:n}):s.jsx(ose,{act:t,facing:n})}const yse={"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 ZU(e,t,n=x){return t&&kl(t.id)===e?t.name:Km(e)?n("radio.fm.custom"):yse[e]}function $v(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 rq={litter:$v(Wv.litter,"litter"),ball:$v(Wv.ball,"ball"),scope:$v(Wv.scope,"scope")};function xse(e,t=x){try{return new URL(e).host}catch{return t("radio.fm.server")}}const Cse=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:T,beatMs:A}=tse(r,c,d);if(!r||c)return null;const q=ZU(n,a,o),_=r.audio?xse(r.audio,o):"YouTube";return s.jsxs("div",{ref:h,className:"fm","data-suspended":g?"":void 0,"data-place":w,style:{"--fm-beat":`${A}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":`${WU}ms`,"--fm-ball-turn":j==="right"?"1080deg":"-1080deg"},children:rq[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":`${GU}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:rq[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?T??$U[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(YU,{character:i,act:k,facing:j})})]})]})});function Sse({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:Xne(n.channel,window.location.origin,n.video),onLoad:()=>o(Qne()),allow:"autoplay; encrypted-media",sandbox:"allow-scripts allow-same-origin allow-presentation"})}):null}const Nse={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 jse({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:Nse[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 Ase({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:Hee,children:[s.jsx("button",{type:"button",className:"icon-btn","aria-label":t("radio.close"),onClick:e,children:s.jsx(jse,{name:"close"})}),s.jsx(Tse,{opening:!0})]})}const Rse=m.lazy(()=>Wr(()=>import("./RadioPanel-D_qTIO0G.js"),[]));function Ese({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=lae(),[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=oae({volume:e.fmVolume,muted:e.fmMuted,source:e.fmSource,playRequest:e.fmPlayRequest,customStation:y,enabled:o,onAvailabilityChange:e.markFmStationAvailability}),j=ZU(e.fmSource,y,c),S=o&&N&&w.dead&&e.fmPlayRequest>0?BU(f??g.catalogue,N.id,k.current):null,{remember:T}=g,A=(y==null?void 0:y.id)??e.fmSource;m.useEffect(()=>{w.playing&&T(A)},[A,w.playing,T]);const q=i,_=At(i),I=m.useCallback((z,F=!1)=>{var R;if(!o)return;F||k.current.clear();const U=kl(z.id),O=U===e.fmSource;if(O&&w.armed&&!w.dead){w.press();return}const L=O&&!!y&&(y.url!==z.url||((R=y.radio)==null?void 0:R.hls)!==z.radio.hls);e.addFmStation(z,!0),O&&!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 dae(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(Cse,{character:n,player:w,source:e.fmSource,customStation:y}),s.jsx(Sse,{player:w,label:j}),a&&qt.createPortal(s.jsx("div",{className:"modal-backdrop radio-backdrop",..._,children:s.jsx(m.Suspense,{fallback:s.jsx(Ase,{onClose:q}),children:s.jsx(Rse,{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 qse({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:Wm(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(),lte(e.noteKey)},children:"×"})]}),a&&s.jsx("p",{className:"recap-note-text",title:wte(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(cq,{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(cq,{plan:i,head:a!=null,face:!0})]}),s.jsx(Mr,{type:"source",position:it.Right,style:{background:"transparent",border:"none"}})]})}const _se={completed:"board.state.done",in_progress:"board.detail.now",pending:"board.detail.todo"};function cq({plan:e,head:t,face:n=!1}){const a=se(),i=ai(e);if(!i)return null;const o=uQ(e.items);return s.jsxs("div",{className:n?"recap-face-plan":"recap-note-plan",title:n?void 0:_m(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(_se[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 Mo(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 zse(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 Lse(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 lq=7e3,Pse=2e3,Ose=140,Mse=(e=x)=>e("board.rearrange.text"),Ise=(e=x)=>e("board.rearrange.said"),dq=(e=x)=>e("board.rearrange.restored"),Dse={set:(e,t)=>setTimeout(e,t),clear:e=>clearTimeout(e),now:()=>Date.now()};function Fse(e,t=Dse){let n=null,a=null,i=0,o=lq;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=lq,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 Use(e){return(e.key==="z"||e.key==="Z")&&(e.metaKey||e.ctrlKey)&&!e.altKey&&!e.shiftKey}function Bse(e){return Mo(e)?"⌘Z":"Ctrl+Z"}function Hse({undo:e}){const t=se(),{open:n,said:a,undo:i,dismiss:o,hold:r,release:c}=e,d=Vc(n,Ose),u=m.useRef(null);return m.useEffect(()=>n?Nn.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}),wo(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:Mse(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:Bse(Ao())})]})]})]})}function Wse({sourceX:e,sourceY:t,targetX:n,targetY:a,sourcePosition:i,targetPosition:o,style:r}){const[c]=Xj({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 EN(e){return e.replace(/[^a-zA-Z0-9]/g,"")}function Xg(e,t){const n=EN(e);return n?n.slice(-t):e.slice(-t)}function XU(e,t,n=4){const a=EN(e);if(!a)return Xg(e,n);let i=n;for(const o of t){if(o===e)continue;const r=EN(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 QU(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(Cr);return`${e.alarm?t("board.cluster.waitingOnYou"):""}${n}
|
|
130
130
|
${t("board.cluster.zoomTo")}
|
|
131
131
|
${t("board.cluster.dragWrapper")}`}const Cr=" · ",Gse=32,$se=/[\u1100-\u115F\u2E80-\u303E\u3041-\u33FF\u3400-\u4DBF\u4E00-\u9FFF\uA000-\uA4CF\uAC00-\uD7A3\uF900-\uFAFF\uFE30-\uFE6F\uFF00-\uFF60\uFFE0-\uFFE6]/;function uq(e){return $se.test(e)?2:1}function hq(e,t=Gse){const n=[...e];let a=0;for(const r of n)a+=uq(r);if(a<=t)return e;const i=[];let o=0;for(const r of n){const c=uq(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 Vse(e,t,n,a,i=[],{branch:o,plan:r,alarm:c=!1}={}){const d=(t==null?void 0:t.trim())??"",u=a?XU(n,i):void 0,h=[e,d||void 0,u].filter(Boolean),g=[o,d||void 0,u].filter(Boolean).join(Cr);return{label:hq(e),name:d?hq(d):void 0,shortId:u,fullLabel:h.join(Cr),title:QU({alarm:c,tipWorkspace:e,tipRest:g,planLine:r}),tipWorkspace:e,tipRest:g}}const Sr=18,qN=26,MT=12,Eu=240,IT=130,_N=Sr*2+qN+MT,Kse=72,il=_N+Kse,kg=24,eB=70,Qg=Sr*2+kg,wl=il;function tB(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,nB=160,aB=1;function Jse(e,t,n,a){return Math.min(aB,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 Ym(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 Yse(e,t){return((t==null?void 0:t.get(e))??0)>0?ol:0}function Zse(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)??IT}}function El(e,t,n){const a=qu(e,t);return{w:a.w+Yse(e,n),h:Math.max(a.h,Zse(e,n))}}function Xse(e){return[...e.keys()].sort().map(t=>`${t}:${e.get(t)}`).join("|")}const Qse=240,sB=16;function iB(e,t){return(e+Qse)*(t||1)}function eie(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 tie(e,t,n,a){return{position:"absolute",left:e.x+sB,top:e.y-MT/(t||1),transform:`scale(${1/(t||1)})`,transformOrigin:"left top",maxWidth:a??iB(e.w,t),"--session-hue":n}}function nie(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:aie(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,...Vse(o.label,o.name,i,c,r,{branch:o.branch,plan:o.planLine,alarm:o.alarm}),x:o.minX-Sr,y:o.minY-Sr-qN,w:o.maxX-o.minX+Sr*2,h:o.maxY-o.minY+Sr*2+qN,...o.alarm?{alarm:!0}:null,...o.branch?{branch:o.branch}:null,...o.plan?{plan:o.plan,planLine:o.planLine}:null})}return a}function aie(e){if(e.kind!=="root")return null;const t=e.branch,n=ai(e.plan);return{label:e.label,name:Fm(e.sessionName,e.sessionTitle).face,alarm:Qn(e.waiting),branch:t&&t.total>0?vU(t):void 0,plan:n?`plan ${n.done}/${n.total}`:void 0,planLine:n?mT(n):void 0}}function sie(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 iie=20,Si=4,oie=64,rie=".cat-filter-bar, .react-flow__panel, .autofit-chip, .rearrange-undo, .usage-panel, .sysdetail, .detail";function cie(e,t,n,a){const i=t.zoom||1,o=iB(e.w,i);if(n.width<=0||n.height<=0)return{maxWidth:o,hidden:!1};const r=(e.x+sB)*i+t.x,c=e.y*i+t.y-MT,d=c+iie;let u=Math.min(o,n.width-Si-r),h=r<Si||c<Si||d>n.height-Si;for(const g of a)if(!(g.top-Si>=d||g.bottom+Si<=c)&&!(g.right+Si<=r)){if(g.left-Si<=r){h=!0;break}u=Math.min(u,g.left-Si-r)}return u<oie&&(h=!0),{maxWidth:Math.max(0,u),hidden:h}}function lie(e){const t=e.getBoundingClientRect(),n=[];for(const a of e.ownerDocument.querySelectorAll(rie)){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 die(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 uie=500;function oB({focus:e,setTimeout:t,clearTimeout:n,ms:a=uie}){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 hie(e){return nie(e.nodeInternals.values())}const pie=e=>e.width,gie=e=>e.height,mie=e=>{var t;return((t=e.domNode)==null?void 0:t.querySelector(".react-flow__viewport"))??null};function fie({onFocusSession:e}){const t=se(),{x:n,y:a,zoom:i}=s2(),o=Nt(hie,sie),r=Nt(pie),c=Nt(gie),d={width:r,height:c},u=m.useRef(null),h=Nt(mie),[g,f]=m.useState([]);m.useLayoutEffect(()=>{var _;const T=(_=u.current)==null?void 0:_.parentElement;if(!T)return;const A=lie(T),q=requestAnimationFrame(()=>{f(I=>die(I,A)?I:A)});return()=>cancelAnimationFrame(q)});const b=m.useRef(e);b.current=e;const[k]=m.useState(()=>oB({focus:T=>{var A;return(A=b.current)==null?void 0:A.call(b,T)},setTimeout:(T,A)=>window.setTimeout(T,A),clearTimeout:T=>window.clearTimeout(T)}));if(m.useEffect(()=>()=>k.cancel(),[k]),o.length<=1)return null;const y=T=>{try{e==null||e(T)}catch{}},N=(T,A)=>{T.detail>0&&Sl()?k.hold(A):y(A)},w={transform:`translate(${n}px, ${a}px) scale(${i})`},j=s.jsx("div",{className:"session-clusters",style:w,ref:u,children:o.map(T=>{const A=ju(T.sessionId),q=eie(T,A);return s.jsx("div",{className:"cluster-card",style:q,"aria-hidden":!0},T.sessionId)})}),S=h&&qt.createPortal(s.jsx("div",{className:"cluster-labels nopan",children:o.map(T=>{const A=ju(T.sessionId),q=cie(T,{x:n,y:a,zoom:i},d,g),_=tie(T,i,A,q.maxWidth);return s.jsxs("button",{type:"button",className:"cluster-label","data-alarm":T.alarm?"":void 0,"data-offpane":q.hidden?"":void 0,style:_,title:QU(T,t),onClick:I=>N(I,T.sessionId),children:[T.alarm?s.jsxs(s.Fragment,{children:[s.jsx(TT,{}),s.jsx("span",{className:"cluster-label-said",children:t("board.cluster.waitingOnYou")})]}):null,T.label,T.plan?s.jsx("span",{className:"cluster-label-plan",children:Cr+t("board.cluster.planCount",{progress:T.plan.replace(/^plan /,"")})}):null,T.branch?s.jsx("span",{className:"cluster-label-branch",children:Cr+T.branch}):null,T.name?s.jsx("span",{className:"cluster-label-name",children:Cr+T.name}):null,T.shortId?s.jsx("span",{className:"cluster-label-id",children:Cr+T.shortId}):null]},T.sessionId)})}),h);return s.jsxs(s.Fragment,{children:[j,S]})}function bie({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 rB=600,vie=4,kie=36,tm=14,wie=60,yie=6,pq=220,xie=96,Cie=28;function Sie(e,t){return Math.max(xie,61+[...t].length*6.8)}function Nie(e){return e.endedAt==null?"inflight":e.ok===!1?"err":"done"}function jie(e,t){if(t==null)return 1;const n=e-t;return n<0?1:Math.max(0,1-n/rB)}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 Aie(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>rB)continue;const d=a.get(c.id)??n.get(c.id);if(!d)continue;const u=Tie(c.tools,vie);if(u.length===0)continue;const h=c.exitAt??null,g=i.get(c.id),f=Math.max((g==null?void 0:g.width)??pq,pq),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 T=S*kie,A=k+f+wie,q=y+yie+T,_=jie(o,h),I=j.inputPreview??"",z=Nie(j),F=_<.999,U=NT(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:kU(j.name),mcpHue:U.hue,inputPreview:I,fade:_,fading:F,worldX:A,worldY:q,anchorX:N,anchorY:w,spawnDx:N-A,spawnDy:w-(q+tm)});const O=CU(j.name,j.input);if(O){const L=Sie(j.name,U.label),R=A+L+Cie,P=q,D=A+L,$=q+tm;r.push({id:`sub:${c.id}::${j.id}`,toolId:j.id,agentId:c.id,toolName:j.name,name:Kte(O.label,O.category),fullName:O.label,emoji:O.emoji,isSub:!0,status:z,category:O.category,inputPreview:O.detail??I,fade:_,fading:F,worldX:R,worldY:P,anchorX:D,anchorY:$,spawnDx:D-R,spawnDy:0})}})}return r}function Rie({agents:e,visibleAgentIds:t,positions:n,pinned:a,measured:i,spotlight:o,hiddenCategories:r,now:c,onOpenTool:d}){const u=Aie(e,t,n,a,i,c),h=r&&r.size>0?u.filter(g=>!r.has(g.category)):u;return s.jsx(Eie,{bursts:h,spotlight:o,onOpenTool:d})}function Eie({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(zie,{b:o,dim:t!=null&&!t.has(o.agentId),onOpenTool:n},o.id));return s.jsx(qie,{connectors:a,bubbles:i})}function qie({connectors:e,bubbles:t}){const{x:n,y:a,zoom:i}=s2();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 _ie(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 zie=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:"×"})]})})},_ie),Lie={width:140,height:105},Pie={agent:wne,sessionGroup:bie,recapNote:qse},Oie={recapTie:Wse},gq=400;function Mie({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:T,edges:A,visibleAgentIds:q,spotlightSet:_}=e,{positionsRef:I,pinnedRef:z,handleRelayout:F,rearrangeUndo:U}=t,{restoredViewport:O,onMoveStart:L,onMove:R}=n,{onNodeClick:P,onPaneClick:D,onNodeDoubleClick:$,onNodeMouseEnter:B,onNodeMouseLeave:G}=a,{onNodeDragStart:Z,onNodeDrag:W,onNodeDragStop:H}=i,{palette:X,minimapNodeFill:V,characterEnabled:Q}=o,{autoFitDisabled:J,enableAutoFitAndRefit:K}=u,{paused:ee,pauseGate:te,togglePause:le}=h;return s.jsxs(a2,{nodes:T,edges:A,nodeTypes:Pie,edgesFocusable:!1,edgeTypes:Oie,fitView:!O,fitViewOptions:{padding:.25,duration:gN({durationMs:gq,documentHidden:document.hidden})?gq:0},minZoom:l2,maxZoom:d2,panOnScroll:!0,panActivationKeyCode:null,nodesDraggable:!0,nodesConnectable:!1,selectionOnDrag:!1,nodeDragThreshold:5,disableKeyboardA11y:!0,deleteKeyCode:null,onNodeClick:P,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(fie,{onFocusSession:N}),s.jsx(Rie,{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:[J&&s.jsx(Ane,{enableAutoFitAndRefit:K}),s.jsx(Hse,{undo:U})]}),s.jsx(Fne,{autoFitDisabled:J,enableAutoFitAndRefit:K,paused:ee,pauseGate:te,togglePause:le,handleRelayout:F,requestClear:w,setKeyHelpOpen:j}),s.jsx(g8,{ariaLabel:S("board.minimap"),style:Lie,zoomable:!0,pannable:!0,nodeColor:V,nodeStrokeWidth:2,maskColor:X["--minimap-mask"],maskStrokeColor:X["--line"]}),s.jsx(Ese,{fm:r,character:o.character,characterEnabled:Q,open:c,onClose:d})]})}function Iie(){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 Die=600;function Zm(e,t){return!(e.exitAt!=null&&t-e.exitAt>Die||e.kind==="root"&&e.state==="done"&&e.tools.length===0&&e.endedAt!=null&&e.endedAt-e.startedAt<3e3&&!e.stopFailure)}function Fie(e,t){const n=new Set;for(const a of e.agents.values())Zm(a,t)&&n.add(a.id);return n}function Uie(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 Bie(e,t,n=0){if(!e)return!1;for(const a of t)if(Uie(e,a,n))return!0;return!1}function mq(e){return e.waiting?Qn(e.waiting)?0:1:e.state==="active"?2:3}function cB(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=CT(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:_m(((a=i.plan)==null?void 0:a.items)??[]),toolCount:o,cost:r,startedAt:i.startedAt,lastActivity:c})}return n.sort((i,o)=>{const r=mq(i),c=mq(o);return r!==c?r-c:i.waiting&&o.waiting?i.waiting.since-o.waiting.since:o.lastActivity-i.lastActivity}),n}function Hie(e,t){return[e.text,e.reply?t("board.list.suggestedReply",{reply:e.reply}):"",Wm(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 Wie({state:e,now:t,selectedIds:n,onSelect:a,onClose:i,removedIds:o,onBringBackAll:r,leaving:c=!1}){const d=se(),u=ja(),h=zn(),g=m.useMemo(()=>cB(e),[e,e.revision,t]),f=g.filter(k=>k.state==="active").length,b=g.filter(k=>Qn(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:qn(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:jo(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":Om(k.modelId),title:Au(k.modelId,k.effort),children:Mm(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:St(k.cost)})}),k.waiting?s.jsxs("span",{className:"sl-waiting",title:[fl(k.waiting,d),sU(k.waiting,fl(k.waiting,d),d),d(Qn(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 @@ ${_m(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
|
`)}`:Au(e.model,e.effort),children:[Mm(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:St(h.total)}),s.jsx("span",{className:"hero-cost-label",children:c("board.detail.spend")})]}),s.jsx(eA,{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:qn(c("board.detail.listLower"),"L",r)}):c("board.detail.removeSub",{list:qn(c("board.detail.listUpper"),"L",r)}),children:c("board.detail.remove")})]})]}),s.jsx(vne,{agent:e}),(()=>{const S=CT(e);if(!S)return null;const T=$g(S.at,t),A=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:[A," ",s.jsx("span",{className:"section-count",title:T.title,children:T.label})]}),s.jsx("p",{className:"detail-recap",title:Wm(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((T,A)=>s.jsxs("li",{className:"plan-item","data-status":T.status,children:[s.jsx("span",{className:"plan-mark","aria-hidden":!0}),s.jsxs("span",{className:"vis-hidden",children:[c(QCe[T.status]),c("board.detail.colon")]}),s.jsx("span",{className:"plan-text",children:T.status==="in_progress"&&T.active?T.active:T.text}),T.status==="in_progress"&&s.jsx("span",{className:"plan-now","aria-hidden":!0,children:c("board.detail.now")})]},T.id??`${A}:${T.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,T])=>{const A=S==="mcp"?w:null,q=A==null?void 0:A.hue,_=c("board.detail.catCalls",{count:T,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:A?c("board.detail.catAllTo",{calls:_,server:A.label}):_,children:[s.jsx("span",{className:"cat-emoji","aria-hidden":!0,children:yW[S]}),s.jsx("span",{className:"cat-name",children:Hg(S,c)}),s.jsx("span",{className:"cat-count",children:T}),A&&s.jsx("span",{className:"cat-server",children:A.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:It(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:It(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:It(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:It(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:N2(e.prompts).length})]}),s.jsx("div",{className:"prompts",children:YCe(e.prompts).reverse().map(({pr:S,key:T})=>{const A=$g(S.at,t),q=qm(S.text);return q?s.jsxs("details",{className:"prompt-entry prompt-injected",children:[s.jsxs("summary",{children:[s.jsx("span",{className:"prompt-time",title:A.title,children:A.label}),s.jsx("span",{className:"prompt-injected-label",children:q.label})]}),q.detail&&s.jsx("div",{className:"prompt-injected-detail",children:q.detail})]},T):s.jsxs("div",{className:"prompt-entry",children:[s.jsx("div",{className:"prompt-time",title:A.title,children:A.label}),s.jsx("div",{className:"prompt-text",children:S.text})]},T)})})]}),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=iU(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();jn("detail-panel");const d=zn();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:T,toggles:A,openCapacity:q,integrations:_=[],openExploreIntegrations:I,openQuickOpen:z}){const F=tre(Ao()),U=Mo(Ao()),O={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(gB,{}),kind:"panel",open:t,controls:"session-list",onPress:n,buttonRef:A.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(mB,{}),kind:"panel",open:a,controls:o,onPress:i,buttonRef:A.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(poe,{}),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(goe,{}),kind:"dialog",onPress:()=>q("calendar")}]:[],P={id:"codex-accounts",label:x("codex.panel.title"),short:"Codex",...e.claude?{}:{key:{cap:"A",aria:"A",single:!0}},ariaLabel:x("codex.panel.title"),glyph:s.jsx(Coe,{}),kind:"panel",open:r,controls:"codex-accounts-panel",onPress:c,buttonRef:A.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(toe,{}),kind:"panel",open:d,controls:"usage-panel",onPress:()=>u(J=>!J),buttonRef:A.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(aoe,{}),kind:"panel",open:h,controls:"system-panel",onPress:()=>g(J=>!J),buttonRef:A.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(noe,{}),kind:"dialog",onPress:()=>f(J=>!J)},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(ioe,{watching:b===!0||k>0}),kind:"dialog",onPress:()=>y(J=>!J),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(ooe,{}),kind:"dialog",onPress:()=>S()},W={id:"quick-open",label:x("board.rail.search"),short:x("board.rail.search"),key:{cap:Qie(U),aria:U?"Meta+K":"Control+K",single:!1},ariaLabel:x("board.rail.search"),detail:x("board.rail.search.detail"),glyph:s.jsx(bB,{}),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(roe,{}),kind:"dialog",onPress:T},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(hoe,{}),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(fB,{}),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(soe,{}),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(uoe,{}),kind:"dialog",detail:x("board.rail.radio.detail"),onPress:()=>w(!0)}]:[];return{left:e.claude?[L,O]:e.codex?[P,O]:[O],codexDoor:e.claude&&e.codex?[P]:[],leftStripe:[...e.claude?[cg(e.codex?x("board.rail.accounts"):x("board.rail.group.accounts"),[L,...R])]:[],...e.codex&&!e.claude?[[P]]:[],[O]],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(J=>J.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(eoe,{}),kind:"dialog",onPress:I}]:[],integrations:_.map(({provider:J,onPress:K})=>({id:`integration-${J.kind}`,label:J.label,short:J.label,ariaLabel:J.label,detail:nu(x,J.detail),key:J.shortcut?{cap:J.shortcut.toUpperCase(),aria:J.shortcut.toUpperCase(),single:!0}:void 0,glyph:s.jsx(J.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 fm=[{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 CW(e){return fm.find(t=>t.value===e)??fm[0]}const Nj=3,OS=120,SW=1e4,NW=200,iSe=()=>x("shell.feedback.missing");function DI(e){return e.trim()!==""}function oSe(e){var o;const t=e.trim();if(t==="")return"";const n=FI(t.split(/\r?\n/,1)[0]),a=((o=/^(.+?[.!?])(?=\s|$)/.exec(n))==null?void 0:o[1])??n,i=MS(a).length>=Nj?MS(a):MS(n);return cSe(i.length>=Nj?i:FI(t))}function rSe(e,t){const n=oSe(t);return n.length>=Nj?n:x("shell.feedback.titleKind",{kind:CW(e).label,text:n})}function FI(e){return e.replace(/\s+/g," ").trim()}function MS(e){return/[^.]\.$/.test(e)?e.slice(0,-1):e}function cSe(e){if(e.length<=OS)return e;const t=e.slice(0,OS-1),n=t.lastIndexOf(" ");return`${(n>=OS/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 ZA(e){return e.key==="Enter"&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&!e.shiftKey&&!e.isComposing}function xSe(e){return Mo(e)?["⌘","Enter"]:["Ctrl","Enter"]}function CSe(e){return[...e].length===1}const jW=()=>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 UI(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"?jW():""}const BI=1400,jSe=160,TW=m.createContext({values:{}});function AW(){return m.useContext(TW)}function TSe(e,t){const n=e.variants;return n?{...e,...n.by[t[n.field]??""]??{}}:e}const HI=(e,t)=>!e.when||e.when.is.includes(t[e.when.field]??"");function ASe({def:e,existing:t,busy:n,error:a,onSubmit:i,onCancel:o,onDirtyChange:r}){var R,P;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,T=(D,$)=>{n||h(B=>({...B,[D]:$}))},A=D=>{var B;if(D.preventDefault(),n)return;const $={};for(const G of e.fields)HI(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=>HI(D,u)),z=(R=I.find(D=>!D.secret&&D.type!=="choice"))==null?void 0:R.name,F=(P=I.find(D=>D.secret))==null?void 0:P.name,U=a!=null&&a.field&&I.some(D=>D.name===a.field&&D.type!=="choice")?a.field:null,O=`${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:A,"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 $=TSe(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?O:""].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:()=>T(B.name,X.value),onKeyDown:V=>{ZA(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=>T(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:O,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:O,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}=AW(),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"}),work:s.jsx("code",{children:"write:jira-work"})})})]})}function IS(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 WI(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 DS({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 RW({kind:e,baseUrl:t}){const{values:n}=AW(),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")})," ",WI(a("forge.token.gh.classic"),{repo:s.jsx("code",{children:"repo"}),org:s.jsx("code",{children:"read:org"})})," ",s.jsx(DS,{href:IS("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(DS,{href:IS("github",null,"fine-grained"),children:a("forge.token.makeOne")})]})]}),s.jsx("p",{children:a("forge.token.gh.approval")})]});const i=IS("gitlab",t??(n.where==="self"?n.baseUrl:null));return s.jsxs("div",{className:"fg-token-help",children:[s.jsxs("p",{children:[WI(a("forge.token.gl.scope"),{scope:s.jsx("code",{children:"read_api"})})," ",s.jsx(DS,{href:i,children:a("forge.token.makeOn",{host:i?new URL(i).host:"GitLab"})})]}),s.jsx("p",{children:a("forge.token.gl.expire")})]})}const EW={name:"token",type:"password",secret:!0,get label(){return x("forge.field.token")},get placeholder(){return x("forge.field.tokenPlaceholder")}},PSe=[EW],GI=e=>{try{return e?new URL(e.baseUrl).host!=="gitlab.com":!1}catch{return!1}},OSe=[{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=>GI(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=>GI(e)?e.baseUrl:""},EW],MSe=m.createElement(RW,{kind:"github"}),ISe=m.createElement(RW,{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:foe,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:boe,detail:"Repositories, pull requests, and Actions",blurb:"github.com, read-only, with a personal access token.",fields:PSe,tokenHelp:MSe},BSe={kind:"gitlab",label:"GitLab",Glyph:voe,detail:"Projects, merge requests, and pipelines",blurb:"GitLab.com or your own instance, read-only.",fields:OSe,tokenHelp:ISe},jj={jira:FSe,github:USe,gitlab:BSe},XA=()=>Object.values(jj).filter(e=>!!e);function au(e){return(Object.hasOwn(jj,e)?jj[e]:void 0)??null}function Ff(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=At(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 qW=()=>Wr(()=>import("./IntegrationModal-2caOGb1q.js"),[]);function WSe(){qW().catch(()=>{})}const GSe=Ff(qW,e=>{var t;return((t=au(e.kind))==null?void 0:t.label)??x("integrations.modal.tracker")});function $Se({onClose:e}){return m.useEffect(()=>Nn.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 $I={"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($I,n)?$I[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 vn{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 _W(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 zW(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 _W(o);return o.json()})}async function zW(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 LW=e=>`/api/integrations/${encodeURIComponent(e.kind)}/${encodeURIComponent(e.id)}/`;function p1e(e){const t=LW(e);return(n,a)=>fetch(`${t}${n.replace(/^\/+/,"")}`,a)}function g1e(e){const t=LW(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 zW(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 _W(o);try{return await o.json()}catch(r){throw i.aborted?r:new Za("upstream",x("integrations.error.notJson"))}})}let _i={connections:null,providers:[],error:""};const Qc=new Set;let dg=null,Bd=null,dl=null,VI=0;const ZSe=5e3,XSe=3;function bm(e){_i={..._i,...e},Qc.forEach(t=>t(_i))}function Uf(){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"));bm({connections:t,providers:n,error:""})}catch(e){bm({error:Mi(e,x("integrations.error.readConnections"))}),_i.connections===null&&Qc.size>0&&dl===null&&VI<XSe&&(dl=window.setTimeout(()=>{dl=null,Uf()},ZSe*2**VI++))}finally{Bd=null}})(),Bd)}function QSe(e){return e.connections===null||e.providers.length>0||e.connections.length>0}function KI(){QSe(_i)&&Uf()}function QA(e){const t=_i.connections??[],n=t.findIndex(a=>a.id===e.id);bm({connections:n<0?[...t,e]:t.map(a=>a.id===e.id?e:a)})}function eNe(e){bm({connections:(_i.connections??[]).filter(t=>t.id!==e)})}function hh(){const[e,t]=m.useState(_i);return m.useEffect(()=>{Qc.add(t),t(_i);const n=()=>{document.visibilityState==="visible"&&KI()};return Qc.size===1&&(Uf(),dg=window.setInterval(KI,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 vm(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)&&vm(e,t).length>0}function e0(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 QA(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 QA(n.connection),n}async function aNe(e){const t=await uh(`/api/integrations/connections/${encodeURIComponent(e)}/test`,{method:"POST",body:"{}",timeoutMs:6e4});return QA(t.connection),t.connection}async function sNe(e){await uh(`/api/integrations/connections/${encodeURIComponent(e)}`,{method:"DELETE"}),eNe(e)}function gr(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 km=null,wm=null;function JI(e){wm=null,km=e}function iNe(e){km=null,wm=e}function oNe(){const e=wm;return wm=null,e}function rNe(){const e=km;return km=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=At(t),d=XA().filter(g=>e.providers.some(f=>f.kind===g.kind)||vm(e,g.kind).length>0),u=d.filter(g=>Tj(e,g.kind)).length,h=g=>{t(),g()};return qt.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=vm(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=sU(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:T,toggles:A,openCapacity:q,integrations:_=[],openExploreIntegrations:I,openQuickOpen:z}){const F=tre(Ao()),U=Mo(Ao()),O={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(gB,{}),kind:"panel",open:t,controls:"session-list",onPress:n,buttonRef:A.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(mB,{}),kind:"panel",open:a,controls:o,onPress:i,buttonRef:A.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(poe,{}),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(goe,{}),kind:"dialog",onPress:()=>q("calendar")}]:[],P={id:"codex-accounts",label:x("codex.panel.title"),short:"Codex",...e.claude?{}:{key:{cap:"A",aria:"A",single:!0}},ariaLabel:x("codex.panel.title"),glyph:s.jsx(Coe,{}),kind:"panel",open:r,controls:"codex-accounts-panel",onPress:c,buttonRef:A.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(toe,{}),kind:"panel",open:d,controls:"usage-panel",onPress:()=>u(J=>!J),buttonRef:A.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(aoe,{}),kind:"panel",open:h,controls:"system-panel",onPress:()=>g(J=>!J),buttonRef:A.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(noe,{}),kind:"dialog",onPress:()=>f(J=>!J)},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(ioe,{watching:b===!0||k>0}),kind:"dialog",onPress:()=>y(J=>!J),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(ooe,{}),kind:"dialog",onPress:()=>S()},W={id:"quick-open",label:x("board.rail.search"),short:x("board.rail.search"),key:{cap:Qie(U),aria:U?"Meta+K":"Control+K",single:!1},ariaLabel:x("board.rail.search"),detail:x("board.rail.search.detail"),glyph:s.jsx(bB,{}),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(roe,{}),kind:"dialog",onPress:T},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(hoe,{}),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(fB,{}),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(soe,{}),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(uoe,{}),kind:"dialog",detail:x("board.rail.radio.detail"),onPress:()=>w(!0)}]:[];return{left:e.claude?[L,O]:e.codex?[P,O]:[O],codexDoor:e.claude&&e.codex?[P]:[],leftStripe:[...e.claude?[cg(e.codex?x("board.rail.accounts"):x("board.rail.group.accounts"),[L,...R])]:[],...e.codex&&!e.claude?[[P]]:[],[O]],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(J=>J.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(eoe,{}),kind:"dialog",onPress:I}]:[],integrations:_.map(({provider:J,onPress:K})=>({id:`integration-${J.kind}`,label:J.label,short:J.label,ariaLabel:J.label,detail:nu(x,J.detail),key:J.shortcut?{cap:J.shortcut.toUpperCase(),aria:J.shortcut.toUpperCase(),single:!0}:void 0,glyph:s.jsx(J.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 fm=[{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 CW(e){return fm.find(t=>t.value===e)??fm[0]}const Nj=3,OS=120,SW=1e4,NW=200,iSe=()=>x("shell.feedback.missing");function DI(e){return e.trim()!==""}function oSe(e){var o;const t=e.trim();if(t==="")return"";const n=FI(t.split(/\r?\n/,1)[0]),a=((o=/^(.+?[.!?])(?=\s|$)/.exec(n))==null?void 0:o[1])??n,i=MS(a).length>=Nj?MS(a):MS(n);return cSe(i.length>=Nj?i:FI(t))}function rSe(e,t){const n=oSe(t);return n.length>=Nj?n:x("shell.feedback.titleKind",{kind:CW(e).label,text:n})}function FI(e){return e.replace(/\s+/g," ").trim()}function MS(e){return/[^.]\.$/.test(e)?e.slice(0,-1):e}function cSe(e){if(e.length<=OS)return e;const t=e.slice(0,OS-1),n=t.lastIndexOf(" ");return`${(n>=OS/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 ZA(e){return e.key==="Enter"&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&!e.shiftKey&&!e.isComposing}function xSe(e){return Mo(e)?["⌘","Enter"]:["Ctrl","Enter"]}function CSe(e){return[...e].length===1}const jW=()=>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 UI(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"?jW():""}const BI=1400,jSe=160,TW=m.createContext({values:{}});function AW(){return m.useContext(TW)}function TSe(e,t){const n=e.variants;return n?{...e,...n.by[t[n.field]??""]??{}}:e}const HI=(e,t)=>!e.when||e.when.is.includes(t[e.when.field]??"");function ASe({def:e,existing:t,busy:n,error:a,onSubmit:i,onCancel:o,onDirtyChange:r}){var R,P;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,T=(D,$)=>{n||h(B=>({...B,[D]:$}))},A=D=>{var B;if(D.preventDefault(),n)return;const $={};for(const G of e.fields)HI(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=>HI(D,u)),z=(R=I.find(D=>!D.secret&&D.type!=="choice"))==null?void 0:R.name,F=(P=I.find(D=>D.secret))==null?void 0:P.name,U=a!=null&&a.field&&I.some(D=>D.name===a.field&&D.type!=="choice")?a.field:null,O=`${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:A,"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 $=TSe(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?O:""].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:()=>T(B.name,X.value),onKeyDown:V=>{ZA(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=>T(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:O,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:O,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}=AW(),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"}),work:s.jsx("code",{children:"write:jira-work"})})})]})}function IS(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 WI(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 DS({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 RW({kind:e,baseUrl:t}){const{values:n}=AW(),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")})," ",WI(a("forge.token.gh.classic"),{repo:s.jsx("code",{children:"repo"}),org:s.jsx("code",{children:"read:org"})})," ",s.jsx(DS,{href:IS("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(DS,{href:IS("github",null,"fine-grained"),children:a("forge.token.makeOne")})]})]}),s.jsx("p",{children:a("forge.token.gh.approval")})]});const i=IS("gitlab",t??(n.where==="self"?n.baseUrl:null));return s.jsxs("div",{className:"fg-token-help",children:[s.jsxs("p",{children:[WI(a("forge.token.gl.scope"),{scope:s.jsx("code",{children:"read_api"})})," ",s.jsx(DS,{href:i,children:a("forge.token.makeOn",{host:i?new URL(i).host:"GitLab"})})]}),s.jsx("p",{children:a("forge.token.gl.expire")})]})}const EW={name:"token",type:"password",secret:!0,get label(){return x("forge.field.token")},get placeholder(){return x("forge.field.tokenPlaceholder")}},PSe=[EW],GI=e=>{try{return e?new URL(e.baseUrl).host!=="gitlab.com":!1}catch{return!1}},OSe=[{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=>GI(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=>GI(e)?e.baseUrl:""},EW],MSe=m.createElement(RW,{kind:"github"}),ISe=m.createElement(RW,{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:foe,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:boe,detail:"Repositories, pull requests, and Actions",blurb:"github.com, read-only, with a personal access token.",fields:PSe,tokenHelp:MSe},BSe={kind:"gitlab",label:"GitLab",Glyph:voe,detail:"Projects, merge requests, and pipelines",blurb:"GitLab.com or your own instance, read-only.",fields:OSe,tokenHelp:ISe},jj={jira:FSe,github:USe,gitlab:BSe},XA=()=>Object.values(jj).filter(e=>!!e);function au(e){return(Object.hasOwn(jj,e)?jj[e]:void 0)??null}function Ff(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=At(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 qW=()=>Wr(()=>import("./IntegrationModal-C5Hg-4qW.js"),[]);function WSe(){qW().catch(()=>{})}const GSe=Ff(qW,e=>{var t;return((t=au(e.kind))==null?void 0:t.label)??x("integrations.modal.tracker")});function $Se({onClose:e}){return m.useEffect(()=>Nn.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 $I={"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($I,n)?$I[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 vn{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 _W(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 zW(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 _W(o);return o.json()})}async function zW(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 LW=e=>`/api/integrations/${encodeURIComponent(e.kind)}/${encodeURIComponent(e.id)}/`;function p1e(e){const t=LW(e);return(n,a)=>fetch(`${t}${n.replace(/^\/+/,"")}`,a)}function g1e(e){const t=LW(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 zW(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 _W(o);try{return await o.json()}catch(r){throw i.aborted?r:new Za("upstream",x("integrations.error.notJson"))}})}let _i={connections:null,providers:[],error:""};const Qc=new Set;let dg=null,Bd=null,dl=null,VI=0;const ZSe=5e3,XSe=3;function bm(e){_i={..._i,...e},Qc.forEach(t=>t(_i))}function Uf(){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"));bm({connections:t,providers:n,error:""})}catch(e){bm({error:Mi(e,x("integrations.error.readConnections"))}),_i.connections===null&&Qc.size>0&&dl===null&&VI<XSe&&(dl=window.setTimeout(()=>{dl=null,Uf()},ZSe*2**VI++))}finally{Bd=null}})(),Bd)}function QSe(e){return e.connections===null||e.providers.length>0||e.connections.length>0}function KI(){QSe(_i)&&Uf()}function QA(e){const t=_i.connections??[],n=t.findIndex(a=>a.id===e.id);bm({connections:n<0?[...t,e]:t.map(a=>a.id===e.id?e:a)})}function eNe(e){bm({connections:(_i.connections??[]).filter(t=>t.id!==e)})}function hh(){const[e,t]=m.useState(_i);return m.useEffect(()=>{Qc.add(t),t(_i);const n=()=>{document.visibilityState==="visible"&&KI()};return Qc.size===1&&(Uf(),dg=window.setInterval(KI,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 vm(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)&&vm(e,t).length>0}function e0(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 QA(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 QA(n.connection),n}async function aNe(e){const t=await uh(`/api/integrations/connections/${encodeURIComponent(e)}/test`,{method:"POST",body:"{}",timeoutMs:6e4});return QA(t.connection),t.connection}async function sNe(e){await uh(`/api/integrations/connections/${encodeURIComponent(e)}`,{method:"DELETE"}),eNe(e)}function gr(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 km=null,wm=null;function JI(e){wm=null,km=e}function iNe(e){km=null,wm=e}function oNe(){const e=wm;return wm=null,e}function rNe(){const e=km;return km=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=At(t),d=XA().filter(g=>e.providers.some(f=>f.kind===g.kind)||vm(e,g.kind).length>0),u=d.filter(g=>Tj(e,g.kind)).length,h=g=>{t(),g()};return qt.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=vm(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=sU(e,n,t);return a?`${n}
|
|
152
152
|
${a}`:n}const vNe=new Set(["idle","checking","current","downloading","ready","error"]);function YI(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 OW(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"),MW=3e4;function IW(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 DW(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 FW(e,t,n=typeof navigator>"u"?"":navigator.userAgent){const a=IW(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:MW/1e3,way:o});case"refused":return x("shell.desktop.fail.refused",{way:o});case"unreachable":return x("shell.desktop.fail.unreachable",{way:o})}}function ZI(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"),FS=()=>x("shell.chip.notesClick");function SNe(e){if(e.checkDisabled)return x("shell.chip.titleOff",{off:CNe(),click:FS()});if(e.checking)return x("shell.chip.titleBusy",{asking:x("shell.chip.asking"),click:FS()});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:FS()})}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 UW(e){return e?`${e.kind}:${e.to}`:""}function TNe(e,t){return e!=null&&t!==UW(e)}function ANe({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 ja(),s.jsx(s.Fragment,{children:e?(()=>{const f=wNe(OW()??i,e.version),b=h&&DW(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?ZI(r-a.checkedAt):null,checkFailedAgo:a!=null&&a.checkFailedAt&&a.checkFailedAt>(a.checkedAt??0)?ZI(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=zn();return s.jsx("span",{className:"status",children:(()=>{const o=Mne({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 BW(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=zn(),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?BW(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 XI({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 PNe({waitingSessions:e,waitingCursorRef:t,focusSession:n,now:a,onFit:i,onMore:o}){const r=se(),c=zn(),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 A=Array.from(j.children),q=A.pop();f(hNe({widths:A.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 T=new ResizeObserver(S);return T.observe(w),T.observe(j),()=>T.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(XI,{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:BW(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(XI,{w,now:a})},w.id)),s.jsx("span",{className:"wait-more",children:r("board.note.more",{n:e.length})})]}),d.node]})}const ONe={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(ONe[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:T}=t,{readyAppUpdate:A,desktopUpdateRestarting:q,desktopUpdateFailure:_,askDesktopUpdateRestart:I}=n,z=m.useRef(!1);m.useEffect(()=>{q||!z.current||(z.current=!1,_&&T())},[q,_,T]);const F=B=>{z.current=!0,I(B)},{paused:U,pauseGate:O}=a,L=se(),{blockedSaid:R,watchSaid:P,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:Hle,width:19,height:16,alt:""}),s.jsx("img",{className:"logo logo-on-light",src:Wle,width:19,height:16,alt:""}),s.jsx("h1",{children:Et}),s.jsx(ANe,{readyAppUpdate:A,notice:k,noticeOpen:y,version:b,chipVersion:S,versionChecking:w,now:h,openReleaseNotes:T,showNotice:N,loadVersion:j,restartToUpdate:F,updateRestarting:q})]}),s.jsx(RNe,{live:u,paused:U,pauseGate:O}),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:P}),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(ede,{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=zn(),c=pa(e),d=Math.max(0,((e.endedAt??t)-e.startedAt)/1e3),u=e.state==="active"&&!e.synthetic?kT(c.total,d):null,h=n.size-1;return s.jsxs("button",{type:"button",className:"selected-ribbon",title:`${qn(o("board.ribbon.zoom",{label:e.label}),"Z",r)}${c.total>0?`
|
|
155
|
-
${o("board.ribbon.spent",{cost:St(c.total)})}${u?` · ${u}`:""}`:""}`,onClick:()=>{try{a(e.id)}catch{}},children:[s.jsx("span",{className:`state-pill state-${e.state}`,children:jo(e.state,o)}),s.jsx("span",{className:"selected-label",children:e.label}),c.total>0&&s.jsxs("span",{className:"selected-cost",children:[St(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=zn();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:qn(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:T}=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:A=>{const q=A.target;if(!$A(q)||y.current==null||y.current==="detail")return;const _=q.getAttribute("data-id");_&&r.current.agents.has(_)&&q.matches(":focus-visible")&&sW(_,q,"focus")},onBlurCapture:A=>{var _,I;const q=(I=(_=A.target).getAttribute)==null?void 0:I.call(_,"data-id");q&&_o(q)},children:[d,wo(g)&&s.jsx(WNe,{trashZoneRef:f,trashState:h,trashPhase:g,trashLabel:b}),s.jsx(wxe,{agentFor:w,recapFor:S,labelFor:j,bounds:T})]})}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:Et}):(()=>{const o=Pne({connected:n,paused:a});return s.jsxs(s.Fragment,{children:[i("shell.banner.lost",{product:Et}),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:Et})}),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 HW=()=>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,ea(((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:HW()}),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 WW(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 QI(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=WW(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 Aj={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:Et,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"):Aj.npx}):t!=null&&t.upgradeBlocked?s.jsx("span",{className:"ver-sub",children:dn(Aj,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:T,dismissNotice:A}=t,{upgradeState:q,startUpgrade:_,copyCommand:I,cmdCopied:z}=n,{oldName:F,oldNameOpen:U,dismissOldName:O}=a,{ratingPhase:L,ratingScore:R,answerRating:P,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}):T&&S?s.jsx(lje,{notice:S,version:j,dismissNotice:A,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:O}):L!=="hidden"?s.jsx(QNe,{phase:L,score:R,onAnswer:P,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"?HW():""})]})}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:Iee}),r=At(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 Rj(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")}),fm.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=>{ZA(i.nativeEvent)&&i.preventDefault()}}),a.label]},a.value))]})}const GW="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":GW,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:GW,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:NW,autoComplete:"email",placeholder:vSe(),"aria-describedby":i,onChange:o=>n(o.target.value),onKeyDown:o=>{ZA(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 Nr=3,kje=5*1024*1024,wje=12*1024*1024,Ej=8192,yje=64*1024,xje=256*1024,Cje=.92,Sje=640,$W=.9,Nje=.85,jje=6,Tje=512*1024,ym={png:"image/png",jpeg:"image/jpeg"},Aje={png:"png",jpeg:"jpg"},Rje=[137,80,78,71,13,10,26,10],Eje=[255,216,255];function VW(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=VW(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 eD(e,t){return e.bytes>t||e.width>Ej||e.height>Ej}function Pje(e){return Math.min(kje,wje-yje-e)}function KW(e,t){return{width:Math.max(1,Math.floor(e.width*t)),height:Math.max(1,Math.floor(e.height*t))}}function Oje(e,t){const n=Ej/Math.max(e.width,e.height),a=e.bytes>t?Math.sqrt(t/e.bytes)*$W:1;return KW(e,Math.min(1,n,a))}async function Mje(e,t,n){let a=Oje(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=KW(a,Math.min(Nje,Math.sqrt(t/r.size)*$W)),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,Tje).arrayBuffer()),i=VW(a);if(!i)return{ok:!1,problem:"type"};if(t<xje)return{ok:!1,problem:"no_room"};const o=e.type===ym[i]?e:new Blob([e],{type:ym[i]}),r=qje(a);if(r&&!eD({...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(!eD(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)},ym[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===ym.jpeg?"jpeg":"png";n.append("images",a,`image-${i+1}.${Aje[o]}`)}),{method:"POST",body:n}}const Gje=()=>x("shell.feedback.addShot"),tD=()=>x("shell.feedback.addHint"),$je=()=>x("shell.feedback.shotsNote"),nD=()=>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:Nr});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 JW="image/png,image/jpeg";function YW({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>=Nr;return s.jsxs(s.Fragment,{children:[s.jsxs("button",{ref:t,type:"button",className:"fb-tool",title:tD(),"aria-describedby":"fb-attach-hint",onClick:()=>{var i;return a?e.sayFull():(i=n.current)==null?void 0:i.click()},children:[s.jsx(YW,{}),Gje()]}),s.jsx("span",{id:"fb-attach-hint",hidden:!0,children:tD()}),s.jsx("input",{ref:n,type:"file",accept:JW,multiple:!0,hidden:!0,onChange:i=>{e.add(Array.from(i.target.files??[])),i.target.value=""}})]})}function eTe({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:JW,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 tTe(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 nTe(e,t,n){return n?e.map(a=>a.id===t.id?t:a):[...e,t]}function aTe(e,t,n){return n?e.map(a=>a.id===t?n:a):e.filter(a=>a.id!==t)}function sTe(e){const[t,n]=m.useState(()=>tTe((e==null?void 0:e.ready)??[],1)),[a,i]=m.useState({problem:"",id:0}),o=m.useRef(0),r=m.useCallback(O=>{O&&o.current++,i(L=>O?{problem:O,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(O=>{u.current=O(u.current),n(u.current)},[]);m.useEffect(()=>(f.current=!0,()=>{f.current=!1;for(const O of u.current)URL.revokeObjectURL(O.url)}),[]);const w=m.useCallback(async(O,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),P=(L==null?void 0:L.id)??++g.current,D=URL.createObjectURL(O),$={id:P,name:O.name||"image",url:D,blob:null,resized:null},B=y.current;b.current.set(P,O);let G=!1;const Z=()=>{G||(G=!0,N(X=>nTe(X,$,L!==void 0)))},W=await Ije(O,Pje(R),async X=>(Z(),Fje(X))).catch(()=>({ok:!1,problem:"unreadable"})),H=u.current.some(X=>X.id===P);return!f.current||y.current!==B||!H&&(G||L)?(URL.revokeObjectURL(D),L&&URL.revokeObjectURL(L.url),f.current&&b.current.delete(P),""):(b.current.delete(P),W.ok?(Z(),L&&URL.revokeObjectURL(L.url),N(X=>X.map(V=>V.id===P?{...V,blob:W.blob,resized:W.resized}:V)),""):(URL.revokeObjectURL(D),G&&N(X=>aTe(X,P,L)),Xje(W.problem,O.name||"image")))},[N]),j=m.useCallback(async O=>{r("");const L=y.current,R=[];let P=0,D=0;for(const B of O){if(!f.current||y.current!==L)return;const G=k.current.indexOf(B);if(G!==-1&&k.current.splice(G,1),u.current.length>=Nr){P++;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;P>0&&R.push(D===0&&R.length===0?nD():Yje(P)),r(R.join(" "));const $=u.current.length;D>0&&d(x("shell.feedback.imagesAdded",{count:D,total:$,max:Nr}))},[w,r]),S=m.useCallback(async(O,L)=>{r("");const R=u.current.find($=>$.id===O);if(!R)return j([L]);const P=await w(L,R);if(!f.current)return;r(P);const D=u.current.findIndex($=>$.id===O);!P&&D!==-1&&d(x("shell.feedback.imageReplaced",{n:D+1,total:u.current.length,max:Nr}))},[j,w,r]),T=m.useCallback(O=>{const L=y.current;h.current=(h.current??Promise.resolve()).then(()=>y.current===L?O():void 0).catch(()=>{})},[]),A=m.useCallback(O=>{O.length!==0&&(k.current.push(...O),T(()=>j(O)))},[j,T]);m.useEffect(()=>{e&&e.waiting.length>0&&A(e.waiting)},[]);const q=m.useCallback((O,L)=>{const R=L[0];R&&T(()=>S(O,R))},[T,S]),_=m.useCallback(O=>{const L=u.current.find(R=>R.id===O);L&&(URL.revokeObjectURL(L.url),b.current.delete(O),N(R=>R.filter(P=>P.id!==O)),r(""),d(x("shell.feedback.imageRemoved",{count:u.current.length,max:Nr})))},[N,r]),I=m.useCallback(()=>r(nD()),[r]),z=m.useCallback(async()=>{const O=o.current;return await h.current,o.current!==O?null:u.current.flatMap(L=>L.blob?[L.blob]:[])},[]),F=m.useCallback(()=>({ready:u.current.flatMap(O=>O.blob&&!b.current.has(O.id)?[{name:O.name,blob:O.blob,resized:O.resized}]:[]),waiting:[...b.current.values(),...k.current]}),[]),U=m.useCallback(()=>{y.current++;for(const O of u.current)URL.revokeObjectURL(O.url);b.current.clear(),k.current=[],N(()=>[]),r("")},[N,r]);return{shots:t,problem:a.problem,problemId:a.id,announcement:c,add:A,replace:q,remove:_,sayFull:I,ready:z,kept:F,clear:U}}function iTe(){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 oTe(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(!Xn(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:UI(h.status,g==null?void 0:g.reason,g==null?void 0:g.errors)})}catch{d.aborted||n({state:"failed",message:UI(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 rTe(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),BI),r=window.setTimeout(()=>i.current(),BI+jSe);return()=>{window.clearTimeout(o),window.clearTimeout(r)}},[e]),n}const US="agent-dag.feedbackDrafts",aD=4;function cTe({initialKind:e,initialBody:t}){return{kind:e??"bug",body:t??""}}function lTe(e){return JSON.stringify([e.kind,e.body])}function dTe(e){return e.ready.length+e.waiting.length}function ZW(e,t){return e.body.trim()!==t.body.trim()||e.contact.trim()!==""||e.images>0}function uTe(e){return x("shell.feedback.lost",{count:e})}const hTe=()=>x("shell.feedback.discard"),pTe=()=>x("shell.feedback.discardConfirm"),gTe=()=>x("shell.feedback.discardTitle"),sD=()=>x("shell.feedback.discardArmed"),mTe={ready:[],waiting:[]};function fTe(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!fm.some(r=>r.value===n)||typeof a!="string"||a.length>SW||typeof i!="string"||i.length>NW||typeof o!="number"||!Number.isInteger(o)||o<0||o>Nr?null:[e[0],{kind:n,body:a,contact:i,images:o}]}function bTe(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(US),c=r?JSON.parse(r):[];if(Array.isArray(c))for(const d of c.slice(-aD)){const u=fTe(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(US):o.setItem(US,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??mTe,imagesLost:r.images?0:r.imageCount}:null},keep(o,r,c){const d=dTe(r.images);if(!ZW({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<=aD)break;u.delete(h)}a()},forget:i}}function vTe(){try{return typeof window>"u"?null:window.sessionStorage}catch{return null}}const qj=bTe(vTe),kTe=4e3;function wTe(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||qj.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&&qj.forget(e)},[i,e])}const iD="draft";function yTe(e){const[t,n]=m.useState(!1),a=m.useRef(0);m.useEffect(()=>{if(!t)return;const o=window.setTimeout(()=>n(!1),kTe);return()=>window.clearTimeout(o)},[t]);function i(){const o=Date.now(),r=Ur({armedFor:t?iD:null,target:iD,armedAt:a.current,now:o,gapMs:Fr});if(r==="arm"){n(!0),a.current=o;return}r!=="ignore"&&(n(!1),e())}return{armed:t,press:i}}function XW({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=At(e),y=cTe({initialKind:t,initialBody:n}),N=lTe(y),[w]=m.useState(()=>qj.read(N)),[j,S]=m.useState((w==null?void 0:w.kind)??y.kind),[T,A]=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),[O,L]=m.useState(!1),[R,P]=m.useState(!1),D=sTe(w==null?void 0:w.images),$=pSe(iTe()),{outcome:B,sending:G,send:Z,clearFailure:W}=oTe(D),H=B.state==="sent",X=rTe(H,e);wTe(N,y,{kind:j,body:T,contact:q},D,H);const V=ZW({body:T,contact:q,images:D.shots.length},y),Q=yTe(()=>{var Ae;S(y.kind),A(y.body),_(""),z(0),L(!1),D.clear(),W(),(Ae=i.current)==null||Ae.focus()}),J=CW(j),K=O&&!DI(T),ee=I>0&&D.shots.length===0,te=[K&&"fb-body-error",ee&&"fb-images-lost"].filter(Boolean).join(" ")||void 0,[le,ge]=xSe(Ao());m.useEffect(()=>{var Me,je;const Ae=c.current;if(!Ae)return;const Ke=Ae.contains(document.activeElement)||ea(((Me=document.activeElement)==null?void 0:Me.tagName)??null);Ae.inert=H,H&&Ke&&((je=o.current)==null||je.focus())},[H]),m.useEffect(()=>{var xe,Le;const Ae=d.current;if(!Ae)return;const Ke=h.current;if(G){const Ce=document.activeElement,Ie=Ce!=null&&(Ae.contains(Ce)||Ce===Ke);g.current=Ie?Ce:null,Ae.inert=!0,Ke&&(Ke.inert=!0),g.current&&((xe=u.current)==null||xe.focus());return}Ae.inert=!1,Ke&&(Ke.inert=!1);const Me=g.current;g.current=null;const je=document.activeElement===u.current||ea(((Le=document.activeElement)==null?void 0:Le.tagName)??null);!H&&Me&&je&&Me.focus()},[G,H]);function ve(Ae){var Ke;if(Ae.preventDefault(),!DI(T)){L(!0),(Ke=i.current)==null||Ke.focus();return}Z({kind:j,body:T,contact:q})}const pe=!H&&!G,ae=Ae=>Uje(Array.from(Ae.dataTransfer.types));function ue(Ae){!ae(Ae)||!pe||(Ae.preventDefault(),f.current++,P(!0))}function Se(Ae){ae(Ae)&&(Ae.preventDefault(),Ae.dataTransfer.dropEffect=pe?"copy":"none")}function ke(Ae){ae(Ae)&&(f.current=Math.max(0,f.current-1),f.current===0&&P(!1))}function ye(Ae){ae(Ae)&&(Ae.preventDefault(),f.current=0,P(!1),pe&&D.add(Array.from(Ae.dataTransfer.files)))}function He(Ae){Ae.target!==Ae.currentTarget||!ae(Ae)||(Ae.preventDefault(),Ae.dataTransfer.dropEffect="none")}function Be(Ae){ae(Ae)&&Ae.preventDefault()}function Ve(Ae){if(!pe)return;const Ke=Array.from(Ae.clipboardData.files),Me=Ae.target,je=Me instanceof HTMLTextAreaElement||Me instanceof HTMLInputElement,xe=Array.from(Ae.clipboardData.types).includes("text/plain");Bje({files:Ke.length,hasText:xe,intoTextField:je})&&(Ae.preventDefault(),D.add(Ke))}return s.jsx("div",{className:"modal-backdrop",...k,role:"presentation",onDragOver:He,onDrop:Be,"data-leaving":X||void 0,children:s.jsxs("div",{ref:b,className:"modal feedback-dialog",onClick:Ae=>Ae.stopPropagation(),onDragEnter:ue,onDragOver:Se,onDragLeave:ke,onDrop:ye,onPaste:Ve,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?sD():NSe(B.state)}),s.jsxs("div",{className:"fb-stage",children:[s.jsxs("form",{ref:c,className:"fb-form",onSubmit:ve,onKeyDown:Ae=>{ySe(Ae.nativeEvent)&&(Ae.preventDefault(),Ae.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:J.question}),s.jsx("textarea",{ref:i,id:"fb-body",className:"ap-manage-input fb-message",value:T,maxLength:SW,rows:5,placeholder:J.placeholder,onChange:Ae=>A(Ae.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(eTe,{images:D,addRef:r}),ee&&s.jsx("p",{id:"fb-images-lost",className:"fb-hint",children:uTe(I)}),s.jsxs("div",{className:"fb-tools",children:[s.jsx(Qje,{images:D,buttonRef:r}),s.jsx(bje,{open:F,onToggle:()=>U(Ae=>!Ae)})]}),s.jsx(vje,{open:F,contact:q,onContact:_})]}),s.jsx("p",{className:"fb-facts",children:$?Rj(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:Ae=>{Ae.repeat&&Ae.preventDefault()},onClick:Q.press,title:Q.armed?sD():gTe(),children:Q.armed?pTe():hTe()}),s.jsxs("span",{className:"fb-shortcut","aria-hidden":"true",children:[s.jsx("kbd",{"data-symbol":CSe(le)||void 0,children:le}),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:jW()})]})]}),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(YW,{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 BS=[{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:[]}]}],xTe=/ ?\([A-Z?]\)/g;function QW(e,t=()=>!0){const n=a=>a.integration===void 0||t(a.integration);return e&&BS.every(a=>a.rows.every(n))?BS:BS.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(xTe,"")})})).filter(a=>a.rows.length>0)}function CTe(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 STe({onClose:e,onTour:t,onSettings:n}){const a=se(),i=Tt(e),o=At(e),r=Mo(Ao()),c=zn(),d=hh(),u=QW(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:CTe(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 NTe(e,t){return`${e}#${t}`}function jTe(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=NTe(r.key,r.since);if(a.has(c)||wpe(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 TTe(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 e5({rows:e,ours:t,dialogs:n}){return e===0?!1:t||n===0}function ATe(e,t=x){return t("accounts.reauth.title",{count:e})}function RTe(e,t=x){return t("accounts.reauth.lead",{count:e})}const ETe=(e=x)=>e("accounts.reauth.expired"),qTe=(e=x)=>e("accounts.reauth.singleNote"),_Te=(e=x)=>e("accounts.reauth.laterTip");function zTe(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 LTe({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=At(r),g=To(n,"accept"),f=To(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(Hr,{text:c("lan.ask.who",{when:fA(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(Hr,{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 PTe(e){const t=m.useRef(!1),n=OTe(e),a=e5({rows:n?1:0,ours:t.current,dialogs:Nn.dialogDepth()});return t.current=a,a?n:null}function OTe({lanPending:e,lanDeferred:t,lanBusy:n,answerLanPair:a,deferLanPair:i}){const{request:o,waiting:r}=zTe(e,t.current);return o?s.jsx(LTe,{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 MTe({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:vA(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:qTe(i)})]}):s.jsxs(s.Fragment,{children:[s.jsx("p",{id:"reauth-lead",className:"reauth-lead",children:RTe(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:ETe(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:_Te(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 ITe({rows:e,onSignIn:t,onLater:n}){const a=se(),i=m.useRef(null),o=Tt(n,{focusRef:i}),r=At(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:ATe(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(MTe,{rows:e,onSignIn:t,onLater:n,firstRef:i})]})})}function DTe({rows:e,signingIn:t,signIn:n,signedIn:a,refresh:i,closeSignIn:o,later:r,pairing:c=!1}){const d=m.useRef(!1),u=Nn.dialogDepth()+(c?1:0),h=t!=null||e5({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(ITe,{rows:e,onSignIn:n,onLater:r},e.length===1?"one":"many"):null}const FTe={"//":["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.82.1":"Clearer network shortcuts, accurate account capacity and Codex recovery fixes","3.82.0":"Steadier Codex switching, and uninstall cleans up Codex's terminal selection","3.81.4":"Codex account switching works with Windows sandbox logins","3.81.3":"More reliable Codex switching and quieter account rows","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.82.1":[{title:"Local network controls, easier to find",body:"Open this deck’s network settings or the network graph directly from the Local network row.",priority:"highlight"},{title:"More accurate account capacity",body:"Accounts at their weekly limit no longer inflate the average remaining five-hour capacity.",priority:"highlight",icon:"accounts"},{title:"Codex account recovery fixes",body:"Codex account control can recover after temporary startup timeouts and checks account changes again when reconnecting.",priority:"highlight",icon:"accounts"}],"3.82.0":[{title:"🔄 Codex switching recovers instead of staying stuck",body:"A failed reconnect or manual switch no longer leaves Codex account control disconnected, and turning Auto-switch off stops a switch it had already queued.",priority:"highlight",icon:"accounts",details:"On Windows, a Codex connection that never answers now fails after 30 seconds instead of waiting forever."},{title:"⏱️ Slow Codex logins get more time and a Retry button",body:"ccdeck now gives Codex more time to read a login during a switch, and if it still runs out, the panel says why and offers Retry selected account.",priority:"highlight",icon:"accounts"},{title:"🧹 Uninstall also removes Codex's terminal selection",body:"ccdeck --uninstall now takes the codex block that Enable terminal selection added out of your shell profiles, and names any file it could not clean.",priority:"highlight"},{title:"⌨️ A opens Codex accounts on a Codex-only deck",body:"With Codex alone, the Codex accounts door now shows its A key, and its name follows your interface language."},{title:"🔑 Jira token help names the permission for comments and statuses",body:"A scoped Jira Cloud token needs write:jira-work to add comments and change statuses, and the token help and Settings › Integrations now say so."},{title:"🌍 Codex messages read correctly in every language",body:"The message about a Codex login folder that is not private enough had lost its accented and non-Latin letters; it is whole again, and the new timeout message is translated."}],"3.81.4":[{title:"🔄 Switch Codex accounts without another sign-in",body:"On Windows, Switch can use your existing native Codex login while keeping its sandbox permissions unchanged.",priority:"highlight",icon:"accounts"},{title:"🔐 New Windows accounts are ready for switching",body:"Accounts added through + now get private folders from the start, and older native login files are recognized."},{title:"💬 Clearer account-switching errors",body:"If a login cannot be used safely, ccdeck explains the folder-permission problem and how to continue."}],"3.81.3":[{title:"🔄 More reliable Codex account switching",body:"ccdeck retries temporary connection failures before switching the open Codex app.",priority:"highlight",icon:"accounts"},{title:"✨ Quieter account switching",body:"Successful switches no longer leave an extra message under the account row."},{title:"⌨️ Arrow-key navigation in ccdeck tui",body:"The footer and help now show the left and right arrow keys for moving between tabs."}],"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.
|
|
155
|
+
${o("board.ribbon.spent",{cost:St(c.total)})}${u?` · ${u}`:""}`:""}`,onClick:()=>{try{a(e.id)}catch{}},children:[s.jsx("span",{className:`state-pill state-${e.state}`,children:jo(e.state,o)}),s.jsx("span",{className:"selected-label",children:e.label}),c.total>0&&s.jsxs("span",{className:"selected-cost",children:[St(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=zn();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:qn(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:T}=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:A=>{const q=A.target;if(!$A(q)||y.current==null||y.current==="detail")return;const _=q.getAttribute("data-id");_&&r.current.agents.has(_)&&q.matches(":focus-visible")&&sW(_,q,"focus")},onBlurCapture:A=>{var _,I;const q=(I=(_=A.target).getAttribute)==null?void 0:I.call(_,"data-id");q&&_o(q)},children:[d,wo(g)&&s.jsx(WNe,{trashZoneRef:f,trashState:h,trashPhase:g,trashLabel:b}),s.jsx(wxe,{agentFor:w,recapFor:S,labelFor:j,bounds:T})]})}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:Et}):(()=>{const o=Pne({connected:n,paused:a});return s.jsxs(s.Fragment,{children:[i("shell.banner.lost",{product:Et}),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:Et})}),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 HW=()=>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,ea(((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:HW()}),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 WW(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 QI(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=WW(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 Aj={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:Et,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"):Aj.npx}):t!=null&&t.upgradeBlocked?s.jsx("span",{className:"ver-sub",children:dn(Aj,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:T,dismissNotice:A}=t,{upgradeState:q,startUpgrade:_,copyCommand:I,cmdCopied:z}=n,{oldName:F,oldNameOpen:U,dismissOldName:O}=a,{ratingPhase:L,ratingScore:R,answerRating:P,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}):T&&S?s.jsx(lje,{notice:S,version:j,dismissNotice:A,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:O}):L!=="hidden"?s.jsx(QNe,{phase:L,score:R,onAnswer:P,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"?HW():""})]})}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:Iee}),r=At(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 Rj(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")}),fm.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=>{ZA(i.nativeEvent)&&i.preventDefault()}}),a.label]},a.value))]})}const GW="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":GW,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:GW,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:NW,autoComplete:"email",placeholder:vSe(),"aria-describedby":i,onChange:o=>n(o.target.value),onKeyDown:o=>{ZA(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 Nr=3,kje=5*1024*1024,wje=12*1024*1024,Ej=8192,yje=64*1024,xje=256*1024,Cje=.92,Sje=640,$W=.9,Nje=.85,jje=6,Tje=512*1024,ym={png:"image/png",jpeg:"image/jpeg"},Aje={png:"png",jpeg:"jpg"},Rje=[137,80,78,71,13,10,26,10],Eje=[255,216,255];function VW(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=VW(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 eD(e,t){return e.bytes>t||e.width>Ej||e.height>Ej}function Pje(e){return Math.min(kje,wje-yje-e)}function KW(e,t){return{width:Math.max(1,Math.floor(e.width*t)),height:Math.max(1,Math.floor(e.height*t))}}function Oje(e,t){const n=Ej/Math.max(e.width,e.height),a=e.bytes>t?Math.sqrt(t/e.bytes)*$W:1;return KW(e,Math.min(1,n,a))}async function Mje(e,t,n){let a=Oje(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=KW(a,Math.min(Nje,Math.sqrt(t/r.size)*$W)),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,Tje).arrayBuffer()),i=VW(a);if(!i)return{ok:!1,problem:"type"};if(t<xje)return{ok:!1,problem:"no_room"};const o=e.type===ym[i]?e:new Blob([e],{type:ym[i]}),r=qje(a);if(r&&!eD({...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(!eD(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)},ym[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===ym.jpeg?"jpeg":"png";n.append("images",a,`image-${i+1}.${Aje[o]}`)}),{method:"POST",body:n}}const Gje=()=>x("shell.feedback.addShot"),tD=()=>x("shell.feedback.addHint"),$je=()=>x("shell.feedback.shotsNote"),nD=()=>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:Nr});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 JW="image/png,image/jpeg";function YW({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>=Nr;return s.jsxs(s.Fragment,{children:[s.jsxs("button",{ref:t,type:"button",className:"fb-tool",title:tD(),"aria-describedby":"fb-attach-hint",onClick:()=>{var i;return a?e.sayFull():(i=n.current)==null?void 0:i.click()},children:[s.jsx(YW,{}),Gje()]}),s.jsx("span",{id:"fb-attach-hint",hidden:!0,children:tD()}),s.jsx("input",{ref:n,type:"file",accept:JW,multiple:!0,hidden:!0,onChange:i=>{e.add(Array.from(i.target.files??[])),i.target.value=""}})]})}function eTe({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:JW,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 tTe(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 nTe(e,t,n){return n?e.map(a=>a.id===t.id?t:a):[...e,t]}function aTe(e,t,n){return n?e.map(a=>a.id===t?n:a):e.filter(a=>a.id!==t)}function sTe(e){const[t,n]=m.useState(()=>tTe((e==null?void 0:e.ready)??[],1)),[a,i]=m.useState({problem:"",id:0}),o=m.useRef(0),r=m.useCallback(O=>{O&&o.current++,i(L=>O?{problem:O,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(O=>{u.current=O(u.current),n(u.current)},[]);m.useEffect(()=>(f.current=!0,()=>{f.current=!1;for(const O of u.current)URL.revokeObjectURL(O.url)}),[]);const w=m.useCallback(async(O,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),P=(L==null?void 0:L.id)??++g.current,D=URL.createObjectURL(O),$={id:P,name:O.name||"image",url:D,blob:null,resized:null},B=y.current;b.current.set(P,O);let G=!1;const Z=()=>{G||(G=!0,N(X=>nTe(X,$,L!==void 0)))},W=await Ije(O,Pje(R),async X=>(Z(),Fje(X))).catch(()=>({ok:!1,problem:"unreadable"})),H=u.current.some(X=>X.id===P);return!f.current||y.current!==B||!H&&(G||L)?(URL.revokeObjectURL(D),L&&URL.revokeObjectURL(L.url),f.current&&b.current.delete(P),""):(b.current.delete(P),W.ok?(Z(),L&&URL.revokeObjectURL(L.url),N(X=>X.map(V=>V.id===P?{...V,blob:W.blob,resized:W.resized}:V)),""):(URL.revokeObjectURL(D),G&&N(X=>aTe(X,P,L)),Xje(W.problem,O.name||"image")))},[N]),j=m.useCallback(async O=>{r("");const L=y.current,R=[];let P=0,D=0;for(const B of O){if(!f.current||y.current!==L)return;const G=k.current.indexOf(B);if(G!==-1&&k.current.splice(G,1),u.current.length>=Nr){P++;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;P>0&&R.push(D===0&&R.length===0?nD():Yje(P)),r(R.join(" "));const $=u.current.length;D>0&&d(x("shell.feedback.imagesAdded",{count:D,total:$,max:Nr}))},[w,r]),S=m.useCallback(async(O,L)=>{r("");const R=u.current.find($=>$.id===O);if(!R)return j([L]);const P=await w(L,R);if(!f.current)return;r(P);const D=u.current.findIndex($=>$.id===O);!P&&D!==-1&&d(x("shell.feedback.imageReplaced",{n:D+1,total:u.current.length,max:Nr}))},[j,w,r]),T=m.useCallback(O=>{const L=y.current;h.current=(h.current??Promise.resolve()).then(()=>y.current===L?O():void 0).catch(()=>{})},[]),A=m.useCallback(O=>{O.length!==0&&(k.current.push(...O),T(()=>j(O)))},[j,T]);m.useEffect(()=>{e&&e.waiting.length>0&&A(e.waiting)},[]);const q=m.useCallback((O,L)=>{const R=L[0];R&&T(()=>S(O,R))},[T,S]),_=m.useCallback(O=>{const L=u.current.find(R=>R.id===O);L&&(URL.revokeObjectURL(L.url),b.current.delete(O),N(R=>R.filter(P=>P.id!==O)),r(""),d(x("shell.feedback.imageRemoved",{count:u.current.length,max:Nr})))},[N,r]),I=m.useCallback(()=>r(nD()),[r]),z=m.useCallback(async()=>{const O=o.current;return await h.current,o.current!==O?null:u.current.flatMap(L=>L.blob?[L.blob]:[])},[]),F=m.useCallback(()=>({ready:u.current.flatMap(O=>O.blob&&!b.current.has(O.id)?[{name:O.name,blob:O.blob,resized:O.resized}]:[]),waiting:[...b.current.values(),...k.current]}),[]),U=m.useCallback(()=>{y.current++;for(const O of u.current)URL.revokeObjectURL(O.url);b.current.clear(),k.current=[],N(()=>[]),r("")},[N,r]);return{shots:t,problem:a.problem,problemId:a.id,announcement:c,add:A,replace:q,remove:_,sayFull:I,ready:z,kept:F,clear:U}}function iTe(){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 oTe(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(!Xn(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:UI(h.status,g==null?void 0:g.reason,g==null?void 0:g.errors)})}catch{d.aborted||n({state:"failed",message:UI(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 rTe(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),BI),r=window.setTimeout(()=>i.current(),BI+jSe);return()=>{window.clearTimeout(o),window.clearTimeout(r)}},[e]),n}const US="agent-dag.feedbackDrafts",aD=4;function cTe({initialKind:e,initialBody:t}){return{kind:e??"bug",body:t??""}}function lTe(e){return JSON.stringify([e.kind,e.body])}function dTe(e){return e.ready.length+e.waiting.length}function ZW(e,t){return e.body.trim()!==t.body.trim()||e.contact.trim()!==""||e.images>0}function uTe(e){return x("shell.feedback.lost",{count:e})}const hTe=()=>x("shell.feedback.discard"),pTe=()=>x("shell.feedback.discardConfirm"),gTe=()=>x("shell.feedback.discardTitle"),sD=()=>x("shell.feedback.discardArmed"),mTe={ready:[],waiting:[]};function fTe(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!fm.some(r=>r.value===n)||typeof a!="string"||a.length>SW||typeof i!="string"||i.length>NW||typeof o!="number"||!Number.isInteger(o)||o<0||o>Nr?null:[e[0],{kind:n,body:a,contact:i,images:o}]}function bTe(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(US),c=r?JSON.parse(r):[];if(Array.isArray(c))for(const d of c.slice(-aD)){const u=fTe(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(US):o.setItem(US,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??mTe,imagesLost:r.images?0:r.imageCount}:null},keep(o,r,c){const d=dTe(r.images);if(!ZW({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<=aD)break;u.delete(h)}a()},forget:i}}function vTe(){try{return typeof window>"u"?null:window.sessionStorage}catch{return null}}const qj=bTe(vTe),kTe=4e3;function wTe(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||qj.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&&qj.forget(e)},[i,e])}const iD="draft";function yTe(e){const[t,n]=m.useState(!1),a=m.useRef(0);m.useEffect(()=>{if(!t)return;const o=window.setTimeout(()=>n(!1),kTe);return()=>window.clearTimeout(o)},[t]);function i(){const o=Date.now(),r=Ur({armedFor:t?iD:null,target:iD,armedAt:a.current,now:o,gapMs:Fr});if(r==="arm"){n(!0),a.current=o;return}r!=="ignore"&&(n(!1),e())}return{armed:t,press:i}}function XW({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=At(e),y=cTe({initialKind:t,initialBody:n}),N=lTe(y),[w]=m.useState(()=>qj.read(N)),[j,S]=m.useState((w==null?void 0:w.kind)??y.kind),[T,A]=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),[O,L]=m.useState(!1),[R,P]=m.useState(!1),D=sTe(w==null?void 0:w.images),$=pSe(iTe()),{outcome:B,sending:G,send:Z,clearFailure:W}=oTe(D),H=B.state==="sent",X=rTe(H,e);wTe(N,y,{kind:j,body:T,contact:q},D,H);const V=ZW({body:T,contact:q,images:D.shots.length},y),Q=yTe(()=>{var Ae;S(y.kind),A(y.body),_(""),z(0),L(!1),D.clear(),W(),(Ae=i.current)==null||Ae.focus()}),J=CW(j),K=O&&!DI(T),ee=I>0&&D.shots.length===0,te=[K&&"fb-body-error",ee&&"fb-images-lost"].filter(Boolean).join(" ")||void 0,[le,ge]=xSe(Ao());m.useEffect(()=>{var Me,je;const Ae=c.current;if(!Ae)return;const Ke=Ae.contains(document.activeElement)||ea(((Me=document.activeElement)==null?void 0:Me.tagName)??null);Ae.inert=H,H&&Ke&&((je=o.current)==null||je.focus())},[H]),m.useEffect(()=>{var xe,Le;const Ae=d.current;if(!Ae)return;const Ke=h.current;if(G){const Ce=document.activeElement,Ie=Ce!=null&&(Ae.contains(Ce)||Ce===Ke);g.current=Ie?Ce:null,Ae.inert=!0,Ke&&(Ke.inert=!0),g.current&&((xe=u.current)==null||xe.focus());return}Ae.inert=!1,Ke&&(Ke.inert=!1);const Me=g.current;g.current=null;const je=document.activeElement===u.current||ea(((Le=document.activeElement)==null?void 0:Le.tagName)??null);!H&&Me&&je&&Me.focus()},[G,H]);function ve(Ae){var Ke;if(Ae.preventDefault(),!DI(T)){L(!0),(Ke=i.current)==null||Ke.focus();return}Z({kind:j,body:T,contact:q})}const pe=!H&&!G,ae=Ae=>Uje(Array.from(Ae.dataTransfer.types));function ue(Ae){!ae(Ae)||!pe||(Ae.preventDefault(),f.current++,P(!0))}function Se(Ae){ae(Ae)&&(Ae.preventDefault(),Ae.dataTransfer.dropEffect=pe?"copy":"none")}function ke(Ae){ae(Ae)&&(f.current=Math.max(0,f.current-1),f.current===0&&P(!1))}function ye(Ae){ae(Ae)&&(Ae.preventDefault(),f.current=0,P(!1),pe&&D.add(Array.from(Ae.dataTransfer.files)))}function He(Ae){Ae.target!==Ae.currentTarget||!ae(Ae)||(Ae.preventDefault(),Ae.dataTransfer.dropEffect="none")}function Be(Ae){ae(Ae)&&Ae.preventDefault()}function Ve(Ae){if(!pe)return;const Ke=Array.from(Ae.clipboardData.files),Me=Ae.target,je=Me instanceof HTMLTextAreaElement||Me instanceof HTMLInputElement,xe=Array.from(Ae.clipboardData.types).includes("text/plain");Bje({files:Ke.length,hasText:xe,intoTextField:je})&&(Ae.preventDefault(),D.add(Ke))}return s.jsx("div",{className:"modal-backdrop",...k,role:"presentation",onDragOver:He,onDrop:Be,"data-leaving":X||void 0,children:s.jsxs("div",{ref:b,className:"modal feedback-dialog",onClick:Ae=>Ae.stopPropagation(),onDragEnter:ue,onDragOver:Se,onDragLeave:ke,onDrop:ye,onPaste:Ve,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?sD():NSe(B.state)}),s.jsxs("div",{className:"fb-stage",children:[s.jsxs("form",{ref:c,className:"fb-form",onSubmit:ve,onKeyDown:Ae=>{ySe(Ae.nativeEvent)&&(Ae.preventDefault(),Ae.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:J.question}),s.jsx("textarea",{ref:i,id:"fb-body",className:"ap-manage-input fb-message",value:T,maxLength:SW,rows:5,placeholder:J.placeholder,onChange:Ae=>A(Ae.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(eTe,{images:D,addRef:r}),ee&&s.jsx("p",{id:"fb-images-lost",className:"fb-hint",children:uTe(I)}),s.jsxs("div",{className:"fb-tools",children:[s.jsx(Qje,{images:D,buttonRef:r}),s.jsx(bje,{open:F,onToggle:()=>U(Ae=>!Ae)})]}),s.jsx(vje,{open:F,contact:q,onContact:_})]}),s.jsx("p",{className:"fb-facts",children:$?Rj(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:Ae=>{Ae.repeat&&Ae.preventDefault()},onClick:Q.press,title:Q.armed?sD():gTe(),children:Q.armed?pTe():hTe()}),s.jsxs("span",{className:"fb-shortcut","aria-hidden":"true",children:[s.jsx("kbd",{"data-symbol":CSe(le)||void 0,children:le}),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:jW()})]})]}),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(YW,{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 BS=[{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:[]}]}],xTe=/ ?\([A-Z?]\)/g;function QW(e,t=()=>!0){const n=a=>a.integration===void 0||t(a.integration);return e&&BS.every(a=>a.rows.every(n))?BS:BS.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(xTe,"")})})).filter(a=>a.rows.length>0)}function CTe(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 STe({onClose:e,onTour:t,onSettings:n}){const a=se(),i=Tt(e),o=At(e),r=Mo(Ao()),c=zn(),d=hh(),u=QW(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:CTe(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 NTe(e,t){return`${e}#${t}`}function jTe(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=NTe(r.key,r.since);if(a.has(c)||wpe(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 TTe(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 e5({rows:e,ours:t,dialogs:n}){return e===0?!1:t||n===0}function ATe(e,t=x){return t("accounts.reauth.title",{count:e})}function RTe(e,t=x){return t("accounts.reauth.lead",{count:e})}const ETe=(e=x)=>e("accounts.reauth.expired"),qTe=(e=x)=>e("accounts.reauth.singleNote"),_Te=(e=x)=>e("accounts.reauth.laterTip");function zTe(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 LTe({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=At(r),g=To(n,"accept"),f=To(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(Hr,{text:c("lan.ask.who",{when:fA(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(Hr,{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 PTe(e){const t=m.useRef(!1),n=OTe(e),a=e5({rows:n?1:0,ours:t.current,dialogs:Nn.dialogDepth()});return t.current=a,a?n:null}function OTe({lanPending:e,lanDeferred:t,lanBusy:n,answerLanPair:a,deferLanPair:i}){const{request:o,waiting:r}=zTe(e,t.current);return o?s.jsx(LTe,{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 MTe({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:vA(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:qTe(i)})]}):s.jsxs(s.Fragment,{children:[s.jsx("p",{id:"reauth-lead",className:"reauth-lead",children:RTe(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:ETe(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:_Te(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 ITe({rows:e,onSignIn:t,onLater:n}){const a=se(),i=m.useRef(null),o=Tt(n,{focusRef:i}),r=At(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:ATe(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(MTe,{rows:e,onSignIn:t,onLater:n,firstRef:i})]})})}function DTe({rows:e,signingIn:t,signIn:n,signedIn:a,refresh:i,closeSignIn:o,later:r,pairing:c=!1}){const d=m.useRef(!1),u=Nn.dialogDepth()+(c?1:0),h=t!=null||e5({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(ITe,{rows:e,onSignIn:n,onLater:r},e.length===1?"one":"many"):null}const FTe={"//":["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.82.2":"Arrow keys show the selected row on ccdeck tui's Network tab","3.82.1":"Clearer network shortcuts, accurate account capacity and Codex recovery fixes","3.82.0":"Steadier Codex switching, and uninstall cleans up Codex's terminal selection","3.81.4":"Codex account switching works with Windows sandbox logins","3.81.3":"More reliable Codex switching and quieter account rows","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.82.2":[{title:"⌨️ Arrow keys show where you are on ccdeck tui's Network tab",body:"In ccdeck tui, ↑ and ↓ on the Network tab now highlight the row you are on and scroll the list to it."}],"3.82.1":[{title:"Local network controls, easier to find",body:"Open this deck’s network settings or the network graph directly from the Local network row.",priority:"highlight"},{title:"More accurate account capacity",body:"Accounts at their weekly limit no longer inflate the average remaining five-hour capacity.",priority:"highlight",icon:"accounts"},{title:"Codex account recovery fixes",body:"Codex account control can recover after temporary startup timeouts and checks account changes again when reconnecting.",priority:"highlight",icon:"accounts"}],"3.82.0":[{title:"🔄 Codex switching recovers instead of staying stuck",body:"A failed reconnect or manual switch no longer leaves Codex account control disconnected, and turning Auto-switch off stops a switch it had already queued.",priority:"highlight",icon:"accounts",details:"On Windows, a Codex connection that never answers now fails after 30 seconds instead of waiting forever."},{title:"⏱️ Slow Codex logins get more time and a Retry button",body:"ccdeck now gives Codex more time to read a login during a switch, and if it still runs out, the panel says why and offers Retry selected account.",priority:"highlight",icon:"accounts"},{title:"🧹 Uninstall also removes Codex's terminal selection",body:"ccdeck --uninstall now takes the codex block that Enable terminal selection added out of your shell profiles, and names any file it could not clean.",priority:"highlight"},{title:"⌨️ A opens Codex accounts on a Codex-only deck",body:"With Codex alone, the Codex accounts door now shows its A key, and its name follows your interface language."},{title:"🔑 Jira token help names the permission for comments and statuses",body:"A scoped Jira Cloud token needs write:jira-work to add comments and change statuses, and the token help and Settings › Integrations now say so."},{title:"🌍 Codex messages read correctly in every language",body:"The message about a Codex login folder that is not private enough had lost its accented and non-Latin letters; it is whole again, and the new timeout message is translated."}],"3.81.4":[{title:"🔄 Switch Codex accounts without another sign-in",body:"On Windows, Switch can use your existing native Codex login while keeping its sandbox permissions unchanged.",priority:"highlight",icon:"accounts"},{title:"🔐 New Windows accounts are ready for switching",body:"Accounts added through + now get private folders from the start, and older native login files are recognized."},{title:"💬 Clearer account-switching errors",body:"If a login cannot be used safely, ccdeck explains the folder-permission problem and how to continue."}],"3.81.3":[{title:"🔄 More reliable Codex account switching",body:"ccdeck retries temporary connection failures before switching the open Codex app.",priority:"highlight",icon:"accounts"},{title:"✨ Quieter account switching",body:"Successful switches no longer leave an extra message under the account row."},{title:"⌨️ Arrow-key navigation in ccdeck tui",body:"The footer and help now show the left and right arrow keys for moving between tabs."}],"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.`}]},t0="agent-dag.releaseNotesSeen";function oD(e){return e.split(/[.\-+]/).map(t=>parseInt(t,10)).map(t=>Number.isNaN(t)?0:t)}function zo(e,t){const n=oD(e),a=oD(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 UTe(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 BTe(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(UTe).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)=>zo(a.version,n.version))}function HTe(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 WTe(e,t,n){const[a,...i]=e;if(!t)return{latest:ti(n)?e.find(c=>zo(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 rD=BTe(FTe);function t5(e,t,n){return e.filter(a=>zo(a.version,n)<=0&&(t===null||zo(a.version,t)>0))}function GTe(e,t){return e.filter(n=>zo(n.version,t)===0)}function $Te(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 VTe=new RegExp("^(?:\\p{Extended_Pictographic}|\\p{Emoji_Modifier}|\\p{Regional_Indicator}|[\\u200D\\uFE0F])+(?= \\S)","u");function n5(e){const t=VTe.exec(e);return t?{icon:t[0],rest:e.slice(t[0].length)}:{icon:null,rest:e}}function KTe(e){if(!e)return null;let t=null;try{t=e.getItem(t0)}catch{return null}return ti(t)?t:null}function JTe(e){if(!e)return!1;try{return e.getItem(t0),!0}catch{return!1}}function YTe(e,t){if(!e)return!1;try{return e.setItem(t0,t),!0}catch{return!1}}const a5="agent-dag.tourSeen";function ZTe(e){if(!e)return!1;try{return e.getItem(a5)==="1"}catch{return!1}}function XTe(e){if(!e)return!1;try{return e.setItem(a5,"1"),!0}catch{return!1}}function QTe({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 eAe({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=GTe(n,t);return r.length?{show:r,record:t,reason:"welcome"}:{show:[],record:t,reason:"first-run"}}const i=zo(e,t);if(i===0)return{show:[],record:null,reason:"seen"};if(i>0)return{show:[],record:null,reason:"ahead"};const o=t5(n,e,t);return o.length?{show:o,record:t,reason:"new-notes"}:{show:[],record:t,reason:"nothing-new"}}function tAe(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=tAe(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 Lo(e=typeof navigator>"u"?"":navigator.userAgent){return/\bccdeck-desktop\/\d/.test(e)}const nAe=()=>x("shell.update.checkWhy"),cD=()=>x("shell.update.checking"),aAe=()=>x("shell.update.npmUnreachable"),sAe=()=>x("shell.update.deckUnreachable"),iAe=()=>x("shell.update.checksOff"),oAe=()=>x("shell.update.pendingRetry");function rAe(e,t,n,a){const i=a?t.npx:n?dn(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}),vr=e=>ca(e,{tone:"note"});function lD(e,t){return xNe(t-e)}function cAe(e,t){const n=e.update;return(n==null?void 0:n.status)==="ready"?vr(x("shell.update.appReady",{version:n.version??""})):(n==null?void 0:n.status)==="checking"?vr(x("shell.update.appChecking")):(n==null?void 0:n.status)==="downloading"?vr(n.version?x("shell.update.appDownloadingVersion",{version:n.version}):x("shell.update.appDownloading")):(n==null?void 0:n.status)==="current"?vr(x("shell.update.appCurrent",{version:e.version??t})):(n==null?void 0:n.status)==="error"?vr(x("shell.update.appError")):vr(x("shell.update.appIdle"))}function lAe(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}):rAe(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 dAe(e){const t=e.version;if(e.unreachable)return ca(sAe(),{tone:"warn"});const n=t!=null&&t.checkFailedAt&&t.checkFailedAt>(t.checkedAt??0)?t.checkFailedAt:null;if(n)return ca(aAe(),{tone:"warn",age:e.answered?null:x("shell.update.lastTried",{ago:lD(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:oAe()}));const i=t!=null&&t.checkedAt?lD(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=zo(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 uAe(e,t){var i,o;const n=e.version;if((i=e.app)!=null&&i.inApp&&(n!=null&&n.checkDisabled)){const r=cAe(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(cD()):r}}if(n!=null&&n.checkDisabled)return{canCheck:!1,checking:!1,line:vr(iAe())};const a=(n==null?void 0:n.notice)??null;if((a==null?void 0:a.kind)==="upgrade")return{canCheck:!0,checking:e.checking,line:lAe(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(cD())}:{canCheck:!0,checking:!1,line:dAe(e)}}const s5=450;async function hAe(e,t=n=>new Promise(a=>setTimeout(a,n))){const[n]=await Promise.all([e(!0),t(s5)]);return n?"answered":"unreachable"}async function pAe(e=fetch){try{const[t]=await Promise.all([e("/api/desktop-update/check",{method:"POST",signal:AbortSignal.timeout(8e3)}),new Promise(n=>setTimeout(n,s5))]);return t.ok?"answered":"unreachable"}catch{return"unreachable"}}const gAe=()=>x("shell.notes.restartWhy");function mAe(e){var _,I,z;ja();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=uAe({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:Lo(),update:k.appUpdate,version:OW(),menu:IW()}},Aj);if(!w)return null;const j=Lo()&&((_=g.version)==null?void 0:_.checkDisabled),S=j?x("shell.update.checkWhyApp"):nAe(),T=async()=>{var U;if(!Xn(o.current||t)||j&&((U=k.appUpdate)==null?void 0:U.status)==="checking")return;o.current=!0,i(!0);const F=j?await pAe():await hAe(g.loadVersion);o.current=!1,i(!1),c(F==="unreachable"),u(!0)},A=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:T,act:A,checkWhy:S,needsAttention:q}}function fAe({update:e}){const t=ql("above","dialog"),n=m.useId();return ja(),s.jsxs("div",{className:"rn-status-row",children:[e?s.jsx(bAe,{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 bAe({line:e,onAct:t,bindHint:n,whyId:a,announce:i=!0}){const{action:o}=e,r=o&&s.jsx(vAe,{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 vAe({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 kAe({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 P,D;const f=se(),b=gAe(),k=Tt(i),y=m.useRef(null),N=At(i),w=m.useId(),[j,S]=m.useState(null),T=mAe(g),A=((P=T==null?void 0:T.state.line.action)==null?void 0:P.kind)==="install"||((D=T==null?void 0:T.state.line.action)==null?void 0:D.kind)==="npx",q=h&&!r&&!A,{latest:_,visiblePrevious:I,history:z}=WTe(e,t!==null,n),F=`${w}-history`,U=!!q||!!(T!=null&&T.state.canCheck)&&!r;m.useEffect(()=>{var $;!U&&j&&(S(null),document.activeElement===document.body&&(($=y.current)==null||$.focus()))},[U,j]);const O=ti(n)?`v${n}`:$Te(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")}),O&&s.jsx("span",{className:"modal-tool-id",children:O})]}),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}):T==null?void 0:T.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:[(T==null?void 0:T.needsAttention)&&s.jsx(fAe,{update:T}),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(HS,{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(HS,{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(HS,{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(Gr,{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:[T&&s.jsxs("p",{className:"rn-menu-status",id:`${w}-check-status`,children:[T.state.line.said,T.state.line.age&&s.jsx("span",{children:T.state.line.age})]}),(T==null?void 0:T.state.canCheck)&&s.jsxs("button",{type:"button",className:"ap-menu-item rn-act",role:"menuitem",title:T.checkWhy,"aria-describedby":`${w}-check-status`,"aria-busy":T.state.checking||void 0,onClick:()=>void T.check(),children:[s.jsx(loe,{}),f("shell.notes.check")]}),(T==null?void 0:T.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(doe,{}),f("shell.notes.restart")]}),s.jsx("span",{hidden:!0,id:`${w}-restart-why`,children:b})]})]})})}function HS({entry:e,showVersion:t}){const n=se(),{highlights:a,visible:i,more:o}=HTe(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(WS,{note:d,highlight:!0},`h${u}`)),i.map((d,u)=>s.jsx(WS,{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(WS,{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:[n5(d.title).rest.trimStart(),": "]}),fu(mu(d.details))]},u))]})]})]})]})}const wAe={plans:gB,accounts:mB,skills:fB};function WS({note:e,highlight:t}){const n=se(),{icon:a,rest:i}=n5(e.title),o=!a&&e.icon?dn(wAe,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 yAe({state:e,sessionId:t,onClose:n}){const a=se(),i=m.useMemo(()=>xAe(e,t),[e,e.revision,t]),o=m.useRef(null),r=Tt(n,{focusRef:o}),c=At(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:Cle()}),s.jsx("div",{className:"ss-cost",children:St(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":Om(d),title:d,children:No(d)},d))})]}),s.jsx("div",{className:"ss-hero-right",children:i.cost.total>0&&s.jsxs(s.Fragment,{children:[s.jsx(eA,{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:St(i.cost.input)})]}),s.jsxs("span",{className:"ssl ssl-out",children:[a("insights.cost.output")," ",s.jsx("b",{children:St(i.cost.output)})]}),s.jsxs("span",{className:"ssl ssl-cr",children:[a("insights.summary.cacheR")," ",s.jsx("b",{children:St(i.cost.cacheRead)})]}),s.jsxs("span",{className:"ssl ssl-cw",children:[a("insights.summary.cacheW")," ",s.jsx("b",{children:St(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(Pe())}),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 xAe(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 T=pa(S);i.input+=T.input,i.output+=T.output,i.cacheRead+=T.cacheRead,i.cacheWrite+=T.cacheWrite,i.total+=T.total;for(const q of Z2(S))o.add(q);S.model&&o.add(S.model),S.kind==="subagent"&&g++;const A=N2(S.prompts);d+=A.length,!f&&A.length>0&&(f=A[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,T)=>T[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 Vt({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 xt({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 CAe(){const e=se(),t=ja();return s.jsx(Vt,{id:"settings-language-caption",title:e("settings.language.group"),children:s.jsx(xt,{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=>KX(n.target.value),children:Tl.map(n=>s.jsx("option",{value:n.code,lang:n.code,dir:n.dir,children:HX(n)},n.code))})})})}function i5(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||!Xn(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 dD({provider:e}){const t=e==="Codex"?"recoverCodexSessions":"recoverClaudeSessions",n=`${e.toLowerCase()}-session-recovery`,a=se(),i=i5(t,!0,a);return s.jsxs(Vt,{id:`${n}-title`,title:a("settings.recover.group",{provider:e}),children:[s.jsx(xt,{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(SAe,{t:a})]})}function SAe({t:e}){const t=i5("continueStopped",!1,e);return s.jsxs(s.Fragment,{children:[s.jsx(xt,{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 NAe(){const e=se(),t=fW();return s.jsx(Vt,{id:"settings-board-caption",title:e("settings.board.title"),children:s.jsx(xt,{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:hW.map(n=>s.jsx("option",{value:n,children:n===0?e("settings.board.never"):e("settings.board.minutes",{n})},n))})})})}const jAe="Codex accounts",TAe="Your Codex profiles and what each has left, and which one new sessions use.";function AAe({claudeHere:e,codexHere:t=!1,singleKeys:n,doors:a}){const i=se();return s.jsxs(Vt,{id:"settings-elsewhere-caption",title:i("lan.ew.group"),children:[(e||t)&&s.jsx(GS,{settingId:"accounts",name:e?i("lan.ew.accounts"):jAe,note:e?i("lan.ew.accountsNote"):TAe,onOpen:a.accounts,cap:n?{key:"A",title:i("lan.ew.pressA")}:null}),e&&s.jsx(GS,{settingId:"local-network",name:i("lan.ew.lan"),note:i("lan.ew.lanNote"),onOpen:a.localNetwork,cap:null}),s.jsx(GS,{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 GS({settingId:e,name:t,note:n,onOpen:a,cap:i,dialog:o=!1}){const r=se(),c=`settings-${e}`;return s.jsx(xt,{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 RAe(e){const t=e.binds.includes("?")?x("settings.keyboard.sheetName"):e.action;return t.charAt(0).toUpperCase()+t.slice(1)}function EAe(e,t){const n=t.trim().toLowerCase();return n?[e.action,e.cap,e.macCap??""].some(a=>a.toLowerCase().includes(n)):!0}function qAe({singleKeys:e,onToggleSingleKeys:t}){const n=se(),a=Mo(Ao()),[i,o]=m.useState(""),r=m.useId(),c=hh(),d=QW(e,u=>Ai(c,u)).map(u=>({...u,rows:u.rows.filter(h=>EAe(h,i))})).filter(u=>u.rows.length>0);return s.jsxs(s.Fragment,{children:[s.jsx(Vt,{children:s.jsx(xt,{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=>{Um(u.key)&&i&&(u.stopPropagation(),o(""))}})]}),d.map(u=>{const h=`settings-keys-${u.id}`;return s.jsx(Vt,{id:h,title:u.title,className:"settings-keys",children:u.rows.map(g=>s.jsx(xt,{as:"div",name:RAe(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 _Ae({notifyOn:e,onToggleNotify:t,notifyVetoed:n,notifyPermission:a,onAskNotify:i,accountNotify:o,onToggleAccountNotify:r}){const c=se(),d=lre(a,c),u=Lo(),h=e&&!n&&!u,g=m.useRef(null),f=Vs(!d.ask,g);return s.jsxs(s.Fragment,{children:[s.jsxs(Vt,{id:"sm-closed-caption",title:c("settings.notify.closedGroup"),children:[s.jsx(xt,{settingId:"notify-closed",name:c("settings.notify.closedName"),nameId:"sm-notify-label",note:n?c("settings.notify.veto"):cre(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(xt,{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(Vt,{id:"sm-accounts-caption",title:c("settings.notify.accountsGroup"),note:c(n?"settings.notify.accountsVeto":"settings.notify.accountsNote"),children:LN.map(({kind:b,label:k,title:y})=>s.jsx(xt,{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 zAe=["audio/webm;codecs=opus","audio/ogg;codecs=opus","audio/mp4"];function LAe(e){return zAe.find(t=>e(t))}const PAe=4400;function OAe(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 MAe({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=LAe(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=OAe(k.mimeType),j=new File(y,w.name,{type:w.type});n(()=>a(j))},k.start(200),o(!0),c.current=setTimeout(u,PAe)}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 IAe({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 DAe({customAssets:e,onImportCustom:t,onCreateVoice:n,onRenameCustom:a,onPreviewCustom:i,onDeleteCustom:o}){const r=se(),[c,d]=m.useState(""),u=e.length,h=ON(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(Mi(z,r("settings.sounds.custom.saveFail")))}},T=(I,z)=>{const F=Date.now(),U=Ur({armedFor:b,target:I,armedAt:y.current,now:F,gapMs:Fr});if(U==="arm"){k(I),y.current=F;return}if(U==="ignore")return;k(null);const O=bre(e.map(L=>L.id),I);S(async()=>{var R;await o(I);const L=document.activeElement;L!==z&&!ea((L==null?void 0:L.tagName)??null)||(R=O?N.current.get(O):w.current)==null||R.focus()})},{recording:A,startRecording:q,stopRecording:_}=MAe({full:g,setCustomError:d,runCustom:S,onImportCustom:t});return s.jsxs(Vt,{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(xt,{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(xt,{as:"div",settingId:"custom-record",name:r("settings.sounds.custom.record"),note:r(A?"settings.sounds.custom.recording":"settings.sounds.custom.upTo5"),control:A?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(IAe,{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"?`${jT(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=>T(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 FAe({soundOn:e,onToggleSound:t}){const n=se(),a=m.useId(),i=zn(),o=m.useId();return s.jsx(Vt,{children:s.jsx(xt,{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 _j="custom:";function uD(e){return`${_j}${e}`}function UAe(e){return e.startsWith(_j)?e.slice(_j.length):null}function BAe({id:e,label:t,value:n,step:a=WT,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 hD={get done(){return x("settings.sounds.tone.done")},get"needs-input"(){return x("settings.sounds.tone.needsInput")}},HAe={get done(){return x("settings.sounds.tone.doneNote")},get"needs-input"(){return x("settings.sounds.tone.needsInputNote")}};function WAe({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(Vt,{id:`sm-name-${e}`,title:hD[e],note:HAe[e],settingId:`tone-${e}`,aside:s.jsxs("button",{type:"button",className:"btn sm-hear",onClick:()=>c(e),"aria-label":h("settings.sounds.hearAria",{tone:hD[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(BAe,{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?uD(b):t.figure,onChange:k=>{const y=k.target.value,N=UAe(y);N!==null?u(e,N):(d(e),r(e,y))},children:[HT[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:uD(k.id),children:k.name},k.id))})]})]})]})}function GAe({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 T;const N=se(),w=mre(d),j=((T=c.find(A=>A.id===w))==null?void 0:T.name)??N("settings.sounds.sharedName"),S=w?N("settings.sounds.sharedNote",{name:j}):"";return s.jsxs("div",{className:"sm-sounds",children:[s.jsx(FAe,{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(A=>s.jsx(WAe,{chime:A,tone:n[A],soundOn:e,customAssets:c,customSelections:d,onLevel:i,onFigure:o,onPreview:r,onBuiltInSelected:u,onCustomSelected:h},A))}),S&&s.jsx("p",{className:"sm-note","aria-hidden":!0,children:S}),s.jsx("p",{className:"vis-hidden",role:"status",children:S}),s.jsx(DAe,{customAssets:c,onImportCustom:g,onCreateVoice:f,onRenameCustom:b,onPreviewCustom:k,onDeleteCustom:y})]})}function $Ae({onOpen:e}){const t=se();return s.jsx(Vt,{children:s.jsx(xt,{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 VAe=6500,KAe=1e4;let Lr={reading:null,saving:null,error:"",undone:null};const Rg=new Set;let Hd=null,Wd=null,zi=null,$S=!1,Eg=0;const wr=e=>{Lr={...Lr,...e},Rg.forEach(t=>t(Lr))};function o5(e){const t=e;return!!t&&t.ok===!0&&Array.isArray(t.settings)&&typeof t.present=="object"}async function r5(e){const t=await fetch("/api/claude-settings",{signal:e}),n=await t.json();if(!t.ok||!o5(n))throw new Error;return n}async function zj(){if($S||Lr.saving)return;$S=!0;const e=Eg,t=new AbortController;zi=t;let n=!1;const a=setTimeout(()=>{n=!0,t.abort()},5e3);try{const i=await r5(t.signal);e===Eg&&!t.signal.aborted&&wr({reading:i,error:""})}catch{e===Eg&&(n||!t.signal.aborted)&&wr({error:x("settings.claude.readFail")})}finally{clearTimeout(a),$S=!1,zi===t&&(zi=null)}}function pD(e,t){var n;return(n=e==null?void 0:e.settings.find(a=>a.id===t))==null?void 0:n.value}async function gD(e,t){if(Lr.saving)return;Eg++,zi==null||zi.abort(),Wd&&(clearTimeout(Wd),Wd=null),wr({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||!o5(o))throw new vn(typeof(o==null?void 0:o.error)=="string"&&o.error?qg(o.error):x("settings.claude.saveFail"));wr({reading:o});const r=pD(o,e);Wd=setTimeout(()=>{Wd=null;const c=new AbortController,d=setTimeout(()=>c.abort(),5e3);r5(c.signal).then(u=>{wr({reading:u,undone:pD(u,e)===r?null:{id:e}})}).catch(()=>{}).finally(()=>clearTimeout(d))},VAe)}catch(i){wr({error:Mi(i,x("settings.claude.saveFail"))})}finally{clearTimeout(a),wr({saving:null})}}const JAe={"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=JAe[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]}):m3(e,t)}function YAe(){const[e,t]=m.useState(Lr);return m.useEffect(()=>(Rg.add(t),t(Lr),Hd||(zj(),Hd=setInterval(()=>void zj(),KAe)),()=>{Rg.delete(t),Rg.size||(Hd&&clearInterval(Hd),Hd=null,zi==null||zi.abort())}),[]),e}const VS=40,ZAe=(e,t)=>{const n=`settings.claudeTopic.${e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}`,a=t(n);return a===n?e:a},XAe={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 QAe(e,t=x){const n=e.scope==="Global config"?t("settings.claudeIndex.globalConfig"):e.scope==="Managed"?t("settings.claudeIndex.managedOnly"):null;return[e.topic?ZAe(e.topic,t):e.topic,t(XAe[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 c5=null;const t0e=()=>c5??(c5=Wr(()=>import("./claude-settings-index-1Qg1AUda.js"),[]).then(e=>e.default.keys));function n0e({present:e,noFile:t=!1}){const n=se(),a=ja(),[i,o]=m.useState(null),[r,c]=m.useState(""),d=m.useId();m.useEffect(()=>{let f=!0;return t0e().then(b=>{f&&o(b)},()=>{c5=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,VS),g=r.trim()!=="";return s.jsxs(Vt,{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=>{Um(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(xt,{as:"div",name:s.jsx("code",{className:"claude-key",children:f.key}),note:QAe(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:`${are}#${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>VS&&s.jsx("p",{className:"settings-foot",role:"status",children:n("settings.claudeIndex.more",{count:u.length-VS})}),!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 mD={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=mD[e.effect]?t(mD[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 fD="\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:Sq(b,o)})):e.options.map(b=>({...b,label:ire(e.id,b.value,b.label,o)})),g=t?t.custom?fD:t.value===null?"":String(t.value):"",f=e.kind==="days"&&t&&!t.custom&&!h.some(b=>b.value===g)?[...h,{value:g,label:Sq(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;gD(e.id,e.kind==="days"?Number(k):k===""?null:k)},children:[(t==null?void 0:t.custom)&&s.jsx("option",{value:fD,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&&gD(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:YAe()})}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(Vt,{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 zj(),children:t("settings.claude.retry")})})]})]}),d&&xB.map(u=>s.jsx(Vt,{id:`claude-group-${u.id}`,title:SB(u.id,u.title,t),children:CB.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(xt,{settingId:`claude-${h.id}`,name:NB(h,t),nameId:f,note:sre(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,T=window.setTimeout(()=>S.abort(),15e3);try{const A=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 A.json();if(!A.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(T),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(Vt,{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(xt,{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(xt,{as:"div",settingId:"tool-history-size",name:e("settings.tools.space"),note:e("settings.tools.since",{date:cce(t.startedAt)}),control:s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"settings-read",children:rce(t.bytes)}),s.jsx("button",{type:"button",className:"btn","aria-busy":o,onClick:()=>{b()},children:e("settings.tools.refresh")})]})}),s.jsx(xt,{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(xt,{as:"div",name:e("settings.tools.unsaved"),note:e("settings.tools.unsavedNote")})]}):s.jsx(xt,{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 Lj="agent-dag.integrations.active",n0=(e,t)=>`agent-dag.integrations.prefs.${e}:${t}`,d0e=32e3;function bD(e,t){const n=ht(n0(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=bD(e,t)[n];return a(i)?i:void 0},write(n,a){const i=bD(e,t);a===void 0?delete i[n]:i[n]=a;const o=JSON.stringify(i);o.length<=d0e&&pt(n0(e,t),o)}}}function u0e(e,t){Xa(n0(e,t))}function w1e(e){const t=ht(Lj);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(Lj),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(Lj,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(Pe(),{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",...n.getFullYear()!==new Date().getFullYear()?{year:"numeric"}:{}})}function Oj(e){const t=e.meta??{};return e.kind==="gitlab"?typeof t.serverVersion=="string"&&t.serverVersion?`GitLab ${t.serverVersion}`:null:e.kind!=="jira"?null:t.deploymentType==="Cloud"?"Jira Cloud":t.deploymentType?`Jira ${t.deploymentType==="DataCenter"?"Data Center":String(t.deploymentType)}${t.serverVersion?` ${t.serverVersion}`:""}`:null}function h0e({connection:e,provider:t,available:n,busy:a,armed:i,note:o,headingRef:r,onTest:c,onEdit:d,onDisconnect:u,onCancelDisconnect:h}){var A;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=Oj(e),j=Array.isArray((A=e.meta)==null?void 0:A.warnings)?e.meta.warnings.filter(q=>typeof q=="string"):[],S=a===`test:${e.id}`,T=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":T,"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(T?"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,T]=m.useState(null),A=m.useRef(null),[q,_]=m.useState(null),[I,z]=m.useState([]),[F,U]=m.useState(null),O=m.useRef(0),[L,R]=m.useState(null),P=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 Ne=oNe();Ne&&j({mode:"add",kind:Ne})},[]),m.useEffect(()=>{var ie,Ne;!L||!a||(Ne=(ie=Q.current.get(L))==null?void 0:ie.scrollIntoView)==null||Ne.call(ie,{block:"nearest"})},[L,a]),m.useEffect(()=>{if(!F)return;const ie=()=>{var We,Te;(We=document.activeElement)!=null&&We.hasAttribute("data-integration-cancel-disconnect")&&((Te=document.querySelector(".ig-manage-view [data-integration-disconnect]"))==null||Te.focus()),U(null)},Ne=()=>{document.hidden&&ie()},Fe=window.setTimeout(()=>{var We;(We=document.querySelector("[data-integration-disconnect-actions]"))!=null&&We.contains(document.activeElement)||ie()},4e3);return window.addEventListener("blur",ie),document.addEventListener("visibilitychange",Ne),()=>{window.clearTimeout(Fe),window.removeEventListener("blur",ie),document.removeEventListener("visibilitychange",Ne)}},[F]);const J=(ie,Ne,Fe,We)=>z(Te=>[...Te.filter(nt=>nt.id!==ie),{id:ie,tone:Ne,text:Fe,scope:We}]),K=ie=>z(Ne=>Ne.filter(Fe=>Fe.id!==ie)),ee=async(ie,Ne)=>{if(!A.current){A.current=ie,T(ie);try{await Ne()}finally{A.current=null,T(null)}}},te=ie=>(Ne,Fe)=>void ee("form",async()=>{_(null);try{const We=await tNe(ie,Ne,Fe||void 0);j(null),H(null),Z(!1),f(null),r(null),k(t("integrations.settings.added")),J(We.id,"ok",t("integrations.settings.savedTested",{name:We.account.name||We.account.login})),R(We.id),P.current=()=>{var nt;const Te=d.current.get(We.kind)??V.current.get(We.id);return(nt=Te==null?void 0:Te.scrollIntoView)==null||nt.call(Te,{block:"nearest"}),Te}}catch(We){_(We instanceof Za?We:new Za("upstream",t("integrations.settings.saveFailed")))}}),le=ie=>(Ne,Fe)=>void ee("form",async()=>{_(null);try{const{connection:We,validated:Te}=await nNe(ie.id,{name:Fe,input:Ne});j(null),H(null),Z(!1),P.current=()=>N.current??(g?y.current:V.current.get(We.id)),J(We.id,"ok",Te?t("integrations.settings.savedPassed",{name:We.account.name||We.account.login}):t("integrations.settings.saved"))}catch(We){_(We instanceof Za?We:new Za("upstream",t("integrations.settings.changeFailed")))}}),ge=ie=>void ee(`test:${ie.id}`,async()=>{U(null),K(ie.id);try{const Ne=await aNe(ie.id);J(ie.id,"ok",t("integrations.settings.testPassed",{name:Ne.account.name||Ne.account.login}))}catch(Ne){J(ie.id,"err",Mi(Ne,t("integrations.settings.testFailed")))}}),ve=(ie,Ne)=>{if(A.current)return;const Fe=Date.now(),We=Ur({armedFor:F,target:ie.id,armedAt:O.current,now:Fe,gapMs:Fr});if(We==="arm"){Ne.focus({preventScroll:!0}),U(ie.id),O.current=Fe;return}We!=="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===Ne||ea((nt==null?void 0:nt.tagName)??null))&&(P.current=()=>{var $e;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($e=fe==null?void 0:fe.scrollIntoView)==null||$e.call(fe,{block:"nearest"}),fe})}catch(Te){J(ie.id,"err",Mi(Te,t("integrations.settings.removeFailed")),"disconnect")}}))};m.useEffect(()=>{if(S!==null||W||!P.current)return;const ie=P.current();P.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),ue=["github","gitlab","jira"],Se=XA().filter(ie=>ae.has(ie.kind)||pe.some(Ne=>Ne.kind===ie.kind)).sort((ie,Ne)=>ue.indexOf(ie.kind)-ue.indexOf(Ne.kind)),ke=e0(n),ye=m.useCallback(()=>{j(null),f(null),r(null),Z(!1),H(null),_(null),U(null),P.current=()=>{const ie=$.current,Ne=ie==null?void 0:ie.closest(".settings-pane");return Ne&&(Ne.scrollTop=B.current),ie!=null&&ie.isConnected?ie:document.getElementById("settings-tab-integrations")}},[]),He=m.useCallback(()=>{if(!o){ye();return}f(null),j(null),Z(!1),H(null),_(null),U(null),P.current=()=>{var Fe;const ie=(Fe=u.current)!=null&&Fe.isConnected?u.current:c.current,Ne=ie==null?void 0:ie.closest(".settings-pane");return Ne&&(Ne.scrollTop=ie===c.current?0:h.current),ie}},[o,ye]),Be=m.useCallback(()=>{if(!g&&!o){ye();return}j(null),Z(!1),H(null),_(null),P.current=()=>N.current??(g?y.current:c.current)},[g,o,ye]),Ve=m.useCallback((ie,Ne=!1)=>{if(A.current)return;if(W&&Ne){H(null),requestAnimationFrame(()=>{var We;return(We=document.querySelector(".ig-config-view input:not([disabled])"))==null?void 0:We.focus()});return}const Fe=Ne?w?Be:g?He:ye:()=>{j(null),f(null),r(null),ie()};G?H(()=>Fe):(Z(!1),Fe())},[G,W,w,g,Be,He,ye]);m.useEffect(()=>(e==null||e(w||g||o?Ve:null),()=>e==null?void 0:e(null)),[w,g,o,Ve,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 Ae=(ie,Ne)=>{var We;if(A.current)return;P.current=null,H(null),k(""),U(null),g||o?N.current=Ne:(B.current=((We=Ne.closest(".settings-pane"))==null?void 0:We.scrollTop)??0,$.current=Ne,N.current=null),Z(!1),_(null),j(ie);const Fe=Ne.closest(".settings-pane");Fe&&(Fe.scrollTop=0)},Ke=(ie,Ne)=>{var We,Te;if(A.current)return;P.current=null,o?(u.current=Ne,h.current=((We=Ne.closest(".settings-pane"))==null?void 0:We.scrollTop)??0):(B.current=((Te=Ne.closest(".settings-pane"))==null?void 0:Te.scrollTop)??0,$.current=Ne),N.current=null,k(""),U(null),f(ie.id);const Fe=Ne.closest(".settings-pane");Fe&&(Fe.scrollTop=0)},Me=(ie,Ne)=>{var Te;const Fe=pe.filter(nt=>nt.kind===ie);if(Fe.length===1){Ke(Fe[0],Ne);return}if(A.current)return;P.current=null,B.current=((Te=Ne.closest(".settings-pane"))==null?void 0:Te.scrollTop)??0,$.current=Ne,u.current=null,h.current=0,k(""),U(null),r(ie);const We=Ne.closest(".settings-pane");We&&(We.scrollTop=0)},je=(ie,Ne=!1)=>{const Fe=au(ie.kind),We=!Ai(n,ie.kind),Te=Pj(ie),nt=ie.account.login||ie.account.name,fe=ie.kind==="jira"?Oj(ie):null;return s.jsx("div",{className:"ig-conn",ref:$e=>{$e?Q.current.set(ie.id,$e):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:Ne&&ie.name||gr(ie)}),s.jsx("span",{className:"ig-conn-line",children:[Ne&&ie.name!==gr(ie)?gr(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")}),We&&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:$e=>{$e?V.current.set(ie.id,$e):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||gr(ie)}),onClick:$e=>Ke(ie,$e.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(Ne=>Ne.kind===ie.kind)),Le=o?au(o):null,Ce=pe.filter(ie=>ie.kind===o),Ie=pe.find(ie=>ie.id===g),Re=(w==null?void 0:w.mode)==="edit"?pe.find(ie=>ie.id===w.id):void 0,Ue=(w==null?void 0:w.mode)==="add"?Se.find(ie=>ae.has(ie.kind)&&ie.kind===w.kind):Re&&Se.find(ie=>ae.has(ie.kind)&&ie.kind===Re.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:()=>Ve(Be,!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:(Le==null?void 0:Le.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:Ue?s.jsx(ASe,{def:Ue,existing:Re,busy:S==="form",error:q,onDirtyChange:Z,onSubmit:w.mode==="add"?te(w.kind):le(Re),onCancel:()=>Ve(Be,!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:Be,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:()=>Ve(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=>Ae({mode:"add",kind:o},ie.currentTarget),children:t("integrations.settings.addConn",{label:(Le==null?void 0:Le.label)??o})})]}),s.jsx("h2",{ref:c,tabIndex:-1,className:"ig-managed-title",children:t("integrations.settings.connsTitle",{label:(Le==null?void 0:Le.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=>je(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:()=>Ve(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"})}),o?t("integrations.settings.backToList",{label:(Le==null?void 0:Le.label)??o}):t("integrations.settings.all")]}),Ie&&Ai(n,Ie.kind)&&s.jsx("button",{type:"button",className:"btn","aria-disabled":S!==null||void 0,onClick:ie=>Ae({mode:"add",kind:Ie.kind},ie.currentTarget),children:t("integrations.settings.addConn",{label:((tt=au(Ie.kind))==null?void 0:tt.label)??Ie.kind})})]}),Ie?s.jsx(h0e,{connection:Ie,provider:au(Ie.kind),available:Ai(n,Ie.kind),busy:S,armed:F===g,note:I.find(ie=>ie.id===g),headingRef:y,onTest:()=>ge(Ie),onEdit:ie=>Ae({mode:"edit",id:Ie.id},ie),onDisconnect:ie=>ve(Ie,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 Uf(),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 Ne=pe.filter(fe=>fe.kind===ie.kind),Fe=Ne.length===1?Ne[0]:null,We=[...new Set(Ne.map(gr))],Te=Fe&&Pj(Fe),nt=(Fe==null?void 0:Fe.kind)==="jira"?Oj(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}),Ne.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:gr(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:Ne.length})}),s.jsxs("span",{className:"ig-conn-line",children:[We.slice(0,2).join(" · "),We.length>2?` · ${t("integrations.settings.moreInstances",{n:We.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${Ne.length?"":" primary"}`,"aria-disabled":S!==null||void 0,ref:fe=>{const $e=Ne.length?d.current:D.current;fe?$e.set(ie.kind,fe):$e.delete(ie.kind)},"aria-label":Ne.length?t("integrations.manageProvider",{label:ie.label}):t("integrations.form.connect",{provider:ie.label}),onClick:fe=>Ne.length?Me(ie.kind,fe.currentTarget):Ae({mode:"add",kind:ie.kind},fe.currentTarget),children:Ne.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(Vt,{id:"integrations-list-title",title:t("integrations.settings.connections"),aside:s.jsx("span",{className:"settings-caption-count",children:xe.length}),children:[xe.map(ie=>je(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(Vt,{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 vD(){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":_q.length,"--reading-selected":_q.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(vD,{})]},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":zq.length,"--reading-selected":zq.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(vD,{})]},o)})})]}),s.jsxs(Vt,{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:Et,cli:e.version,running:t}),i=s.jsx("code",{children:e.command});return e.auto==="pending"||e.auto==="running"?s.jsx(xt,{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"):Rj(n("shell.terminal.soon"),"cmd",i)})}):s.jsx(xt,{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")," "]}),Rj(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)&&zo(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:Et,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:Et,to:t.to,from:t.from})}:null}function T0e({version:e,notice:t,readyAppUpdate:n,updateRestarting:a,updateFailure:i,onUpdateRestart:o,doors:r,bundle:c="3.82.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(Vt,{id:"settings-about-caption",title:Et,children:[s.jsx(xt,{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(A0e,{offer:h,restarting:a,failure:i,onRestart:o,onUpdate:r.update}),s.jsx(xt,{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(xt,{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(xt,{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(Vt,{id:"settings-about-help-caption",title:d("settings.about.helpGroup"),children:[s.jsx(xt,{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(xt,{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 A0e({offer:e,restarting:t,failure:n,onRestart:a,onUpdate:i}){const o=se();if(e.kind==="notice")return s.jsx(xt,{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=DW(e.to,t),c=n&&n.version===e.to?FW(n.failure,n.version):"";return s.jsx(xt,{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=Lo()}){const i=se(),o=R0e(n,a);return s.jsx(Vt,{id:"settings-updates-caption",title:i("settings.updates.title"),children:o==="app"?s.jsx(xt,{as:"div",settingId:"auto-update",name:i("settings.updates.title"),note:i("settings.updates.appNote")}):s.jsx(xt,{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=wf(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(YU,{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(Vt,{id:"appearance-character-caption",title:i("settings.character.title"),list:!1,children:[s.jsx("div",{className:"settings-list",children:s.jsx(xt,{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 kD="settings-search-field",l5="settings-search-results",Mj=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=ece(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:kD,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:kD,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?l5:void 0,"aria-activedescendant":u?Mj(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 P0e({query:e,results:t,active:n,onOpen:a}){const i=se(),o=FB(t.length,e);return m.useEffect(()=>{var r,c;(c=(r=document.getElementById(Mj(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:l5,role:"listbox","aria-label":i("settings.search.results"),children:t.map((r,c)=>s.jsxs("button",{type:"button",role:"option",id:Mj(c),className:"settings-result",tabIndex:-1,"aria-selected":c===n,"aria-label":Yre(r),"data-highlighted":c===n,onMouseDown:d=>d.preventDefault(),onClick:()=>a(r),children:[s.jsx(af,{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:VT(r)})]})]},r.id))})})]})}function O0e({query:e,count:t}){return s.jsx("p",{className:"vis-hidden",role:"status",children:e.trim()?FB(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=>rU({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,$e;return($e=(fe=S.current)==null?void 0:fe.scrollIntoView)==null?void 0:$e.call(fe,{block:"nearest",inline:"nearest"})})):Te()}const j=()=>w(a,!0),S=m.useRef(null),T=Tt(j,{focusRef:S}),A=At(()=>w(a)),q=m.useRef([]),_=hh(),I=e0(_),z=Yoe(I,e,i.claude),F=Math.max(0,z.findIndex(Te=>Te.id===e)),U=_l("(max-width: 640px)"),[O,L]=m.useState(""),[R,P]=m.useState(0),D=m.useRef(null),$=m.useRef(null),B=O.trim()!=="",G=m.useMemo(()=>Qre(O,DB(i.claude,I,ph(_))),[O,i.claude,I,_,k]),Z=U0e($,!B,e),W=Te=>{L(Te),P(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),nf(Te)||Z(Te.id)})};m.useEffect(()=>{const Te=nt=>{var gt,mt;if(!nre(nt))return;const fe=T.current,$e=nt.target;!fe||!($e===document.body||$e===document.documentElement||$e&&fe.contains($e))||(nt.preventDefault(),(gt=D.current)==null||gt.focus(),(mt=D.current)==null||mt.select())};return window.addEventListener("keydown",Te),()=>window.removeEventListener("keydown",Te)},[T]),m.useEffect(()=>{var Te,nt,fe,$e;Zoe((Te=document.activeElement)==null?void 0:Te.id,e)&&((nt=S.current)==null||nt.focus()),($e=(fe=S.current)==null?void 0:fe.scrollIntoView)==null||$e.call(fe,{block:"nearest",inline:"nearest"})},[e]);const{theme:V,setTheme:Q,characterEnabled:J,setCharacterEnabled:K,character:ee,setCharacter:te}=u,le=zn(),ge=Te=>{const nt=wf(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:ue,previewTone:Se,changeTone:ke}=r,{customSelections:ye,customAssets:He,clearCustomOnly:Be,selectCustomTone:Ve,importNotificationAudio:Ae,createNotificationVoice:Ke,renameCustomAsset:Me,deleteCustomAsset:je,previewCustomAsset:xe}=c,{notifyPermission:Le,notifyOn:Ce,notifyVetoed:Ie,toggleNotify:Re,notifySupported:Ue,askForNotifications:tt,accountNotify:ie,toggleAccountNotify:Ne}=d,Fe=(()=>{switch(e){case"radar":return s.jsx($Ae,{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:le}),s.jsx(z0e,{characterEnabled:J,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(qAe,{singleKeys:le,onToggleSingleKeys:()=>Ene(!le)});case"notifications":return s.jsx(_Ae,{notifyOn:Ce,onToggleNotify:Re,notifyVetoed:Ie,notifyPermission:Ue?Le:"unsupported",onAskNotify:tt,accountNotify:ie,onToggleAccountNotify:Ne});case"sounds":return s.jsx(GAe,{soundOn:pe===!0,onToggleSound:ae,prefs:ue,claudeHere:i.claude,onLevel:(Te,nt)=>ke(Te,{level:nt}),onFigure:(Te,nt)=>ke(Te,{figure:nt}),onPreview:Te=>Se(Te),customAssets:He,customSelections:ye,onBuiltInSelected:Be,onCustomSelected:Ve,onImportCustom:Ae,onCreateVoice:Ke,onRenameCustom:Me,onPreviewCustom:xe,onDeleteCustom:je});case"integrations":return s.jsx(p0e,{onBeforeLeaveChange:N});case"data":return s.jsx(l0e,{});case"about":return s.jsx(T0e,{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(CAe,{}),s.jsx(NAe,{}),s.jsx(dD,{provider:"Codex"}),i.claude&&s.jsx(dD,{provider:"Claude"}),s.jsx(q0e,{autoRestart:f.autoRestart,onToggleAutoRestart:f.toggleAutoRestart,version:h.version}),s.jsx(AAe,{claudeHere:i.claude,codexHere:i.codex,singleKeys:le,doors:b})]})}})(),We=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",...A,role:"presentation",children:s.jsxs("div",{ref:T,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:O,onQuery:W,results:G,active:R,onActive:P,onOpen:X}),s.jsx(O0e,{query:O,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(af,{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`)})]}),We]}),Fe]},e),B&&s.jsx(P0e,{query:O,results:G,active:R,onOpen:X})]})]})})}function H0e({tool:e,onClose:t}){const n=se(),a=Tt(t),i=At(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=iQ(e.name,c,d);return{input:g.input.map((f,b)=>s.jsx(wD,{block:f},b)),response:g.response.map((f,b)=>s.jsx(wD,{block:f},b)),copyInput:l1(e.name,"input",c),copyResponse:l1(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:iU(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(yD,{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(yD,{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 wD({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(()=>XX(e),[e]),{shown:i}=_2(a,t),o=QX(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.`}]},t0="agent-dag.releaseNotesSeen";function oD(e){return e.split(/[.\-+]/).map(t=>parseInt(t,10)).map(t=>Number.isNaN(t)?0:t)}function zo(e,t){const n=oD(e),a=oD(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 UTe(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 BTe(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(UTe).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)=>zo(a.version,n.version))}function HTe(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 WTe(e,t,n){const[a,...i]=e;if(!t)return{latest:ti(n)?e.find(c=>zo(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 rD=BTe(FTe);function t5(e,t,n){return e.filter(a=>zo(a.version,n)<=0&&(t===null||zo(a.version,t)>0))}function GTe(e,t){return e.filter(n=>zo(n.version,t)===0)}function $Te(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 VTe=new RegExp("^(?:\\p{Extended_Pictographic}|\\p{Emoji_Modifier}|\\p{Regional_Indicator}|[\\u200D\\uFE0F])+(?= \\S)","u");function n5(e){const t=VTe.exec(e);return t?{icon:t[0],rest:e.slice(t[0].length)}:{icon:null,rest:e}}function KTe(e){if(!e)return null;let t=null;try{t=e.getItem(t0)}catch{return null}return ti(t)?t:null}function JTe(e){if(!e)return!1;try{return e.getItem(t0),!0}catch{return!1}}function YTe(e,t){if(!e)return!1;try{return e.setItem(t0,t),!0}catch{return!1}}const a5="agent-dag.tourSeen";function ZTe(e){if(!e)return!1;try{return e.getItem(a5)==="1"}catch{return!1}}function XTe(e){if(!e)return!1;try{return e.setItem(a5,"1"),!0}catch{return!1}}function QTe({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 eAe({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=GTe(n,t);return r.length?{show:r,record:t,reason:"welcome"}:{show:[],record:t,reason:"first-run"}}const i=zo(e,t);if(i===0)return{show:[],record:null,reason:"seen"};if(i>0)return{show:[],record:null,reason:"ahead"};const o=t5(n,e,t);return o.length?{show:o,record:t,reason:"new-notes"}:{show:[],record:t,reason:"nothing-new"}}function tAe(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=tAe(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 Lo(e=typeof navigator>"u"?"":navigator.userAgent){return/\bccdeck-desktop\/\d/.test(e)}const nAe=()=>x("shell.update.checkWhy"),cD=()=>x("shell.update.checking"),aAe=()=>x("shell.update.npmUnreachable"),sAe=()=>x("shell.update.deckUnreachable"),iAe=()=>x("shell.update.checksOff"),oAe=()=>x("shell.update.pendingRetry");function rAe(e,t,n,a){const i=a?t.npx:n?dn(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}),vr=e=>ca(e,{tone:"note"});function lD(e,t){return xNe(t-e)}function cAe(e,t){const n=e.update;return(n==null?void 0:n.status)==="ready"?vr(x("shell.update.appReady",{version:n.version??""})):(n==null?void 0:n.status)==="checking"?vr(x("shell.update.appChecking")):(n==null?void 0:n.status)==="downloading"?vr(n.version?x("shell.update.appDownloadingVersion",{version:n.version}):x("shell.update.appDownloading")):(n==null?void 0:n.status)==="current"?vr(x("shell.update.appCurrent",{version:e.version??t})):(n==null?void 0:n.status)==="error"?vr(x("shell.update.appError")):vr(x("shell.update.appIdle"))}function lAe(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}):rAe(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 dAe(e){const t=e.version;if(e.unreachable)return ca(sAe(),{tone:"warn"});const n=t!=null&&t.checkFailedAt&&t.checkFailedAt>(t.checkedAt??0)?t.checkFailedAt:null;if(n)return ca(aAe(),{tone:"warn",age:e.answered?null:x("shell.update.lastTried",{ago:lD(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:oAe()}));const i=t!=null&&t.checkedAt?lD(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=zo(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 uAe(e,t){var i,o;const n=e.version;if((i=e.app)!=null&&i.inApp&&(n!=null&&n.checkDisabled)){const r=cAe(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(cD()):r}}if(n!=null&&n.checkDisabled)return{canCheck:!1,checking:!1,line:vr(iAe())};const a=(n==null?void 0:n.notice)??null;if((a==null?void 0:a.kind)==="upgrade")return{canCheck:!0,checking:e.checking,line:lAe(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(cD())}:{canCheck:!0,checking:!1,line:dAe(e)}}const s5=450;async function hAe(e,t=n=>new Promise(a=>setTimeout(a,n))){const[n]=await Promise.all([e(!0),t(s5)]);return n?"answered":"unreachable"}async function pAe(e=fetch){try{const[t]=await Promise.all([e("/api/desktop-update/check",{method:"POST",signal:AbortSignal.timeout(8e3)}),new Promise(n=>setTimeout(n,s5))]);return t.ok?"answered":"unreachable"}catch{return"unreachable"}}const gAe=()=>x("shell.notes.restartWhy");function mAe(e){var _,I,z;ja();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=uAe({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:Lo(),update:k.appUpdate,version:OW(),menu:IW()}},Aj);if(!w)return null;const j=Lo()&&((_=g.version)==null?void 0:_.checkDisabled),S=j?x("shell.update.checkWhyApp"):nAe(),T=async()=>{var U;if(!Xn(o.current||t)||j&&((U=k.appUpdate)==null?void 0:U.status)==="checking")return;o.current=!0,i(!0);const F=j?await pAe():await hAe(g.loadVersion);o.current=!1,i(!1),c(F==="unreachable"),u(!0)},A=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:T,act:A,checkWhy:S,needsAttention:q}}function fAe({update:e}){const t=ql("above","dialog"),n=m.useId();return ja(),s.jsxs("div",{className:"rn-status-row",children:[e?s.jsx(bAe,{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 bAe({line:e,onAct:t,bindHint:n,whyId:a,announce:i=!0}){const{action:o}=e,r=o&&s.jsx(vAe,{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 vAe({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 kAe({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 P,D;const f=se(),b=gAe(),k=Tt(i),y=m.useRef(null),N=At(i),w=m.useId(),[j,S]=m.useState(null),T=mAe(g),A=((P=T==null?void 0:T.state.line.action)==null?void 0:P.kind)==="install"||((D=T==null?void 0:T.state.line.action)==null?void 0:D.kind)==="npx",q=h&&!r&&!A,{latest:_,visiblePrevious:I,history:z}=WTe(e,t!==null,n),F=`${w}-history`,U=!!q||!!(T!=null&&T.state.canCheck)&&!r;m.useEffect(()=>{var $;!U&&j&&(S(null),document.activeElement===document.body&&(($=y.current)==null||$.focus()))},[U,j]);const O=ti(n)?`v${n}`:$Te(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")}),O&&s.jsx("span",{className:"modal-tool-id",children:O})]}),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}):T==null?void 0:T.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:[(T==null?void 0:T.needsAttention)&&s.jsx(fAe,{update:T}),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(HS,{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(HS,{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(HS,{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(Gr,{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:[T&&s.jsxs("p",{className:"rn-menu-status",id:`${w}-check-status`,children:[T.state.line.said,T.state.line.age&&s.jsx("span",{children:T.state.line.age})]}),(T==null?void 0:T.state.canCheck)&&s.jsxs("button",{type:"button",className:"ap-menu-item rn-act",role:"menuitem",title:T.checkWhy,"aria-describedby":`${w}-check-status`,"aria-busy":T.state.checking||void 0,onClick:()=>void T.check(),children:[s.jsx(loe,{}),f("shell.notes.check")]}),(T==null?void 0:T.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(doe,{}),f("shell.notes.restart")]}),s.jsx("span",{hidden:!0,id:`${w}-restart-why`,children:b})]})]})})}function HS({entry:e,showVersion:t}){const n=se(),{highlights:a,visible:i,more:o}=HTe(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(WS,{note:d,highlight:!0},`h${u}`)),i.map((d,u)=>s.jsx(WS,{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(WS,{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:[n5(d.title).rest.trimStart(),": "]}),fu(mu(d.details))]},u))]})]})]})]})}const wAe={plans:gB,accounts:mB,skills:fB};function WS({note:e,highlight:t}){const n=se(),{icon:a,rest:i}=n5(e.title),o=!a&&e.icon?dn(wAe,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 yAe({state:e,sessionId:t,onClose:n}){const a=se(),i=m.useMemo(()=>xAe(e,t),[e,e.revision,t]),o=m.useRef(null),r=Tt(n,{focusRef:o}),c=At(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:Cle()}),s.jsx("div",{className:"ss-cost",children:St(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":Om(d),title:d,children:No(d)},d))})]}),s.jsx("div",{className:"ss-hero-right",children:i.cost.total>0&&s.jsxs(s.Fragment,{children:[s.jsx(eA,{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:St(i.cost.input)})]}),s.jsxs("span",{className:"ssl ssl-out",children:[a("insights.cost.output")," ",s.jsx("b",{children:St(i.cost.output)})]}),s.jsxs("span",{className:"ssl ssl-cr",children:[a("insights.summary.cacheR")," ",s.jsx("b",{children:St(i.cost.cacheRead)})]}),s.jsxs("span",{className:"ssl ssl-cw",children:[a("insights.summary.cacheW")," ",s.jsx("b",{children:St(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(Pe())}),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 xAe(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 T=pa(S);i.input+=T.input,i.output+=T.output,i.cacheRead+=T.cacheRead,i.cacheWrite+=T.cacheWrite,i.total+=T.total;for(const q of Z2(S))o.add(q);S.model&&o.add(S.model),S.kind==="subagent"&&g++;const A=N2(S.prompts);d+=A.length,!f&&A.length>0&&(f=A[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,T)=>T[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 Vt({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 xt({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 CAe(){const e=se(),t=ja();return s.jsx(Vt,{id:"settings-language-caption",title:e("settings.language.group"),children:s.jsx(xt,{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=>KX(n.target.value),children:Tl.map(n=>s.jsx("option",{value:n.code,lang:n.code,dir:n.dir,children:HX(n)},n.code))})})})}function i5(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||!Xn(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 dD({provider:e}){const t=e==="Codex"?"recoverCodexSessions":"recoverClaudeSessions",n=`${e.toLowerCase()}-session-recovery`,a=se(),i=i5(t,!0,a);return s.jsxs(Vt,{id:`${n}-title`,title:a("settings.recover.group",{provider:e}),children:[s.jsx(xt,{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(SAe,{t:a})]})}function SAe({t:e}){const t=i5("continueStopped",!1,e);return s.jsxs(s.Fragment,{children:[s.jsx(xt,{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 NAe(){const e=se(),t=fW();return s.jsx(Vt,{id:"settings-board-caption",title:e("settings.board.title"),children:s.jsx(xt,{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:hW.map(n=>s.jsx("option",{value:n,children:n===0?e("settings.board.never"):e("settings.board.minutes",{n})},n))})})})}const jAe="Codex accounts",TAe="Your Codex profiles and what each has left, and which one new sessions use.";function AAe({claudeHere:e,codexHere:t=!1,singleKeys:n,doors:a}){const i=se();return s.jsxs(Vt,{id:"settings-elsewhere-caption",title:i("lan.ew.group"),children:[(e||t)&&s.jsx(GS,{settingId:"accounts",name:e?i("lan.ew.accounts"):jAe,note:e?i("lan.ew.accountsNote"):TAe,onOpen:a.accounts,cap:n?{key:"A",title:i("lan.ew.pressA")}:null}),e&&s.jsx(GS,{settingId:"local-network",name:i("lan.ew.lan"),note:i("lan.ew.lanNote"),onOpen:a.localNetwork,cap:null}),s.jsx(GS,{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 GS({settingId:e,name:t,note:n,onOpen:a,cap:i,dialog:o=!1}){const r=se(),c=`settings-${e}`;return s.jsx(xt,{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 RAe(e){const t=e.binds.includes("?")?x("settings.keyboard.sheetName"):e.action;return t.charAt(0).toUpperCase()+t.slice(1)}function EAe(e,t){const n=t.trim().toLowerCase();return n?[e.action,e.cap,e.macCap??""].some(a=>a.toLowerCase().includes(n)):!0}function qAe({singleKeys:e,onToggleSingleKeys:t}){const n=se(),a=Mo(Ao()),[i,o]=m.useState(""),r=m.useId(),c=hh(),d=QW(e,u=>Ai(c,u)).map(u=>({...u,rows:u.rows.filter(h=>EAe(h,i))})).filter(u=>u.rows.length>0);return s.jsxs(s.Fragment,{children:[s.jsx(Vt,{children:s.jsx(xt,{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=>{Um(u.key)&&i&&(u.stopPropagation(),o(""))}})]}),d.map(u=>{const h=`settings-keys-${u.id}`;return s.jsx(Vt,{id:h,title:u.title,className:"settings-keys",children:u.rows.map(g=>s.jsx(xt,{as:"div",name:RAe(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 _Ae({notifyOn:e,onToggleNotify:t,notifyVetoed:n,notifyPermission:a,onAskNotify:i,accountNotify:o,onToggleAccountNotify:r}){const c=se(),d=lre(a,c),u=Lo(),h=e&&!n&&!u,g=m.useRef(null),f=Vs(!d.ask,g);return s.jsxs(s.Fragment,{children:[s.jsxs(Vt,{id:"sm-closed-caption",title:c("settings.notify.closedGroup"),children:[s.jsx(xt,{settingId:"notify-closed",name:c("settings.notify.closedName"),nameId:"sm-notify-label",note:n?c("settings.notify.veto"):cre(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(xt,{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(Vt,{id:"sm-accounts-caption",title:c("settings.notify.accountsGroup"),note:c(n?"settings.notify.accountsVeto":"settings.notify.accountsNote"),children:LN.map(({kind:b,label:k,title:y})=>s.jsx(xt,{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 zAe=["audio/webm;codecs=opus","audio/ogg;codecs=opus","audio/mp4"];function LAe(e){return zAe.find(t=>e(t))}const PAe=4400;function OAe(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 MAe({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=LAe(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=OAe(k.mimeType),j=new File(y,w.name,{type:w.type});n(()=>a(j))},k.start(200),o(!0),c.current=setTimeout(u,PAe)}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 IAe({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 DAe({customAssets:e,onImportCustom:t,onCreateVoice:n,onRenameCustom:a,onPreviewCustom:i,onDeleteCustom:o}){const r=se(),[c,d]=m.useState(""),u=e.length,h=ON(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(Mi(z,r("settings.sounds.custom.saveFail")))}},T=(I,z)=>{const F=Date.now(),U=Ur({armedFor:b,target:I,armedAt:y.current,now:F,gapMs:Fr});if(U==="arm"){k(I),y.current=F;return}if(U==="ignore")return;k(null);const O=bre(e.map(L=>L.id),I);S(async()=>{var R;await o(I);const L=document.activeElement;L!==z&&!ea((L==null?void 0:L.tagName)??null)||(R=O?N.current.get(O):w.current)==null||R.focus()})},{recording:A,startRecording:q,stopRecording:_}=MAe({full:g,setCustomError:d,runCustom:S,onImportCustom:t});return s.jsxs(Vt,{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(xt,{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(xt,{as:"div",settingId:"custom-record",name:r("settings.sounds.custom.record"),note:r(A?"settings.sounds.custom.recording":"settings.sounds.custom.upTo5"),control:A?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(IAe,{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"?`${jT(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=>T(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 FAe({soundOn:e,onToggleSound:t}){const n=se(),a=m.useId(),i=zn(),o=m.useId();return s.jsx(Vt,{children:s.jsx(xt,{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 _j="custom:";function uD(e){return`${_j}${e}`}function UAe(e){return e.startsWith(_j)?e.slice(_j.length):null}function BAe({id:e,label:t,value:n,step:a=WT,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 hD={get done(){return x("settings.sounds.tone.done")},get"needs-input"(){return x("settings.sounds.tone.needsInput")}},HAe={get done(){return x("settings.sounds.tone.doneNote")},get"needs-input"(){return x("settings.sounds.tone.needsInputNote")}};function WAe({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(Vt,{id:`sm-name-${e}`,title:hD[e],note:HAe[e],settingId:`tone-${e}`,aside:s.jsxs("button",{type:"button",className:"btn sm-hear",onClick:()=>c(e),"aria-label":h("settings.sounds.hearAria",{tone:hD[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(BAe,{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?uD(b):t.figure,onChange:k=>{const y=k.target.value,N=UAe(y);N!==null?u(e,N):(d(e),r(e,y))},children:[HT[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:uD(k.id),children:k.name},k.id))})]})]})]})}function GAe({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 T;const N=se(),w=mre(d),j=((T=c.find(A=>A.id===w))==null?void 0:T.name)??N("settings.sounds.sharedName"),S=w?N("settings.sounds.sharedNote",{name:j}):"";return s.jsxs("div",{className:"sm-sounds",children:[s.jsx(FAe,{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(A=>s.jsx(WAe,{chime:A,tone:n[A],soundOn:e,customAssets:c,customSelections:d,onLevel:i,onFigure:o,onPreview:r,onBuiltInSelected:u,onCustomSelected:h},A))}),S&&s.jsx("p",{className:"sm-note","aria-hidden":!0,children:S}),s.jsx("p",{className:"vis-hidden",role:"status",children:S}),s.jsx(DAe,{customAssets:c,onImportCustom:g,onCreateVoice:f,onRenameCustom:b,onPreviewCustom:k,onDeleteCustom:y})]})}function $Ae({onOpen:e}){const t=se();return s.jsx(Vt,{children:s.jsx(xt,{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 VAe=6500,KAe=1e4;let Lr={reading:null,saving:null,error:"",undone:null};const Rg=new Set;let Hd=null,Wd=null,zi=null,$S=!1,Eg=0;const wr=e=>{Lr={...Lr,...e},Rg.forEach(t=>t(Lr))};function o5(e){const t=e;return!!t&&t.ok===!0&&Array.isArray(t.settings)&&typeof t.present=="object"}async function r5(e){const t=await fetch("/api/claude-settings",{signal:e}),n=await t.json();if(!t.ok||!o5(n))throw new Error;return n}async function zj(){if($S||Lr.saving)return;$S=!0;const e=Eg,t=new AbortController;zi=t;let n=!1;const a=setTimeout(()=>{n=!0,t.abort()},5e3);try{const i=await r5(t.signal);e===Eg&&!t.signal.aborted&&wr({reading:i,error:""})}catch{e===Eg&&(n||!t.signal.aborted)&&wr({error:x("settings.claude.readFail")})}finally{clearTimeout(a),$S=!1,zi===t&&(zi=null)}}function pD(e,t){var n;return(n=e==null?void 0:e.settings.find(a=>a.id===t))==null?void 0:n.value}async function gD(e,t){if(Lr.saving)return;Eg++,zi==null||zi.abort(),Wd&&(clearTimeout(Wd),Wd=null),wr({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||!o5(o))throw new vn(typeof(o==null?void 0:o.error)=="string"&&o.error?qg(o.error):x("settings.claude.saveFail"));wr({reading:o});const r=pD(o,e);Wd=setTimeout(()=>{Wd=null;const c=new AbortController,d=setTimeout(()=>c.abort(),5e3);r5(c.signal).then(u=>{wr({reading:u,undone:pD(u,e)===r?null:{id:e}})}).catch(()=>{}).finally(()=>clearTimeout(d))},VAe)}catch(i){wr({error:Mi(i,x("settings.claude.saveFail"))})}finally{clearTimeout(a),wr({saving:null})}}const JAe={"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=JAe[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]}):m3(e,t)}function YAe(){const[e,t]=m.useState(Lr);return m.useEffect(()=>(Rg.add(t),t(Lr),Hd||(zj(),Hd=setInterval(()=>void zj(),KAe)),()=>{Rg.delete(t),Rg.size||(Hd&&clearInterval(Hd),Hd=null,zi==null||zi.abort())}),[]),e}const VS=40,ZAe=(e,t)=>{const n=`settings.claudeTopic.${e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}`,a=t(n);return a===n?e:a},XAe={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 QAe(e,t=x){const n=e.scope==="Global config"?t("settings.claudeIndex.globalConfig"):e.scope==="Managed"?t("settings.claudeIndex.managedOnly"):null;return[e.topic?ZAe(e.topic,t):e.topic,t(XAe[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 c5=null;const t0e=()=>c5??(c5=Wr(()=>import("./claude-settings-index-1Qg1AUda.js"),[]).then(e=>e.default.keys));function n0e({present:e,noFile:t=!1}){const n=se(),a=ja(),[i,o]=m.useState(null),[r,c]=m.useState(""),d=m.useId();m.useEffect(()=>{let f=!0;return t0e().then(b=>{f&&o(b)},()=>{c5=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,VS),g=r.trim()!=="";return s.jsxs(Vt,{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=>{Um(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(xt,{as:"div",name:s.jsx("code",{className:"claude-key",children:f.key}),note:QAe(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:`${are}#${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>VS&&s.jsx("p",{className:"settings-foot",role:"status",children:n("settings.claudeIndex.more",{count:u.length-VS})}),!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 mD={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=mD[e.effect]?t(mD[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 fD="\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:Sq(b,o)})):e.options.map(b=>({...b,label:ire(e.id,b.value,b.label,o)})),g=t?t.custom?fD:t.value===null?"":String(t.value):"",f=e.kind==="days"&&t&&!t.custom&&!h.some(b=>b.value===g)?[...h,{value:g,label:Sq(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;gD(e.id,e.kind==="days"?Number(k):k===""?null:k)},children:[(t==null?void 0:t.custom)&&s.jsx("option",{value:fD,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&&gD(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:YAe()})}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(Vt,{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 zj(),children:t("settings.claude.retry")})})]})]}),d&&xB.map(u=>s.jsx(Vt,{id:`claude-group-${u.id}`,title:SB(u.id,u.title,t),children:CB.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(xt,{settingId:`claude-${h.id}`,name:NB(h,t),nameId:f,note:sre(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,T=window.setTimeout(()=>S.abort(),15e3);try{const A=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 A.json();if(!A.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(T),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(Vt,{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(xt,{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(xt,{as:"div",settingId:"tool-history-size",name:e("settings.tools.space"),note:e("settings.tools.since",{date:cce(t.startedAt)}),control:s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"settings-read",children:rce(t.bytes)}),s.jsx("button",{type:"button",className:"btn","aria-busy":o,onClick:()=>{b()},children:e("settings.tools.refresh")})]})}),s.jsx(xt,{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(xt,{as:"div",name:e("settings.tools.unsaved"),note:e("settings.tools.unsavedNote")})]}):s.jsx(xt,{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 Lj="agent-dag.integrations.active",n0=(e,t)=>`agent-dag.integrations.prefs.${e}:${t}`,d0e=32e3;function bD(e,t){const n=ht(n0(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=bD(e,t)[n];return a(i)?i:void 0},write(n,a){const i=bD(e,t);a===void 0?delete i[n]:i[n]=a;const o=JSON.stringify(i);o.length<=d0e&&pt(n0(e,t),o)}}}function u0e(e,t){Xa(n0(e,t))}function w1e(e){const t=ht(Lj);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(Lj),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(Lj,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(Pe(),{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",...n.getFullYear()!==new Date().getFullYear()?{year:"numeric"}:{}})}function Oj(e){const t=e.meta??{};return e.kind==="gitlab"?typeof t.serverVersion=="string"&&t.serverVersion?`GitLab ${t.serverVersion}`:null:e.kind!=="jira"?null:t.deploymentType==="Cloud"?"Jira Cloud":t.deploymentType?`Jira ${t.deploymentType==="DataCenter"?"Data Center":String(t.deploymentType)}${t.serverVersion?` ${t.serverVersion}`:""}`:null}function h0e({connection:e,provider:t,available:n,busy:a,armed:i,note:o,headingRef:r,onTest:c,onEdit:d,onDisconnect:u,onCancelDisconnect:h}){var A;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=Oj(e),j=Array.isArray((A=e.meta)==null?void 0:A.warnings)?e.meta.warnings.filter(q=>typeof q=="string"):[],S=a===`test:${e.id}`,T=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":T,"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(T?"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,T]=m.useState(null),A=m.useRef(null),[q,_]=m.useState(null),[I,z]=m.useState([]),[F,U]=m.useState(null),O=m.useRef(0),[L,R]=m.useState(null),P=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 Ne=oNe();Ne&&j({mode:"add",kind:Ne})},[]),m.useEffect(()=>{var ie,Ne;!L||!a||(Ne=(ie=Q.current.get(L))==null?void 0:ie.scrollIntoView)==null||Ne.call(ie,{block:"nearest"})},[L,a]),m.useEffect(()=>{if(!F)return;const ie=()=>{var We,Te;(We=document.activeElement)!=null&&We.hasAttribute("data-integration-cancel-disconnect")&&((Te=document.querySelector(".ig-manage-view [data-integration-disconnect]"))==null||Te.focus()),U(null)},Ne=()=>{document.hidden&&ie()},Fe=window.setTimeout(()=>{var We;(We=document.querySelector("[data-integration-disconnect-actions]"))!=null&&We.contains(document.activeElement)||ie()},4e3);return window.addEventListener("blur",ie),document.addEventListener("visibilitychange",Ne),()=>{window.clearTimeout(Fe),window.removeEventListener("blur",ie),document.removeEventListener("visibilitychange",Ne)}},[F]);const J=(ie,Ne,Fe,We)=>z(Te=>[...Te.filter(nt=>nt.id!==ie),{id:ie,tone:Ne,text:Fe,scope:We}]),K=ie=>z(Ne=>Ne.filter(Fe=>Fe.id!==ie)),ee=async(ie,Ne)=>{if(!A.current){A.current=ie,T(ie);try{await Ne()}finally{A.current=null,T(null)}}},te=ie=>(Ne,Fe)=>void ee("form",async()=>{_(null);try{const We=await tNe(ie,Ne,Fe||void 0);j(null),H(null),Z(!1),f(null),r(null),k(t("integrations.settings.added")),J(We.id,"ok",t("integrations.settings.savedTested",{name:We.account.name||We.account.login})),R(We.id),P.current=()=>{var nt;const Te=d.current.get(We.kind)??V.current.get(We.id);return(nt=Te==null?void 0:Te.scrollIntoView)==null||nt.call(Te,{block:"nearest"}),Te}}catch(We){_(We instanceof Za?We:new Za("upstream",t("integrations.settings.saveFailed")))}}),le=ie=>(Ne,Fe)=>void ee("form",async()=>{_(null);try{const{connection:We,validated:Te}=await nNe(ie.id,{name:Fe,input:Ne});j(null),H(null),Z(!1),P.current=()=>N.current??(g?y.current:V.current.get(We.id)),J(We.id,"ok",Te?t("integrations.settings.savedPassed",{name:We.account.name||We.account.login}):t("integrations.settings.saved"))}catch(We){_(We instanceof Za?We:new Za("upstream",t("integrations.settings.changeFailed")))}}),ge=ie=>void ee(`test:${ie.id}`,async()=>{U(null),K(ie.id);try{const Ne=await aNe(ie.id);J(ie.id,"ok",t("integrations.settings.testPassed",{name:Ne.account.name||Ne.account.login}))}catch(Ne){J(ie.id,"err",Mi(Ne,t("integrations.settings.testFailed")))}}),ve=(ie,Ne)=>{if(A.current)return;const Fe=Date.now(),We=Ur({armedFor:F,target:ie.id,armedAt:O.current,now:Fe,gapMs:Fr});if(We==="arm"){Ne.focus({preventScroll:!0}),U(ie.id),O.current=Fe;return}We!=="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===Ne||ea((nt==null?void 0:nt.tagName)??null))&&(P.current=()=>{var $e;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($e=fe==null?void 0:fe.scrollIntoView)==null||$e.call(fe,{block:"nearest"}),fe})}catch(Te){J(ie.id,"err",Mi(Te,t("integrations.settings.removeFailed")),"disconnect")}}))};m.useEffect(()=>{if(S!==null||W||!P.current)return;const ie=P.current();P.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),ue=["github","gitlab","jira"],Se=XA().filter(ie=>ae.has(ie.kind)||pe.some(Ne=>Ne.kind===ie.kind)).sort((ie,Ne)=>ue.indexOf(ie.kind)-ue.indexOf(Ne.kind)),ke=e0(n),ye=m.useCallback(()=>{j(null),f(null),r(null),Z(!1),H(null),_(null),U(null),P.current=()=>{const ie=$.current,Ne=ie==null?void 0:ie.closest(".settings-pane");return Ne&&(Ne.scrollTop=B.current),ie!=null&&ie.isConnected?ie:document.getElementById("settings-tab-integrations")}},[]),He=m.useCallback(()=>{if(!o){ye();return}f(null),j(null),Z(!1),H(null),_(null),U(null),P.current=()=>{var Fe;const ie=(Fe=u.current)!=null&&Fe.isConnected?u.current:c.current,Ne=ie==null?void 0:ie.closest(".settings-pane");return Ne&&(Ne.scrollTop=ie===c.current?0:h.current),ie}},[o,ye]),Be=m.useCallback(()=>{if(!g&&!o){ye();return}j(null),Z(!1),H(null),_(null),P.current=()=>N.current??(g?y.current:c.current)},[g,o,ye]),Ve=m.useCallback((ie,Ne=!1)=>{if(A.current)return;if(W&&Ne){H(null),requestAnimationFrame(()=>{var We;return(We=document.querySelector(".ig-config-view input:not([disabled])"))==null?void 0:We.focus()});return}const Fe=Ne?w?Be:g?He:ye:()=>{j(null),f(null),r(null),ie()};G?H(()=>Fe):(Z(!1),Fe())},[G,W,w,g,Be,He,ye]);m.useEffect(()=>(e==null||e(w||g||o?Ve:null),()=>e==null?void 0:e(null)),[w,g,o,Ve,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 Ae=(ie,Ne)=>{var We;if(A.current)return;P.current=null,H(null),k(""),U(null),g||o?N.current=Ne:(B.current=((We=Ne.closest(".settings-pane"))==null?void 0:We.scrollTop)??0,$.current=Ne,N.current=null),Z(!1),_(null),j(ie);const Fe=Ne.closest(".settings-pane");Fe&&(Fe.scrollTop=0)},Ke=(ie,Ne)=>{var We,Te;if(A.current)return;P.current=null,o?(u.current=Ne,h.current=((We=Ne.closest(".settings-pane"))==null?void 0:We.scrollTop)??0):(B.current=((Te=Ne.closest(".settings-pane"))==null?void 0:Te.scrollTop)??0,$.current=Ne),N.current=null,k(""),U(null),f(ie.id);const Fe=Ne.closest(".settings-pane");Fe&&(Fe.scrollTop=0)},Me=(ie,Ne)=>{var Te;const Fe=pe.filter(nt=>nt.kind===ie);if(Fe.length===1){Ke(Fe[0],Ne);return}if(A.current)return;P.current=null,B.current=((Te=Ne.closest(".settings-pane"))==null?void 0:Te.scrollTop)??0,$.current=Ne,u.current=null,h.current=0,k(""),U(null),r(ie);const We=Ne.closest(".settings-pane");We&&(We.scrollTop=0)},je=(ie,Ne=!1)=>{const Fe=au(ie.kind),We=!Ai(n,ie.kind),Te=Pj(ie),nt=ie.account.login||ie.account.name,fe=ie.kind==="jira"?Oj(ie):null;return s.jsx("div",{className:"ig-conn",ref:$e=>{$e?Q.current.set(ie.id,$e):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:Ne&&ie.name||gr(ie)}),s.jsx("span",{className:"ig-conn-line",children:[Ne&&ie.name!==gr(ie)?gr(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")}),We&&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:$e=>{$e?V.current.set(ie.id,$e):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||gr(ie)}),onClick:$e=>Ke(ie,$e.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(Ne=>Ne.kind===ie.kind)),Le=o?au(o):null,Ce=pe.filter(ie=>ie.kind===o),Ie=pe.find(ie=>ie.id===g),Re=(w==null?void 0:w.mode)==="edit"?pe.find(ie=>ie.id===w.id):void 0,Ue=(w==null?void 0:w.mode)==="add"?Se.find(ie=>ae.has(ie.kind)&&ie.kind===w.kind):Re&&Se.find(ie=>ae.has(ie.kind)&&ie.kind===Re.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:()=>Ve(Be,!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:(Le==null?void 0:Le.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:Ue?s.jsx(ASe,{def:Ue,existing:Re,busy:S==="form",error:q,onDirtyChange:Z,onSubmit:w.mode==="add"?te(w.kind):le(Re),onCancel:()=>Ve(Be,!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:Be,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:()=>Ve(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=>Ae({mode:"add",kind:o},ie.currentTarget),children:t("integrations.settings.addConn",{label:(Le==null?void 0:Le.label)??o})})]}),s.jsx("h2",{ref:c,tabIndex:-1,className:"ig-managed-title",children:t("integrations.settings.connsTitle",{label:(Le==null?void 0:Le.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=>je(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:()=>Ve(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"})}),o?t("integrations.settings.backToList",{label:(Le==null?void 0:Le.label)??o}):t("integrations.settings.all")]}),Ie&&Ai(n,Ie.kind)&&s.jsx("button",{type:"button",className:"btn","aria-disabled":S!==null||void 0,onClick:ie=>Ae({mode:"add",kind:Ie.kind},ie.currentTarget),children:t("integrations.settings.addConn",{label:((tt=au(Ie.kind))==null?void 0:tt.label)??Ie.kind})})]}),Ie?s.jsx(h0e,{connection:Ie,provider:au(Ie.kind),available:Ai(n,Ie.kind),busy:S,armed:F===g,note:I.find(ie=>ie.id===g),headingRef:y,onTest:()=>ge(Ie),onEdit:ie=>Ae({mode:"edit",id:Ie.id},ie),onDisconnect:ie=>ve(Ie,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 Uf(),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 Ne=pe.filter(fe=>fe.kind===ie.kind),Fe=Ne.length===1?Ne[0]:null,We=[...new Set(Ne.map(gr))],Te=Fe&&Pj(Fe),nt=(Fe==null?void 0:Fe.kind)==="jira"?Oj(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}),Ne.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:gr(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:Ne.length})}),s.jsxs("span",{className:"ig-conn-line",children:[We.slice(0,2).join(" · "),We.length>2?` · ${t("integrations.settings.moreInstances",{n:We.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${Ne.length?"":" primary"}`,"aria-disabled":S!==null||void 0,ref:fe=>{const $e=Ne.length?d.current:D.current;fe?$e.set(ie.kind,fe):$e.delete(ie.kind)},"aria-label":Ne.length?t("integrations.manageProvider",{label:ie.label}):t("integrations.form.connect",{provider:ie.label}),onClick:fe=>Ne.length?Me(ie.kind,fe.currentTarget):Ae({mode:"add",kind:ie.kind},fe.currentTarget),children:Ne.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(Vt,{id:"integrations-list-title",title:t("integrations.settings.connections"),aside:s.jsx("span",{className:"settings-caption-count",children:xe.length}),children:[xe.map(ie=>je(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(Vt,{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 vD(){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":_q.length,"--reading-selected":_q.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(vD,{})]},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":zq.length,"--reading-selected":zq.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(vD,{})]},o)})})]}),s.jsxs(Vt,{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:Et,cli:e.version,running:t}),i=s.jsx("code",{children:e.command});return e.auto==="pending"||e.auto==="running"?s.jsx(xt,{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"):Rj(n("shell.terminal.soon"),"cmd",i)})}):s.jsx(xt,{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")," "]}),Rj(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)&&zo(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:Et,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:Et,to:t.to,from:t.from})}:null}function T0e({version:e,notice:t,readyAppUpdate:n,updateRestarting:a,updateFailure:i,onUpdateRestart:o,doors:r,bundle:c="3.82.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(Vt,{id:"settings-about-caption",title:Et,children:[s.jsx(xt,{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(A0e,{offer:h,restarting:a,failure:i,onRestart:o,onUpdate:r.update}),s.jsx(xt,{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(xt,{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(xt,{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(Vt,{id:"settings-about-help-caption",title:d("settings.about.helpGroup"),children:[s.jsx(xt,{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(xt,{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 A0e({offer:e,restarting:t,failure:n,onRestart:a,onUpdate:i}){const o=se();if(e.kind==="notice")return s.jsx(xt,{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=DW(e.to,t),c=n&&n.version===e.to?FW(n.failure,n.version):"";return s.jsx(xt,{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=Lo()}){const i=se(),o=R0e(n,a);return s.jsx(Vt,{id:"settings-updates-caption",title:i("settings.updates.title"),children:o==="app"?s.jsx(xt,{as:"div",settingId:"auto-update",name:i("settings.updates.title"),note:i("settings.updates.appNote")}):s.jsx(xt,{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=wf(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(YU,{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(Vt,{id:"appearance-character-caption",title:i("settings.character.title"),list:!1,children:[s.jsx("div",{className:"settings-list",children:s.jsx(xt,{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 kD="settings-search-field",l5="settings-search-results",Mj=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=ece(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:kD,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:kD,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?l5:void 0,"aria-activedescendant":u?Mj(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 P0e({query:e,results:t,active:n,onOpen:a}){const i=se(),o=FB(t.length,e);return m.useEffect(()=>{var r,c;(c=(r=document.getElementById(Mj(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:l5,role:"listbox","aria-label":i("settings.search.results"),children:t.map((r,c)=>s.jsxs("button",{type:"button",role:"option",id:Mj(c),className:"settings-result",tabIndex:-1,"aria-selected":c===n,"aria-label":Yre(r),"data-highlighted":c===n,onMouseDown:d=>d.preventDefault(),onClick:()=>a(r),children:[s.jsx(af,{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:VT(r)})]})]},r.id))})})]})}function O0e({query:e,count:t}){return s.jsx("p",{className:"vis-hidden",role:"status",children:e.trim()?FB(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=>rU({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,$e;return($e=(fe=S.current)==null?void 0:fe.scrollIntoView)==null?void 0:$e.call(fe,{block:"nearest",inline:"nearest"})})):Te()}const j=()=>w(a,!0),S=m.useRef(null),T=Tt(j,{focusRef:S}),A=At(()=>w(a)),q=m.useRef([]),_=hh(),I=e0(_),z=Yoe(I,e,i.claude),F=Math.max(0,z.findIndex(Te=>Te.id===e)),U=_l("(max-width: 640px)"),[O,L]=m.useState(""),[R,P]=m.useState(0),D=m.useRef(null),$=m.useRef(null),B=O.trim()!=="",G=m.useMemo(()=>Qre(O,DB(i.claude,I,ph(_))),[O,i.claude,I,_,k]),Z=U0e($,!B,e),W=Te=>{L(Te),P(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),nf(Te)||Z(Te.id)})};m.useEffect(()=>{const Te=nt=>{var gt,mt;if(!nre(nt))return;const fe=T.current,$e=nt.target;!fe||!($e===document.body||$e===document.documentElement||$e&&fe.contains($e))||(nt.preventDefault(),(gt=D.current)==null||gt.focus(),(mt=D.current)==null||mt.select())};return window.addEventListener("keydown",Te),()=>window.removeEventListener("keydown",Te)},[T]),m.useEffect(()=>{var Te,nt,fe,$e;Zoe((Te=document.activeElement)==null?void 0:Te.id,e)&&((nt=S.current)==null||nt.focus()),($e=(fe=S.current)==null?void 0:fe.scrollIntoView)==null||$e.call(fe,{block:"nearest",inline:"nearest"})},[e]);const{theme:V,setTheme:Q,characterEnabled:J,setCharacterEnabled:K,character:ee,setCharacter:te}=u,le=zn(),ge=Te=>{const nt=wf(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:ue,previewTone:Se,changeTone:ke}=r,{customSelections:ye,customAssets:He,clearCustomOnly:Be,selectCustomTone:Ve,importNotificationAudio:Ae,createNotificationVoice:Ke,renameCustomAsset:Me,deleteCustomAsset:je,previewCustomAsset:xe}=c,{notifyPermission:Le,notifyOn:Ce,notifyVetoed:Ie,toggleNotify:Re,notifySupported:Ue,askForNotifications:tt,accountNotify:ie,toggleAccountNotify:Ne}=d,Fe=(()=>{switch(e){case"radar":return s.jsx($Ae,{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:le}),s.jsx(z0e,{characterEnabled:J,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(qAe,{singleKeys:le,onToggleSingleKeys:()=>Ene(!le)});case"notifications":return s.jsx(_Ae,{notifyOn:Ce,onToggleNotify:Re,notifyVetoed:Ie,notifyPermission:Ue?Le:"unsupported",onAskNotify:tt,accountNotify:ie,onToggleAccountNotify:Ne});case"sounds":return s.jsx(GAe,{soundOn:pe===!0,onToggleSound:ae,prefs:ue,claudeHere:i.claude,onLevel:(Te,nt)=>ke(Te,{level:nt}),onFigure:(Te,nt)=>ke(Te,{figure:nt}),onPreview:Te=>Se(Te),customAssets:He,customSelections:ye,onBuiltInSelected:Be,onCustomSelected:Ve,onImportCustom:Ae,onCreateVoice:Ke,onRenameCustom:Me,onPreviewCustom:xe,onDeleteCustom:je});case"integrations":return s.jsx(p0e,{onBeforeLeaveChange:N});case"data":return s.jsx(l0e,{});case"about":return s.jsx(T0e,{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(CAe,{}),s.jsx(NAe,{}),s.jsx(dD,{provider:"Codex"}),i.claude&&s.jsx(dD,{provider:"Claude"}),s.jsx(q0e,{autoRestart:f.autoRestart,onToggleAutoRestart:f.toggleAutoRestart,version:h.version}),s.jsx(AAe,{claudeHere:i.claude,codexHere:i.codex,singleKeys:le,doors:b})]})}})(),We=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",...A,role:"presentation",children:s.jsxs("div",{ref:T,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:O,onQuery:W,results:G,active:R,onActive:P,onOpen:X}),s.jsx(O0e,{query:O,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(af,{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`)})]}),We]}),Fe]},e),B&&s.jsx(P0e,{query:O,results:G,active:R,onOpen:X})]})]})})}function H0e({tool:e,onClose:t}){const n=se(),a=Tt(t),i=At(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=iQ(e.name,c,d);return{input:g.input.map((f,b)=>s.jsx(wD,{block:f},b)),response:g.response.map((f,b)=>s.jsx(wD,{block:f},b)),copyInput:l1(e.name,"input",c),copyResponse:l1(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:iU(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(yD,{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(yD,{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 wD({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(()=>XX(e),[e]),{shown:i}=_2(a,t),o=QX(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 yD({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 As(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=Ff(()=>Wr(()=>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 yD({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 As(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=Ff(()=>Wr(()=>import("./UsageHistoryModal-HQY6FX_t.js"),[]),()=>x("shell.lazy.usageHistory")),$0e=Ff(()=>Wr(()=>import("./BrowserWatchModal-2_oD4OEZ.js"),[]),()=>x("shell.lazy.browserWatch")),V0e=Ff(()=>Wr(()=>import("./TrafficRadar-Br6HVrU-.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:T}){ja();const{openedTool:A,setOpenedToolKey:q,usageHistoryOpen:_,setUsageHistoryOpen:I,browserWatchOpen:z,setBrowserWatchOpen:F,contextAgent:U,setContextFor:O,summaryFor:L,setSummaryFor:R,keyHelpOpen:P,setKeyHelpOpen:D,feedbackOpen:$,setFeedbackOpen:B,feedbackPrefill:G,setFeedbackPrefill:Z,openFeedback:W}=e,{trafficRadarOpen:H,setTrafficRadarOpen:X}=e,{tourOpen:V,openTour:Q,closeTour:J,releaseNotes:K,closeReleaseNotes:ee,chipVersion:te,openReleaseNotes:le}=t,{desktopUpdateRestarting:ge,desktopUpdateFailure:ve,readyAppUpdate:pe,askDesktopUpdateRestart:ae}=n,{version:ue,showNotice:Se}=a,{askRestart:ke}=i,{clearConfirmOpen:ye,setClearConfirmOpen:He,requestClear:Be}=d,{setWatchOn:Ve,markWatchSeen:Ae}=u,{setWatchSaid:Ke}=h,{palette:Me}=g,{settingsOpen:je,settingsSection:xe,settingsLandOn:Le,showSection:Ce,closeSettings:Ie,openSettings:Re}=y;return s.jsxs(s.Fragment,{children:[A&&s.jsx(H0e,{tool:A,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:Ue=>{Ke(""),Ae(Ue)},onWatching:Ve,palette:Me})}),U&&s.jsx(tte,{agent:U,onClose:()=>O(null)}),H&&s.jsx(m.Suspense,{fallback:null,children:s.jsx(V0e,{sessions:[...b.current.agents.values()].filter(Ue=>Ue.kind==="root"&&Ue.provider!=="codex").map(Ue=>({id:Ue.sessionId,label:Fm(Ue.sessionName,Ue.sessionTitle).face??Ue.cwdBasename??Ue.label,project:Ue.cwdBasename??Ue.label,workspace:Ue.cwd})),onClose:()=>X(!1)})}),$&&s.jsx(XW,{initialKind:G==null?void 0:G.initialKind,initialBody:G==null?void 0:G.initialBody,onClose:()=>{B(!1),Z(null)}}),L&&s.jsx(yAe,{state:b.current,sessionId:L,onClose:()=>R(null)}),je&&s.jsx(B0e,{section:xe,landOn:Le,onSection:Ce,onClose:Ie,providers:f,sound:N,tones:w,customTones:j,notify:S,appearance:g,versionCheck:a,desktopUpdate:n,restart:i,doors:{whatsNew:uo(Ie,le),update:uo(Ie,()=>{le(),Se()}),tour:uo(Ie,Q),feedback:uo(Ie,()=>W()),accounts:uo(Ie,T.accounts),localNetwork:uo(Ie,T.localNetwork),browserWatch:uo(Ie,()=>F(!0)),radar:uo(Ie,()=>X(!0))}}),K&&s.jsx(kAe,{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)?FW(ve.failure,ve.version):void 0,onUpdateRestart:pe?()=>{ae(pe.version)}:void 0,onRestart:!pe&&(ue!=null&&ue.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}),P&&s.jsx(STe,{onClose:()=>D(!1),onTour:()=>{D(!1),Q()},onSettings:()=>{D(!1),Re("keyboard")}}),V&&s.jsx(dH,{title:x("shell.guide.welcome.title"),steps:Xge,onClose:J}),ye&&s.jsx(mje,{agentCount:k,onConfirm:()=>Be("confirmation"),onCancel:()=>He(!1)})]})}function J0e({lanPairs:e,attention:t}){const n=PTe(e);return s.jsxs(s.Fragment,{children:[n,s.jsx(DTe,{...t,pairing:n!=null})]})}const Y0e=10,d5=500,u5=4e3,Z0e=[/ResizeObserver loop/i,/^Script error\.?$/i],xD=/^(?:[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=>xD.test(o)):typeof t=="string"&&xD.test(t)}const xm=String.raw`[^\s\\/:'"\`<>|?*;,]`,eRe=String.raw`${xm}(?:[^\\/\r\n:'"\`<>|?*;,]*${xm})?[\\/]`,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}|/(?=${xm})${Gd}|(?<!:)//(?=${xm})${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 CD=String.raw`(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)`,h5=String.raw`${CD}(?:\.${CD}){3}`,KS=String.raw`[0-9A-Fa-f]{1,4}`,SD=String.raw`(?=[0-9A-Fa-f:]*\d)(?=[0-9A-Fa-f:]*::|(?:${KS}:){7})(?:(?:${KS})?:)+(?:${h5}|${KS})?`,ND=String.raw`%[\w-]+(?:\.[\w-]+)*`,jD=String.raw`(?:::1?|::ffff:(?:127(?:\.\d{1,3}){3}|0\.0\.0\.0))`,cRe=String.raw`(?<![\w:.%-])(?:\[(?!${jD}\])${SD}(?:${ND})?\]|(?!${jD}(?::\d{1,5})?(?![\w:%]|\.\d))${SD}(?:${ND})?(?![\w%]|\.\d))|(?<![\w./-])(?!127\.|0\.0\.0\.0\b)${h5}(?![\w-]|\.\d)`,JS=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) )${JS}|${JS}(?=:\d{1,5}(?![\w:-]|\.\w))|${JS}\.(?:local|lan|home|internal|ts\.net)(?![\w-]|\.\w))`;function TD(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 p5=e=>{fetch("/api/client-error",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e),keepalive:!0}).catch(()=>{})};function dRe(e,t,n=p5){const a=String(e??"").slice(0,d5).trim();a&&n({message:a,stack:typeof t=="string"?t.slice(0,u5):void 0})}function uRe(e,t=window,n=p5){let a=0;const i=new Set,o=(d,u,h)=>{const g=String(d??"").slice(0,d5).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,u5):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=[TD(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("",TD(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=>{Um(n.key)&&Nn.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),kW("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(XW,{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=>fQ(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&&tee(e.current);for(const c of r)e.current=W2(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(`#${g5(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 g5(e){return e==="codex"?"codex-accounts-panel":"accounts-panel"}const Ij={kind:"assumed",claude:!0,codex:!0};function yRe(e){if(!e||typeof e!="object")return Ij;const t=e.providers;if(!t||typeof t!="object")return Ij;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(Ij);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 m5=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>=m5&&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,m5),o=()=>{a.wake()};return document.addEventListener("visibilitychange",o),()=>{a.stop(),window.clearInterval(i),document.removeEventListener("visibilitychange",o)}},[e]),t}const TRe={degraded:"shell.incident.words.degraded",partial_outage:"shell.incident.words.partial_outage",major_outage:"shell.incident.words.major_outage",maintenance:"shell.incident.words.maintenance"},ARe={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 RD(e){return new Date(e).toLocaleTimeString(Pe(),{hour:"2-digit",minute:"2-digit",hourCycle:"h23"})}function PRe(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 ORe(e,t){if(!e||typeof e!="object")return null;const n=dn(TRe,e.state),a=n&&x(n),i=dn(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:RD(e.checkedAt)}):x("shell.incident.reported",{host:o.hostname,ago:PRe(t-e.checkedAt)}),x("shell.incident.opensPage")],u=c?RD(e.checkedAt):null,h=dn(ARe,e.state),g=dn(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=>ORe(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(Xn(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 As(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 ED="agent-dag.browserWatch.seenMs";function URe(e,t){return e.filter(n=>n.startMs>t)}function BRe(){const[e,t]=m.useState(()=>Number(ht(ED))||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(ED,String(d))},[]);return{watchOn:i,setWatchOn:o,watchUnseen:r,markWatchSeen:c}}const f5="agent-dag.character-enabled",b5="agent-dag.fm-volume",HRe=1,qD="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(f5))}function VRe(e){return zB(e,HRe)}function KRe(){return VRe(ht(b5))}const v5=["--err","--inflight","--ok","--warn","--muted","--grid-line","--minimap-mask","--panel","--line","--accent","--text-dim","--bg"];function _D(e){const t={};for(const n of v5)t[n]=e(n);return t}function JRe(e){return t=>e[t]??""}function YRe(e,t){return v5.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 zD(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}function XRe(){const[e,t]=m.useState(jce),[n,a]=m.useState(Tce),[i,o]=m.useState(Gre),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(()=>qt.flushSync(()=>o(j))))},[c]);m.useEffect(()=>()=>c.cancel(),[c]);const[u,h]=m.useState($Re),[g,f]=m.useState(rre),[b,k]=m.useState(()=>_D(zD)),y=m.useMemo(()=>JRe(b),[b]),N=m.useCallback(w=>tCe(w,y),[y]);return m.useEffect(()=>{document.documentElement.dataset.textSize=e,pt(FN,e)},[e]),m.useEffect(()=>{document.documentElement.dataset.density=n,pt(UN,n)},[n]),m.useEffect(()=>{const w=j=>{j.storageArea===Js()&&((j.key===FN||j.key===null)&&t(ZT(j.newValue)),(j.key===UN||j.key===null)&&a(JB(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(PB,i),k(w=>{const j=_D(zD);return YRe(w,j)?w:j})},[i]),m.useEffect(()=>{pt(f5,u?"1":"0")},[u]),m.useEffect(()=>{pt(jB,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(xW(h.name));return Object.keys(yW).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=Bie(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=MN(f,k),N=Ere(b.level,y),w=n.currentTime;for(const j of y.notes){const S=n.createOscillator(),T=n.createGain();S.type=y.type??"sine",S.frequency.value=j.hz;const A=w+j.at,q=A+j.ms/1e3;T.gain.setValueAtTime(Eq,A),T.gain.exponentialRampToValueAtTime(N,A+qre),T.gain.exponentialRampToValueAtTime(Eq,q),S.connect(T).connect(n.destination),S.start(A),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=_re(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(zre(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=Fre((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:Ca},Ca))}),!0):!n||n.state!=="running"?!1:c(f,k)}function h(f,b=Br){return d(f,{level:tf(b),figure:Ca}),!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:Nre,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(()=>Jne(ht(D1))),[i,o]=m.useState(()=>Kne(ht(F1))),[r,c]=m.useState(()=>Yne(ht(qD),n,WRe)),[d,u]=m.useState(()=>new Set),[h,g]=m.useState(0);m.useEffect(()=>{pt(b5,String(e))},[e]),m.useEffect(()=>{pt(F1,i?"1":"0")},[i]),m.useEffect(()=>{pt(D1,JSON.stringify(n))},[n]),m.useEffect(()=>{pt(qD,r)},[r]);const f=m.useCallback((w,j=!1)=>{a(S=>{const T=S.find(A=>A.id===w.id);return T?!j||!w.radio||!T.radio||T.url===w.url&&JSON.stringify(T.radio)===JSON.stringify(w.radio)?S:S.map(A=>A.id===w.id?{...A,url:w.url,radio:w.radio}:A):[...S,w]}),u(S=>{if(!S.has(w.id))return S;const T=new Set(S);return T.delete(w.id),T})},[]),b=m.useCallback((w,j)=>{const S=j.trim();!S||S.length>FU||a(T=>T.map(A=>A.id===w?{...A,name:S}:A))},[]),k=m.useCallback(w=>{a(j=>j.filter(S=>S.id!==w)),c(j=>Zne(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=U1(w),T=d.has(S);w===r&&!T&&!j||(T&&u(A=>{const q=new Set(A);return q.delete(S),q}),c(w),g(A=>A+1))},[r,d]),N=m.useCallback((w,j)=>{const S=U1(w);u(T=>{if(T.has(S)===j)return T;const q=new Set(T);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||!Lo())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=YI(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(!Xn(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"),MW))},[]),b=m.useCallback(k=>{if(Lo())try{const y=YI(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",LD="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 O;U!=null&&U.ok&&d(((O=U.prefs)==null?void 0:O.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),T=m.useRef(null),A=m.useCallback(async F=>{if(!Xn(w.current))return;const U=(F==null?void 0:F.upgrade)===!0,O=(F==null?void 0:F.whenIdle)===!0;w.current=!0,j.current=o;const L=++S.current,R=()=>{k(U?"npx":"restart"),f(!0)};O||R();try{window.sessionStorage.setItem("agent-dag.restartPending",(a==null?void 0:a.to)??"")}catch{}let P=!1;try{const D=await fetch("/api/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(O?{upgrade:U,whenIdle:O}:{upgrade:U})});P=O&&D.status===409}catch{}if(P){w.current=!1,T.current=null;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}return}O&&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=QI(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:T.current,now:e});T.current=U.idleSince,U.restart&&A({whenIdle:!0})},[c,a==null?void 0:a.kind,n==null?void 0:n.canRestart,i,e,A]);const q=QI(t.current.agents.values()),_=rje(q,r),I=WW({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:T.current,now:e});m.useEffect(()=>{const F=n==null?void 0:n.running;let U=null,O=null;try{U=window.sessionStorage.getItem("agent-dag.restartPending"),O=window.sessionStorage.getItem(LD)}catch{return}const L=nje({bundle:"3.82.1",running:F,pending:U,lastTried:O});if(L==="reload"){try{window.sessionStorage.setItem(LD,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,O;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(((O=F.prefs)==null?void 0:O.autoUpdate)!==!1)}},[]);return{autoRestart:c,toggleAutoRestart:h,restarting:g,restartMode:b,restartedTo:y,askRestart:A,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(v_(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?uj: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(v_(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?jTe(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(TTe(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 k5=288,cEe=k5;function lEe(e,t,n){return e?"session-list":t||n?"accounts":null}function PD(e){return e==="session-list"?cEe:e==="accounts"?k5: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 w5="agent-dag.sessionListOpen",y5="agent-dag.accountsPanelOpen";function pEe(){return ht(w5)==="1"}function gEe(e){pt(w5,e?"1":"0")}function mEe(){const e=ht(y5);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&&zN()?(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&&zN()?(t.current=!0,!1):k});m.useEffect(()=>{if(o)t.current=!1;else if(t.current)return;!o&&i.current||pt(y5,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 x5="agent-dag.detailOpen",C5="agent-dag.usagePanelOpen",S5="agent-dag.systemPanelOpen";function bEe(){return ht(x5)==="1"}function vEe(e){pt(x5,e?"1":"0")}function kEe(){const e=ht(C5);return e===null?!0:e==="1"}function wEe(e){pt(C5,e?"1":"0")}function yEe(){const e=ht(S5);return e===null?!0:e==="1"}function xEe(e){pt(S5,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&&(zN()||Uoe(e))?(o.current=!0,!1):d});return m.useEffect(()=>{if(r)o.current=!1;else if(o.current)return;xEe(r)},[r]),jn("usage-panel",a),jn("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 YS(e,t,n=NEe()){return t!==""?t:e===""?"":n}function TEe({waitingSessions:e,watchUnseen:t,incidents:n=[]}){const[a,i]=m.useState(""),o=jEe(e);m.useEffect(()=>{i(f=>YS(f,o))},[o]);const[r,c]=m.useState(""),d=t>0?x("shell.announce.watch",{count:t}):"";m.useEffect(()=>{c(f=>YS(f,d,x("shell.announce.watchNone")))},[d]);const[u,h]=m.useState(""),g=IRe(n);return m.useEffect(()=>{h(f=>YS(f,g,DRe()))},[g]),{blockedSaid:a,watchSaid:r,setWatchSaid:c,incidentSaid:u}}const AEe="/icon-192.png",N5=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]:N5[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(N5),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 T=m.useRef(null),A=e.map(I=>Im(I.id,I.waiting)).join("|");m.useEffect(()=>{xee(T.current,a)&&(T.current=a,y.current=Mp(e))},[a]);const q=m.useRef(!1);m.useEffect(()=>{Cee(q.current,t)&&(q.current=!0,y.current=Mp(e))},[t]),m.useEffect(()=>{if(typeof Notification>"u"||Notification.permission!=="granted"||!See(T.current,t))return;const I=typeof document>"u"||!document.hidden,z=wee(e,y.current,I,c);for(const F of z)try{const U=new Notification(F.title,{body:F.body,tag:F.key,icon:AEe});U.onclick=()=>{window.focus(),n(F.sessionId),U.close()}}catch{}y.current=I?Mp(e):yee(e,z,y.current)},[A,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((O,L)=>i({agentId:O,toolId:L}),[]),[r,c]=m.useState(null),[d,u]=m.useState(null),h=m.useCallback(O=>u(O),[]),[g,f]=m.useState(!1),[b,k]=m.useState(!1),[y,N]=m.useState(!1),[w,j]=m.useState(!1),[S,T]=m.useState(!1),[A,q]=m.useState(null),_=m.useCallback(O=>{q(O??null),T(!0)},[]);jn("tool-detail",a!==null),jn("session-summary",r!==null),jn("context-window",d!==null),jn("keyboard-help",g),jn("usage-history",b),jn("browser-watch",y),jn("feedback",S);const I=a?hQ(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:T,feedbackPrefill:A,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=sT(),t.current.clear(),n.current.clear(),a.current.clear(),i.current="",lW(),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 MD="agent-dag.oldNameNoticeDismissed";function zEe(e){const[t,n]=m.useState(()=>ht(MD)??""),a=e!=null&&e.invokedAs&&e.invokedAs!==Et?e.invokedAs:null,i=a!=null&&t!==a,o=m.useCallback(()=>{a&&(n(a),pt(MD,a))},[a]);return{oldName:a,oldNameOpen:i,dismissOldName:o}}const LEe=300*1e3,PEe=1800*1e3,OEe=8e3,MEe=3e4;function ID(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:Nn.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,PEe);return()=>{b=!0,window.clearTimeout(y),window.clearInterval(N)}},[t]),m.useEffect(()=>{if(n!=="thanks"||r)return;const b=i!==null&&i<=6?MEe:OEe;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"),ID({score:b})},[]),h=m.useCallback(b=>c(b),[]),g=m.useCallback(()=>{a("hidden"),ID({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(()=>pre(ht)),r=da(i),[c,d]=m.useState([]),u=m.useCallback(j=>{o(S=>{const T={...S,[j]:null};return r.current=T,T}),Xa(ru[j])},[]),h=m.useCallback((j,S)=>{const T=r.current[j];S&&T!==S||(u(j),t(A=>{const q={...A,[j]:{...A[j],figure:Ca}};return n.current=q,q}),pt(sm[j],Ca))},[u]),g=da(h);m.useEffect(()=>{let j=!0;return Sre().then(S=>{if(!j)return;d(S);const T=new Set(S.map(A=>A.id));for(const A of cu){const q=r.current[A];q&&!T.has(q)&&g.current(A,q)}},()=>{}),()=>{j=!1}},[]);const f=m.useCallback((j,S)=>{if(!c.some(A=>A.id===S))return;const T={...r.current,[j]:S};r.current=T,o(T),pt(ru[j],S),a(j,!0)},[c,a]),b=m.useCallback(async j=>{var q;const S=ON(c.length);if(S)throw new vn(S);const T=window.AudioContext??window.webkitAudioContext;if(!T)throw new vn(x("settings.sounds.custom.decodeFail"));const A=new T;try{const _=await kre(j,z=>A.decodeAudioData(z));await Aq(_);const I=zu(_);d(z=>[...z.filter(F=>F.id!==I.id),I])}finally{(q=A.close)==null||q.call(A)}},[c.length]),k=m.useCallback(async j=>{const S=ON(c.length);if(S)throw new vn(S);const T=wre(j);await Aq(T);const A=zu(T);d(q=>[...q.filter(_=>_.id!==A.id),A])},[c.length]),y=m.useCallback(async(j,S)=>{const T=c.find(q=>q.id===j),A=S.trim().slice(0,80);!T||!A||A===T.name||(await jre(j,A),d(q=>q.map(_=>_.id===j?{..._,name:A}:_)))},[c]),N=m.useCallback(async j=>{await Tre(j),d(q=>q.filter(_=>_.id!==j));const S=r.current,T=gre(S,j);r.current=T,o(T);const A=cu.filter(q=>S[q]===j);for(const q of A)Xa(ru[q]),pt(sm[q],Ca);A.length>0&&t(q=>{const _={...q};for(const I of A)_[I]={..._[I],figure:Ca};return n.current=_,_})},[]),w=m.useCallback(j=>{var A,q;const S=cu.find(_=>r.current[_]===j),T=S?n.current[S].level:Br;(A=e.current)==null||A.unlock(),(q=e.current)==null||q.previewCustom(j,T)},[]);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(()=>Dre(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)},Lre)},[]),r=m.useCallback((c,d)=>{n(u=>{const h={level:tf(d.level??u[c].level),figure:qB(c,d.figure??u[c].figure)};return pt(LB[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 ZS="agent-dag.versionNoticeDismissed",VEe=15*6e4;function KEe(e){const[t,n]=m.useState(null),[a,i]=m.useState(()=>ht(ZS)??""),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=UW(h),f=TNe(h,a),b=m.useCallback(()=>{i(""),pt(ZS,"")},[]),k=m.useCallback(()=>{h&&(i(g),pt(ZS,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=KTe(N),j=eAe({stored:w,running:(e==null?void 0:e.running)??null,notes:rD,remembers:JTe(N)});if(j.reason==="no-version")return;u.current=!0,j.record&&YTe(N,j.record);let S=!0;return(async()=>{var I;let A=ZTe(N);if(Lo())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;A&&!U&&fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tourSeen:!0}),keepalive:!0}).catch(()=>{}),A=A||U}catch{A=!0}if(!S)return;const q=QTe({tourSeen:A,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.82.1",g=m.useMemo(()=>t5(rD,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),XTe(Js()),Lo()&&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(Xoe),n=m.useCallback((o,r)=>{t(c=>Qoe(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(aT,{children:s.jsx(gRe,{children:s.jsx(n1e,{})})})}function n1e(){var cc;const e=se(),t=Cl(),n=m.useState(sT)[0],a=m.useRef(n),[,i]=m.useState(0),o=m.useCallback(()=>i(yt=>yt+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:T}=CEe(PD(d)),{selectedIds:A,primarySelectedId:q,selectAgent:_,clearSelection:I,pruneSelectionToBoard:z}=Rve(a,N),F=Vc(c,200),U=Vc(r,200),O=XE(r,U),L=Vc(w,130),R=Vc(S,130),P=m.useRef(null),D=ZEe(P),{activateSoundRef:$,soundOnRef:B}=D,G=FEe(P),{setTonePrefs:Z,tonePrefsRef:W,previewTone:H}=G,X=DEe({chimesRef:P,setTonePrefs:Z,tonePrefsRef:W,previewTone:H}),{customSelectionsRef:V,fallbackCustomRef:Q}=X,J=XEe(),{openSettings:K}=J;tEe({chimesRef:P,soundOnRef:B,tonePrefsRef:W,customSelectionsRef:V,fallbackCustomRef:Q});const ee=bRe(a),{pauseGate:te,paused:le,togglePause:ge}=ee,ve=m.useRef(()=>{}),{live:pe,tabCapped:ae,everConnected:ue,liveSince:Se}=kve({stateRef:a,rerender:o,pauseGate:te,chimesRef:P,desktopUpdateRef:ve}),ke=KEe(pe),{version:ye,notice:He,noticeOpen:Be,loadVersion:Ve}=ke,Ae=aEe(pe),{readyAppUpdate:Ke,onDesktopUpdateEvent:Me}=Ae;ve.current=Me,GEe();const je=JEe({version:ye,readyAppUpdate:Ke}),{tourOpen:xe,openTour:Le,releaseNotes:Ce}=je,{workspace:Ie,providers:Re,providersRef:Ue}=xRe(pe),tt=wRe(Re,c),ie=tt.shown,Ne=yt=>{tt.remember(yt),(!c||ie===yt)&&h()},Fe=PD(d==="accounts"&&!(Re.claude||Re.codex)?null:d),We=hEe(Fe),Te=XE(c,F)&&(Re.claude||Re.codex),[nt,fe]=m.useState(!1),$e=tt.remember,gt=m.useCallback(()=>{$e(Re.claude?"claude":"codex"),g()},[g,Re.claude,$e]),mt=m.useCallback(()=>{g(),fe(!0)},[g]),[ft,Zt]=m.useState(null),[Ln,Ta]=m.useState([]),ga=m.useMemo(()=>[...ft??[],...Ln],[ft,Ln]);m.useEffect(()=>{c||fe(!1)},[c]);const Bn=m.useCallback(()=>fe(!1),[]),Aa=zEe(ye),Ot=FRe({version:ye,loadVersion:Ve}),{upgradeFailure:Hn}=Ot,Kt=qEe({stateRef:a,tourOpen:xe,releaseNotes:Ce}),Ge=IEe({modalOpenRef:Kt.modalOpenRef}),{openTool:Qe,setSummaryFor:dt,setContextFor:vt,openContext:_t,setKeyHelpOpen:Wt,setUsageHistoryOpen:Ut,setBrowserWatchOpen:ma,keyHelpOpenRef:hn,modalOpenRef:Xt}=Kt,Ra=YEe(),Ea=BRe(),{watchOn:Qt,watchUnseen:en}=Ea,on=hh(),[Pn,An]=m.useState(null),[ss,Rt]=m.useState(!1),qa=m.useCallback(()=>Rt(!1),[]),_a=yt=>{iNe(yt),K("integrations")},is=yt=>{yt&&JI(yt),K("integrations")},za=m.useCallback(()=>An(null),[]),Wn=XA().filter(yt=>Tj(on,yt.kind)),Es=da(yt=>{const Vi=Wn.find(Ki=>Ki.kind===yt);Vi&&An(Vi.kind)}),fa=m.useCallback(yt=>{JI(yt),K("integrations")},[K]),tn=Wn.length>0;m.useEffect(()=>{tn&&WSe()},[tn]);const Gn=iEe(),[rn,Do]=m.useState(0),{presentCats:qs,hiddenCats:os,toggleCat:On,catBarRef:ta,catBarOccluded:La}=QRe(a),nn=m.useRef(null),[oi,ri]=m.useState(0),de=Eve({stateRef:a,rerender:o,pruneSelectionToBoard:z,setContextFor:vt,setSummaryFor:dt});mne({stateRef:a,now:de,enabled:Re.claude});const Ee=jRe(Re.claude||Re.codex),re=MRe(Ee,de),qe=rEe({enabled:Re.claude,lanStatus:Gn.lanStatus,now:de}),Je=sEe({now:de,stateRef:a,version:ye,notice:He,noticeOpen:Be,upgradeFailure:Hn,paused:ee.paused}),{askRestart:lt,loadAutoRestartPrefs:at}=Je,wn=XRe(),{setTheme:rs,palette:_s}=wn,Fo=nEe(),zs=Exe(),{applyViewport:gh,moveCamera:Il,fitLeft:ci,cameraEpochRef:Ls,lastFitTimeRef:cs}=zs,$n=Wxe(zs),{pinnedRef:Ps,positionsRef:Os,lastLayoutSigRef:Ms,handleRelayout:mh,rearrangeUndo:fh}=$n,Ui=m.useRef(null),bh=m.useRef(()=>{}),Dl=Se!==null,Uo=m.useRef(0),Fl=m.useCallback(()=>{Uo.current=Date.now()},[]),{canvasRef:Is,canvasSize:Bo,paneSizeRef:Ho}=qCe(We),li=e1e(ci),{autoFitDisabledRef:Wo,disableAutoFit:Ul}=li,Bl=m.useRef(!1),{measuredRef:ls,measuredVersionRef:Zr,sizeVersion:Hl,domSizeVersion:vh}=_Ce(Bl,a),{removedNodes:Pa,removedAgentIds:Ds,removeNode:Xr,removeSelectedNode:Wl,removalNotice:Go,hideSessions:Qr,bringBack:ec,bringBackAll:Vn,forgetRemovals:Bi}=dCe({stateRef:a,pinnedRef:Ps,positionsRef:Os,returningRef:$n.returningRef,canvasRef:Is,clearSelection:I,primarySelectedId:q});wCe({stateRef:a,removedNodes:Pa,hideSessions:Qr,ready:Dl,keepSessionId:q?((cc=a.current.agents.get(q))==null?void 0:cc.sessionId)??q:null});const $o=iCe({stateRef:a,now:de,removedAgentIds:Ds,sizeVersion:Hl,domSizeVersion:vh});Gxe($o,$n),lCe({layoutSig:$o,rf:t,stateRef:a,measuredRef:ls,pinnedRef:Ps,positionsRef:Os,paneSizeRef:Ho,lastInteractRef:Uo,autoFitDisabledRef:Wo,lastFitTimeRef:cs,fitLeft:ci});const Hi=zCe(),{bubbling:Bf,endBubble:Gl,onBubble:$l}=sve(),[di,tc]=m.useState(!1),Vl=nve(),{beginTrashDrag:Hf,trackTrashDrag:Wf,endTrashDrag:Gf}=Vl,nc=uve({stateRef:a,measuredRef:ls,measuredVersionRef:Zr,canvasRef:Is}),{lodRef:$f,applyZoom:Vf}=nc,kh=ACe({applyViewport:gh,lastFitTimeRef:cs,cameraEpochRef:Ls,disableAutoFit:Ul,markInteract:Fl,canvasRef:Is,applyZoom:Vf}),Vo=q?a.current.agents.get(q):null,Kl=y&&Vo!=null,Fs=MCe({sessionListShown:O,usageShown:wo(L),machineShown:wo(R),accountsShown:Te&&Re.claude,codexShown:Te&&!Re.claude,detailShown:Kl,primarySelectedId:q,canvasRef:Is}),{railInsetRef:ac,availableWidth:wh,availableHeight:yh}=Nxe({canvasRef:Is,canvasSize:Bo,machinePhase:R,usagePhase:L,usagePanelOpen:w,detailShown:Kl}),xh=oCe({stateRef:a,now:de,availableWidth:wh,availableHeight:yh,layout:$n,measuredRef:ls,onBubble:$l,settled:Hi,dragging:di,layoutSig:$o,selectedIds:A,openContext:_t,historyReplayed:Dl,removedNodes:Pa,removedAgentIds:Ds,dragTick:rn,dragPatchRef:nn,dragMoveTick:oi}),{nodes:Ko,edges:Kf}=xh,Jl=da(q);$xe({nodes:Ko,edges:Kf,settled:Hi,dragging:di,availableWidth:wh,availableHeight:yh,layout:$n,camera:zs,rf:t,measuredRef:ls,stateRef:a,lastFocusRef:Ui,primarySelectedIdRef:Jl,focusAgentRef:bh,autoFitDisabledRef:Wo});const Ch=_Ee({stateRef:a,pinnedRef:Ps,measuredRef:ls,positionsRef:Os,lastLayoutSigRef:Ms,forgetRemovals:Bi,clearSelection:I,rerender:o,modalOpenRef:Xt}),{requestClear:sc}=Ch,Jf=ICe({nodes:Ko,stateRef:a,pinnedRef:Ps,positionsRef:Os,draggingRef:Bl,dragPatchRef:nn,setDragging:tc,setDragMoveTick:ri,setDragTick:Do,endBubble:Gl,markInteract:Fl,disableAutoFit:Ul,beginTrashDrag:Hf,trackTrashDrag:Wf,endTrashDrag:Gf,removeNode:Xr}),Sh=m.useCallback(()=>ci(500),[ci]),Yl=da(Ko),{focusAgent:ic,stepAgent:Yf,focusSession:Wi}=_xe({canvasRef:Is,stateRef:a,measuredRef:ls,nodesRef:Yl,railInsetRef:ac,moveCamera:Il,disableAutoFit:Ul,lastFocusRef:Ui,focusAgentRef:bh,selectAgent:_,primarySelectedIdRef:Jl}),Zf=RCe({clearSelection:I,selectAgent:_,detailOpen:y,setDetailOpen:N,detailShown:Kl,focusAgent:ic,draggingRef:Bl,lodRef:$f}),Zl=zxe({nodesRef:Yl,stateRef:a,canvasRef:Is,railInsetRef:ac}),Jo=da(Wl),Xl=m.useRef(null),Yo=m.useCallback(yt=>{Ds.has(yt)&&ec([yt]),Wi(yt)},[Ds,ec,Wi]),Nh=LCe(),[jh,oc]=m.useState(!1),Ql=m.useCallback(()=>oc(!0),[]),Gi=m.useCallback(()=>oc(!1),[]),Xf=m.useCallback(yt=>{oc(!1),yt.run()},[]),Qf=zn();PCe({pointerFocusRef:Nh,nodesRef:Yl,stateRef:a,primarySelectedIdRef:Jl,providersRef:Ue,soundOnRef:B,keyHelpOpenRef:hn,modalOpenRef:Xt,waitingCursorRef:Xl,removeSelectedRef:Jo,activateSoundRef:$,clearSelection:I,selectAgent:_,focusAgent:ic,stepAgent:Yf,focusSession:Wi,requestClear:sc,handleRelayout:mh,undoRearrange:fh.undo,handleFit:Sh,togglePause:ge,toggleSessionList:u,toggleAccountsPanel:h,setDetailOpen:N,setUsageHistoryOpen:Ut,setUsagePanelOpen:j,setMachinePanelOpen:T,setBrowserWatchOpen:ma,setKeyHelpOpen:Wt,setTheme:rs,openSettings:K,openIntegrationRef:Es,openQuickOpen:Ql});const ed=a.current.agents.size,ui=m.useMemo(()=>vN(a.current.agents.values()),[a.current,a.current.revision]);uCe({stateRef:a,waitingSessions:ui,removedAgentIds:Ds,removedNodes:Pa,bringBack:ec}),NCe({stateRef:a,waitingSessions:ui,live:pe});const td=TEe({waitingSessions:ui,watchUnseen:en,incidents:re}),hi=REe({waitingSessions:ui,liveSince:Se,focusSession:Wi}),{loadNotifyPrefs:Zo}=hi;$Ee({loadAutoRestartPrefs:at,loadNotifyPrefs:Zo,loadReportsPrefs:Ra.loadReportsPrefs});const pi=_l(Qm),[rc,Th]=m.useState(!1),[nd,Xo]=m.useState(null),ad=m.useCallback(()=>Xo(null),[]),Ah=m.useCallback(yt=>{const Vi=a.current.agents.get(yt);return Vi?Vi.label||Vi.cwdBasename||"session":null},[]),Rh=m.useCallback(yt=>{Xo(null),Yo(yt)},[Yo]),Eh=m.useCallback(()=>Th(!1),[]),[qh,_h]=m.useState(null),eb=m.useCallback(()=>_h(null),[]),yn=sSe({providers:Re,sessionListOpen:r,toggleSessionList:u,accountsPanelOpen:c,toggleAccountsPanel:h,accountsPanelId:g5(ie),codexPanelOpen:c&&ie==="codex",toggleCodexPanel:()=>Ne("codex"),usagePanelOpen:w,setUsagePanelOpen:j,machinePanelOpen:S,setMachinePanelOpen:T,setUsageHistoryOpen:Ut,watchOn:Qt,watchUnseen:en,setBrowserWatchOpen:ma,setTrafficRadarOpen:Kt.setTrafficRadarOpen,openSettings:K,onFeedback:Kt.openFeedback,setRadioOpen:Th,openToolActivity:Xo,openCapacity:_h,toggles:Fs.toggles,integrations:Wn.map(yt=>({provider:yt,onPress:()=>An(yt.kind)})),openExploreIntegrations:()=>Rt(!0),openQuickOpen:Ql}),[tb,ba]=m.useState(0),$i=m.useCallback(yt=>{Yo(yt),pi&&b()},[Yo,pi,b]),zh=m.useCallback(()=>{r||u(),requestAnimationFrame(()=>{var yt;return(yt=document.querySelector("#session-list .sl-row"))==null?void 0:yt.focus()})},[r,u]),sd=()=>{(Re.claude?Fs.accounts:Fs.codex)(),k()},id=tt.both?s.jsx(gbe,{shown:ie,notices:tt.notices,onPick:tt.pick}):void 0,od=yt=>tt.bothMounted?yt===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(Iie,{}),s.jsx(DNe,{versionCheck:ke,welcome:je,desktopUpdate:Ae,pause:ee,announcements:td,notify:hi,waitingSessions:ui,waitingCursorRef:Xl,focusSession:Wi,live:pe,now:de,incidents:re,queueNamed:pi?0:tb}),!pi&&s.jsx(PNe,{waitingSessions:ui,waitingCursorRef:Xl,focusSession:Wi,now:de,onFit:ba,onMore:zh}),Vo&&s.jsx(FNe,{selected:Vo,now:de,selectedIds:A,focusAgent:ic,clearSelection:I}),!pi&&s.jsx("div",{className:"actions",children:s.jsx(Koe,{items:[yn.search,...yn.utilities]})})]}),pi?s.jsx(Voe,{items:[...yn.left,...yn.right[0],yn.utilities[0]],more:[yn.search,...yn.capacity,...yn.right.slice(1).flat(),...yn.integrations,...yn.explore,yn.utilities[1]]}):s.jsx(yq,{side:"left",label:e("shell.rail.left"),groups:[...yn.leftStripe,yn.integrations,yn.explore]}),s.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:Go?e("shell.board.removed",{label:Go.label}):""}),s.jsx(dje,{restart:Je,versionCheck:ke,upgrade:Ot,oldNameNotice:Aa,rating:Ge,onFeedback:Kt.openFeedback,everConnected:ue,live:pe,paused:le}),(O||Te)&&s.jsxs(Jbe,{width:Fe,children:[Te&&(ie==="claude"||tt.bothMounted)&&s.jsx(hbe,{leaving:Mv(c,F),onReport:Kt.openFeedback,onRoster:qe.observe,onClose:sd,lanWanted:nt,onLanShown:Bn,onLanAccounts:Zt,codexLanAccounts:Ln,switcher:id,side:od("claude"),onNotice:tt.noteClaude}),Te&&(ie==="codex"||tt.bothMounted)&&s.jsx(Kbe,{leaving:Mv(c,F),onClose:sd,switcher:id,side:od("codex"),onNotice:tt.noteCodex,lanAccounts:ga,lanReady:!Re.claude||ft!=null,lanWanted:nt,onLanShown:Bn,onLanAccounts:Ta}),O&&s.jsx(Wie,{leaving:Mv(r,U),state:a.current,now:de,selectedIds:A,onSelect:$i,onClose:()=>{Fs.sessionList(),f()},removedIds:Ds,onBringBackAll:Vn})]}),s.jsxs(GNe,{canvasRef:Is,bubbling:Bf,dragging:di,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:ue,providers:Re,workspace:Ie,onTour:Le,reservedRight:ac.current})),(qs.length>1||os.size>0)&&s.jsx(UNe,{catBarRef:ta,catBarOccluded:La,presentCats:qs,hiddenCats:os,toggleCat:On}),s.jsx(Mie,{graph:xh,layout:$n,viewport:kh,clicks:Zf,drag:Jf,appearance:wn,fm:Fo,radioOpen:rc,onRadioClose:Eh,autoFit:li,pause:ee,stateRef:a,measuredRef:ls,hiddenCats:os,now:de,openTool:Qe,focusAgent:ic,requestClear:sc,setKeyHelpOpen:Wt})]}),!pi&&s.jsx(yq,{side:"right",label:e("shell.rail.right"),groups:yn.right}),nd&&s.jsx(ble,{view:nd,onClose:ad,sessionLabel:Ah,onOpenSession:Rh}),qh&&s.jsx(Rbe,{view:qh,onClose:eb}),Pn&&s.jsx(VSe,{kind:Pn,connections:Ai(on,Pn)?vm(on,Pn):[],onClose:za,onReconnect:fa}),ss&&s.jsx(uNe,{integrations:on,onClose:qa,onOpen:An,onConnect:_a,onManage:is}),jh&&s.jsx(joe,{onClose:Gi,onRun:Xf,items:oce({rails:yn,sessions:cB(a.current),now:de,openSession:$i,settings:DB(Re.claude,e0(on),ph(on)),openSettings:K,singleKeys:Qf,fit:Sh,rearrange:mh,paused:le,togglePause:ge,clear:ed>0?()=>sc("button"):void 0,keyHelp:()=>Wt(!0),tour:Le,theme:wn.theme,setTheme:rs})}),wo(L)&&s.jsx(Yde,{state:a.current,now:de,providers:Re,incidents:re,liveSince:Se,leaving:L==="leaving",onClose:()=>{Fs.usage(),j(!1)}}),wo(R)&&s.jsx(zue,{usageOpen:w,leaving:R==="leaving",onClose:()=>{Fs.machine(),T(!1)}}),y&&Vo?s.jsx(tSe,{selected:Vo,now:de,openTool:Qe,setSummaryFor:dt,stateRef:a,removeSelectedNode:Wl,onClose:()=>{Fs.detail(),N(!1)}}):null,s.jsx(K0e,{dialogs:Kt,welcome:je,desktopUpdate:Ae,versionCheck:ke,restart:Je,upgrade:Ot,lanPairs:Gn,attention:qe,clearFlow:Ch,watchBadge:Ea,announcements:td,appearance:wn,providers:Re,stateRef:a,agentCount:ed,menus:J,sound:D,tones:G,customTones:X,notify:hi,panelDoors:{accounts:gt,localNetwork:mt}})]})}function DD(){try{fetch("/api/ui-language",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({code:Pe()})}).catch(()=>null)}catch{}}function a1e(){DD();try{return q2(DD)}catch{return()=>{}}}try{X8(window.localStorage)}catch{}R2();a1e();const s1e=jG.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 $,Gr as A,rU as B,Tt as C,At as D,xl as E,jn as F,w1e as G,hhe as H,Za as I,k1e as J,g1e as K,p1e as L,qt as M,au as N,y1e as O,p3 as P,St as Q,l3 as R,GN as S,Wg as T,Uq as U,$N as V,d1e as W,It as X,No as Y,Vs as Z,u1e as _,Xa as a,Fu as a0,ea as a1,bre as a2,Ka as a3,CTe as a4,Rj as a5,vn as a6,$m as a7,m3 as a8,we as a9,Ur as aa,To as ab,jse as ac,x1e as ad,LT as ae,kl as af,rae as ag,l1e as ah,r1e as ai,c1e as aj,Km as ak,Hee as al,BAe as am,HRe as an,o1e as ao,Tse as ap,m as b,_l as c,b1e as d,Pe as e,_W as f,jT as g,YSe as h,ua as i,s as j,v1e as k,JSe as l,Nn as m,gr as n,Mi as o,Sl as p,f1e as q,ht as r,Xn as s,x as t,se as u,ja as v,pt as w,As as x,m1e as y,wf as z};
|
|
358
|
+
`)}}function MRe(e,t){return!(e!=null&&e.ok)||e.disabled||!Array.isArray(e.providers)?[]:e.providers.map(n=>ORe(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(Xn(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 As(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 ED="agent-dag.browserWatch.seenMs";function URe(e,t){return e.filter(n=>n.startMs>t)}function BRe(){const[e,t]=m.useState(()=>Number(ht(ED))||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(ED,String(d))},[]);return{watchOn:i,setWatchOn:o,watchUnseen:r,markWatchSeen:c}}const f5="agent-dag.character-enabled",b5="agent-dag.fm-volume",HRe=1,qD="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(f5))}function VRe(e){return zB(e,HRe)}function KRe(){return VRe(ht(b5))}const v5=["--err","--inflight","--ok","--warn","--muted","--grid-line","--minimap-mask","--panel","--line","--accent","--text-dim","--bg"];function _D(e){const t={};for(const n of v5)t[n]=e(n);return t}function JRe(e){return t=>e[t]??""}function YRe(e,t){return v5.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 zD(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}function XRe(){const[e,t]=m.useState(jce),[n,a]=m.useState(Tce),[i,o]=m.useState(Gre),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(()=>qt.flushSync(()=>o(j))))},[c]);m.useEffect(()=>()=>c.cancel(),[c]);const[u,h]=m.useState($Re),[g,f]=m.useState(rre),[b,k]=m.useState(()=>_D(zD)),y=m.useMemo(()=>JRe(b),[b]),N=m.useCallback(w=>tCe(w,y),[y]);return m.useEffect(()=>{document.documentElement.dataset.textSize=e,pt(FN,e)},[e]),m.useEffect(()=>{document.documentElement.dataset.density=n,pt(UN,n)},[n]),m.useEffect(()=>{const w=j=>{j.storageArea===Js()&&((j.key===FN||j.key===null)&&t(ZT(j.newValue)),(j.key===UN||j.key===null)&&a(JB(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(PB,i),k(w=>{const j=_D(zD);return YRe(w,j)?w:j})},[i]),m.useEffect(()=>{pt(f5,u?"1":"0")},[u]),m.useEffect(()=>{pt(jB,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(xW(h.name));return Object.keys(yW).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=Bie(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=MN(f,k),N=Ere(b.level,y),w=n.currentTime;for(const j of y.notes){const S=n.createOscillator(),T=n.createGain();S.type=y.type??"sine",S.frequency.value=j.hz;const A=w+j.at,q=A+j.ms/1e3;T.gain.setValueAtTime(Eq,A),T.gain.exponentialRampToValueAtTime(N,A+qre),T.gain.exponentialRampToValueAtTime(Eq,q),S.connect(T).connect(n.destination),S.start(A),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=_re(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(zre(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=Fre((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:Ca},Ca))}),!0):!n||n.state!=="running"?!1:c(f,k)}function h(f,b=Br){return d(f,{level:tf(b),figure:Ca}),!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:Nre,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(()=>Jne(ht(D1))),[i,o]=m.useState(()=>Kne(ht(F1))),[r,c]=m.useState(()=>Yne(ht(qD),n,WRe)),[d,u]=m.useState(()=>new Set),[h,g]=m.useState(0);m.useEffect(()=>{pt(b5,String(e))},[e]),m.useEffect(()=>{pt(F1,i?"1":"0")},[i]),m.useEffect(()=>{pt(D1,JSON.stringify(n))},[n]),m.useEffect(()=>{pt(qD,r)},[r]);const f=m.useCallback((w,j=!1)=>{a(S=>{const T=S.find(A=>A.id===w.id);return T?!j||!w.radio||!T.radio||T.url===w.url&&JSON.stringify(T.radio)===JSON.stringify(w.radio)?S:S.map(A=>A.id===w.id?{...A,url:w.url,radio:w.radio}:A):[...S,w]}),u(S=>{if(!S.has(w.id))return S;const T=new Set(S);return T.delete(w.id),T})},[]),b=m.useCallback((w,j)=>{const S=j.trim();!S||S.length>FU||a(T=>T.map(A=>A.id===w?{...A,name:S}:A))},[]),k=m.useCallback(w=>{a(j=>j.filter(S=>S.id!==w)),c(j=>Zne(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=U1(w),T=d.has(S);w===r&&!T&&!j||(T&&u(A=>{const q=new Set(A);return q.delete(S),q}),c(w),g(A=>A+1))},[r,d]),N=m.useCallback((w,j)=>{const S=U1(w);u(T=>{if(T.has(S)===j)return T;const q=new Set(T);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||!Lo())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=YI(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(!Xn(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"),MW))},[]),b=m.useCallback(k=>{if(Lo())try{const y=YI(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",LD="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 O;U!=null&&U.ok&&d(((O=U.prefs)==null?void 0:O.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),T=m.useRef(null),A=m.useCallback(async F=>{if(!Xn(w.current))return;const U=(F==null?void 0:F.upgrade)===!0,O=(F==null?void 0:F.whenIdle)===!0;w.current=!0,j.current=o;const L=++S.current,R=()=>{k(U?"npx":"restart"),f(!0)};O||R();try{window.sessionStorage.setItem("agent-dag.restartPending",(a==null?void 0:a.to)??"")}catch{}let P=!1;try{const D=await fetch("/api/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(O?{upgrade:U,whenIdle:O}:{upgrade:U})});P=O&&D.status===409}catch{}if(P){w.current=!1,T.current=null;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}return}O&&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=QI(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:T.current,now:e});T.current=U.idleSince,U.restart&&A({whenIdle:!0})},[c,a==null?void 0:a.kind,n==null?void 0:n.canRestart,i,e,A]);const q=QI(t.current.agents.values()),_=rje(q,r),I=WW({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:T.current,now:e});m.useEffect(()=>{const F=n==null?void 0:n.running;let U=null,O=null;try{U=window.sessionStorage.getItem("agent-dag.restartPending"),O=window.sessionStorage.getItem(LD)}catch{return}const L=nje({bundle:"3.82.2",running:F,pending:U,lastTried:O});if(L==="reload"){try{window.sessionStorage.setItem(LD,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,O;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(((O=F.prefs)==null?void 0:O.autoUpdate)!==!1)}},[]);return{autoRestart:c,toggleAutoRestart:h,restarting:g,restartMode:b,restartedTo:y,askRestart:A,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(v_(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?uj: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(v_(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?jTe(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(TTe(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 k5=288,cEe=k5;function lEe(e,t,n){return e?"session-list":t||n?"accounts":null}function PD(e){return e==="session-list"?cEe:e==="accounts"?k5: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 w5="agent-dag.sessionListOpen",y5="agent-dag.accountsPanelOpen";function pEe(){return ht(w5)==="1"}function gEe(e){pt(w5,e?"1":"0")}function mEe(){const e=ht(y5);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&&zN()?(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&&zN()?(t.current=!0,!1):k});m.useEffect(()=>{if(o)t.current=!1;else if(t.current)return;!o&&i.current||pt(y5,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 x5="agent-dag.detailOpen",C5="agent-dag.usagePanelOpen",S5="agent-dag.systemPanelOpen";function bEe(){return ht(x5)==="1"}function vEe(e){pt(x5,e?"1":"0")}function kEe(){const e=ht(C5);return e===null?!0:e==="1"}function wEe(e){pt(C5,e?"1":"0")}function yEe(){const e=ht(S5);return e===null?!0:e==="1"}function xEe(e){pt(S5,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&&(zN()||Uoe(e))?(o.current=!0,!1):d});return m.useEffect(()=>{if(r)o.current=!1;else if(o.current)return;xEe(r)},[r]),jn("usage-panel",a),jn("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 YS(e,t,n=NEe()){return t!==""?t:e===""?"":n}function TEe({waitingSessions:e,watchUnseen:t,incidents:n=[]}){const[a,i]=m.useState(""),o=jEe(e);m.useEffect(()=>{i(f=>YS(f,o))},[o]);const[r,c]=m.useState(""),d=t>0?x("shell.announce.watch",{count:t}):"";m.useEffect(()=>{c(f=>YS(f,d,x("shell.announce.watchNone")))},[d]);const[u,h]=m.useState(""),g=IRe(n);return m.useEffect(()=>{h(f=>YS(f,g,DRe()))},[g]),{blockedSaid:a,watchSaid:r,setWatchSaid:c,incidentSaid:u}}const AEe="/icon-192.png",N5=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]:N5[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(N5),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 T=m.useRef(null),A=e.map(I=>Im(I.id,I.waiting)).join("|");m.useEffect(()=>{xee(T.current,a)&&(T.current=a,y.current=Mp(e))},[a]);const q=m.useRef(!1);m.useEffect(()=>{Cee(q.current,t)&&(q.current=!0,y.current=Mp(e))},[t]),m.useEffect(()=>{if(typeof Notification>"u"||Notification.permission!=="granted"||!See(T.current,t))return;const I=typeof document>"u"||!document.hidden,z=wee(e,y.current,I,c);for(const F of z)try{const U=new Notification(F.title,{body:F.body,tag:F.key,icon:AEe});U.onclick=()=>{window.focus(),n(F.sessionId),U.close()}}catch{}y.current=I?Mp(e):yee(e,z,y.current)},[A,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((O,L)=>i({agentId:O,toolId:L}),[]),[r,c]=m.useState(null),[d,u]=m.useState(null),h=m.useCallback(O=>u(O),[]),[g,f]=m.useState(!1),[b,k]=m.useState(!1),[y,N]=m.useState(!1),[w,j]=m.useState(!1),[S,T]=m.useState(!1),[A,q]=m.useState(null),_=m.useCallback(O=>{q(O??null),T(!0)},[]);jn("tool-detail",a!==null),jn("session-summary",r!==null),jn("context-window",d!==null),jn("keyboard-help",g),jn("usage-history",b),jn("browser-watch",y),jn("feedback",S);const I=a?hQ(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:T,feedbackPrefill:A,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=sT(),t.current.clear(),n.current.clear(),a.current.clear(),i.current="",lW(),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 MD="agent-dag.oldNameNoticeDismissed";function zEe(e){const[t,n]=m.useState(()=>ht(MD)??""),a=e!=null&&e.invokedAs&&e.invokedAs!==Et?e.invokedAs:null,i=a!=null&&t!==a,o=m.useCallback(()=>{a&&(n(a),pt(MD,a))},[a]);return{oldName:a,oldNameOpen:i,dismissOldName:o}}const LEe=300*1e3,PEe=1800*1e3,OEe=8e3,MEe=3e4;function ID(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:Nn.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,PEe);return()=>{b=!0,window.clearTimeout(y),window.clearInterval(N)}},[t]),m.useEffect(()=>{if(n!=="thanks"||r)return;const b=i!==null&&i<=6?MEe:OEe;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"),ID({score:b})},[]),h=m.useCallback(b=>c(b),[]),g=m.useCallback(()=>{a("hidden"),ID({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(()=>pre(ht)),r=da(i),[c,d]=m.useState([]),u=m.useCallback(j=>{o(S=>{const T={...S,[j]:null};return r.current=T,T}),Xa(ru[j])},[]),h=m.useCallback((j,S)=>{const T=r.current[j];S&&T!==S||(u(j),t(A=>{const q={...A,[j]:{...A[j],figure:Ca}};return n.current=q,q}),pt(sm[j],Ca))},[u]),g=da(h);m.useEffect(()=>{let j=!0;return Sre().then(S=>{if(!j)return;d(S);const T=new Set(S.map(A=>A.id));for(const A of cu){const q=r.current[A];q&&!T.has(q)&&g.current(A,q)}},()=>{}),()=>{j=!1}},[]);const f=m.useCallback((j,S)=>{if(!c.some(A=>A.id===S))return;const T={...r.current,[j]:S};r.current=T,o(T),pt(ru[j],S),a(j,!0)},[c,a]),b=m.useCallback(async j=>{var q;const S=ON(c.length);if(S)throw new vn(S);const T=window.AudioContext??window.webkitAudioContext;if(!T)throw new vn(x("settings.sounds.custom.decodeFail"));const A=new T;try{const _=await kre(j,z=>A.decodeAudioData(z));await Aq(_);const I=zu(_);d(z=>[...z.filter(F=>F.id!==I.id),I])}finally{(q=A.close)==null||q.call(A)}},[c.length]),k=m.useCallback(async j=>{const S=ON(c.length);if(S)throw new vn(S);const T=wre(j);await Aq(T);const A=zu(T);d(q=>[...q.filter(_=>_.id!==A.id),A])},[c.length]),y=m.useCallback(async(j,S)=>{const T=c.find(q=>q.id===j),A=S.trim().slice(0,80);!T||!A||A===T.name||(await jre(j,A),d(q=>q.map(_=>_.id===j?{..._,name:A}:_)))},[c]),N=m.useCallback(async j=>{await Tre(j),d(q=>q.filter(_=>_.id!==j));const S=r.current,T=gre(S,j);r.current=T,o(T);const A=cu.filter(q=>S[q]===j);for(const q of A)Xa(ru[q]),pt(sm[q],Ca);A.length>0&&t(q=>{const _={...q};for(const I of A)_[I]={..._[I],figure:Ca};return n.current=_,_})},[]),w=m.useCallback(j=>{var A,q;const S=cu.find(_=>r.current[_]===j),T=S?n.current[S].level:Br;(A=e.current)==null||A.unlock(),(q=e.current)==null||q.previewCustom(j,T)},[]);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(()=>Dre(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)},Lre)},[]),r=m.useCallback((c,d)=>{n(u=>{const h={level:tf(d.level??u[c].level),figure:qB(c,d.figure??u[c].figure)};return pt(LB[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 ZS="agent-dag.versionNoticeDismissed",VEe=15*6e4;function KEe(e){const[t,n]=m.useState(null),[a,i]=m.useState(()=>ht(ZS)??""),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=UW(h),f=TNe(h,a),b=m.useCallback(()=>{i(""),pt(ZS,"")},[]),k=m.useCallback(()=>{h&&(i(g),pt(ZS,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=KTe(N),j=eAe({stored:w,running:(e==null?void 0:e.running)??null,notes:rD,remembers:JTe(N)});if(j.reason==="no-version")return;u.current=!0,j.record&&YTe(N,j.record);let S=!0;return(async()=>{var I;let A=ZTe(N);if(Lo())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;A&&!U&&fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tourSeen:!0}),keepalive:!0}).catch(()=>{}),A=A||U}catch{A=!0}if(!S)return;const q=QTe({tourSeen:A,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.82.2",g=m.useMemo(()=>t5(rD,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),XTe(Js()),Lo()&&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(Xoe),n=m.useCallback((o,r)=>{t(c=>Qoe(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(aT,{children:s.jsx(gRe,{children:s.jsx(n1e,{})})})}function n1e(){var cc;const e=se(),t=Cl(),n=m.useState(sT)[0],a=m.useRef(n),[,i]=m.useState(0),o=m.useCallback(()=>i(yt=>yt+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:T}=CEe(PD(d)),{selectedIds:A,primarySelectedId:q,selectAgent:_,clearSelection:I,pruneSelectionToBoard:z}=Rve(a,N),F=Vc(c,200),U=Vc(r,200),O=XE(r,U),L=Vc(w,130),R=Vc(S,130),P=m.useRef(null),D=ZEe(P),{activateSoundRef:$,soundOnRef:B}=D,G=FEe(P),{setTonePrefs:Z,tonePrefsRef:W,previewTone:H}=G,X=DEe({chimesRef:P,setTonePrefs:Z,tonePrefsRef:W,previewTone:H}),{customSelectionsRef:V,fallbackCustomRef:Q}=X,J=XEe(),{openSettings:K}=J;tEe({chimesRef:P,soundOnRef:B,tonePrefsRef:W,customSelectionsRef:V,fallbackCustomRef:Q});const ee=bRe(a),{pauseGate:te,paused:le,togglePause:ge}=ee,ve=m.useRef(()=>{}),{live:pe,tabCapped:ae,everConnected:ue,liveSince:Se}=kve({stateRef:a,rerender:o,pauseGate:te,chimesRef:P,desktopUpdateRef:ve}),ke=KEe(pe),{version:ye,notice:He,noticeOpen:Be,loadVersion:Ve}=ke,Ae=aEe(pe),{readyAppUpdate:Ke,onDesktopUpdateEvent:Me}=Ae;ve.current=Me,GEe();const je=JEe({version:ye,readyAppUpdate:Ke}),{tourOpen:xe,openTour:Le,releaseNotes:Ce}=je,{workspace:Ie,providers:Re,providersRef:Ue}=xRe(pe),tt=wRe(Re,c),ie=tt.shown,Ne=yt=>{tt.remember(yt),(!c||ie===yt)&&h()},Fe=PD(d==="accounts"&&!(Re.claude||Re.codex)?null:d),We=hEe(Fe),Te=XE(c,F)&&(Re.claude||Re.codex),[nt,fe]=m.useState(!1),$e=tt.remember,gt=m.useCallback(()=>{$e(Re.claude?"claude":"codex"),g()},[g,Re.claude,$e]),mt=m.useCallback(()=>{g(),fe(!0)},[g]),[ft,Zt]=m.useState(null),[Ln,Ta]=m.useState([]),ga=m.useMemo(()=>[...ft??[],...Ln],[ft,Ln]);m.useEffect(()=>{c||fe(!1)},[c]);const Bn=m.useCallback(()=>fe(!1),[]),Aa=zEe(ye),Ot=FRe({version:ye,loadVersion:Ve}),{upgradeFailure:Hn}=Ot,Kt=qEe({stateRef:a,tourOpen:xe,releaseNotes:Ce}),Ge=IEe({modalOpenRef:Kt.modalOpenRef}),{openTool:Qe,setSummaryFor:dt,setContextFor:vt,openContext:_t,setKeyHelpOpen:Wt,setUsageHistoryOpen:Ut,setBrowserWatchOpen:ma,keyHelpOpenRef:hn,modalOpenRef:Xt}=Kt,Ra=YEe(),Ea=BRe(),{watchOn:Qt,watchUnseen:en}=Ea,on=hh(),[Pn,An]=m.useState(null),[ss,Rt]=m.useState(!1),qa=m.useCallback(()=>Rt(!1),[]),_a=yt=>{iNe(yt),K("integrations")},is=yt=>{yt&&JI(yt),K("integrations")},za=m.useCallback(()=>An(null),[]),Wn=XA().filter(yt=>Tj(on,yt.kind)),Es=da(yt=>{const Vi=Wn.find(Ki=>Ki.kind===yt);Vi&&An(Vi.kind)}),fa=m.useCallback(yt=>{JI(yt),K("integrations")},[K]),tn=Wn.length>0;m.useEffect(()=>{tn&&WSe()},[tn]);const Gn=iEe(),[rn,Do]=m.useState(0),{presentCats:qs,hiddenCats:os,toggleCat:On,catBarRef:ta,catBarOccluded:La}=QRe(a),nn=m.useRef(null),[oi,ri]=m.useState(0),de=Eve({stateRef:a,rerender:o,pruneSelectionToBoard:z,setContextFor:vt,setSummaryFor:dt});mne({stateRef:a,now:de,enabled:Re.claude});const Ee=jRe(Re.claude||Re.codex),re=MRe(Ee,de),qe=rEe({enabled:Re.claude,lanStatus:Gn.lanStatus,now:de}),Je=sEe({now:de,stateRef:a,version:ye,notice:He,noticeOpen:Be,upgradeFailure:Hn,paused:ee.paused}),{askRestart:lt,loadAutoRestartPrefs:at}=Je,wn=XRe(),{setTheme:rs,palette:_s}=wn,Fo=nEe(),zs=Exe(),{applyViewport:gh,moveCamera:Il,fitLeft:ci,cameraEpochRef:Ls,lastFitTimeRef:cs}=zs,$n=Wxe(zs),{pinnedRef:Ps,positionsRef:Os,lastLayoutSigRef:Ms,handleRelayout:mh,rearrangeUndo:fh}=$n,Ui=m.useRef(null),bh=m.useRef(()=>{}),Dl=Se!==null,Uo=m.useRef(0),Fl=m.useCallback(()=>{Uo.current=Date.now()},[]),{canvasRef:Is,canvasSize:Bo,paneSizeRef:Ho}=qCe(We),li=e1e(ci),{autoFitDisabledRef:Wo,disableAutoFit:Ul}=li,Bl=m.useRef(!1),{measuredRef:ls,measuredVersionRef:Zr,sizeVersion:Hl,domSizeVersion:vh}=_Ce(Bl,a),{removedNodes:Pa,removedAgentIds:Ds,removeNode:Xr,removeSelectedNode:Wl,removalNotice:Go,hideSessions:Qr,bringBack:ec,bringBackAll:Vn,forgetRemovals:Bi}=dCe({stateRef:a,pinnedRef:Ps,positionsRef:Os,returningRef:$n.returningRef,canvasRef:Is,clearSelection:I,primarySelectedId:q});wCe({stateRef:a,removedNodes:Pa,hideSessions:Qr,ready:Dl,keepSessionId:q?((cc=a.current.agents.get(q))==null?void 0:cc.sessionId)??q:null});const $o=iCe({stateRef:a,now:de,removedAgentIds:Ds,sizeVersion:Hl,domSizeVersion:vh});Gxe($o,$n),lCe({layoutSig:$o,rf:t,stateRef:a,measuredRef:ls,pinnedRef:Ps,positionsRef:Os,paneSizeRef:Ho,lastInteractRef:Uo,autoFitDisabledRef:Wo,lastFitTimeRef:cs,fitLeft:ci});const Hi=zCe(),{bubbling:Bf,endBubble:Gl,onBubble:$l}=sve(),[di,tc]=m.useState(!1),Vl=nve(),{beginTrashDrag:Hf,trackTrashDrag:Wf,endTrashDrag:Gf}=Vl,nc=uve({stateRef:a,measuredRef:ls,measuredVersionRef:Zr,canvasRef:Is}),{lodRef:$f,applyZoom:Vf}=nc,kh=ACe({applyViewport:gh,lastFitTimeRef:cs,cameraEpochRef:Ls,disableAutoFit:Ul,markInteract:Fl,canvasRef:Is,applyZoom:Vf}),Vo=q?a.current.agents.get(q):null,Kl=y&&Vo!=null,Fs=MCe({sessionListShown:O,usageShown:wo(L),machineShown:wo(R),accountsShown:Te&&Re.claude,codexShown:Te&&!Re.claude,detailShown:Kl,primarySelectedId:q,canvasRef:Is}),{railInsetRef:ac,availableWidth:wh,availableHeight:yh}=Nxe({canvasRef:Is,canvasSize:Bo,machinePhase:R,usagePhase:L,usagePanelOpen:w,detailShown:Kl}),xh=oCe({stateRef:a,now:de,availableWidth:wh,availableHeight:yh,layout:$n,measuredRef:ls,onBubble:$l,settled:Hi,dragging:di,layoutSig:$o,selectedIds:A,openContext:_t,historyReplayed:Dl,removedNodes:Pa,removedAgentIds:Ds,dragTick:rn,dragPatchRef:nn,dragMoveTick:oi}),{nodes:Ko,edges:Kf}=xh,Jl=da(q);$xe({nodes:Ko,edges:Kf,settled:Hi,dragging:di,availableWidth:wh,availableHeight:yh,layout:$n,camera:zs,rf:t,measuredRef:ls,stateRef:a,lastFocusRef:Ui,primarySelectedIdRef:Jl,focusAgentRef:bh,autoFitDisabledRef:Wo});const Ch=_Ee({stateRef:a,pinnedRef:Ps,measuredRef:ls,positionsRef:Os,lastLayoutSigRef:Ms,forgetRemovals:Bi,clearSelection:I,rerender:o,modalOpenRef:Xt}),{requestClear:sc}=Ch,Jf=ICe({nodes:Ko,stateRef:a,pinnedRef:Ps,positionsRef:Os,draggingRef:Bl,dragPatchRef:nn,setDragging:tc,setDragMoveTick:ri,setDragTick:Do,endBubble:Gl,markInteract:Fl,disableAutoFit:Ul,beginTrashDrag:Hf,trackTrashDrag:Wf,endTrashDrag:Gf,removeNode:Xr}),Sh=m.useCallback(()=>ci(500),[ci]),Yl=da(Ko),{focusAgent:ic,stepAgent:Yf,focusSession:Wi}=_xe({canvasRef:Is,stateRef:a,measuredRef:ls,nodesRef:Yl,railInsetRef:ac,moveCamera:Il,disableAutoFit:Ul,lastFocusRef:Ui,focusAgentRef:bh,selectAgent:_,primarySelectedIdRef:Jl}),Zf=RCe({clearSelection:I,selectAgent:_,detailOpen:y,setDetailOpen:N,detailShown:Kl,focusAgent:ic,draggingRef:Bl,lodRef:$f}),Zl=zxe({nodesRef:Yl,stateRef:a,canvasRef:Is,railInsetRef:ac}),Jo=da(Wl),Xl=m.useRef(null),Yo=m.useCallback(yt=>{Ds.has(yt)&&ec([yt]),Wi(yt)},[Ds,ec,Wi]),Nh=LCe(),[jh,oc]=m.useState(!1),Ql=m.useCallback(()=>oc(!0),[]),Gi=m.useCallback(()=>oc(!1),[]),Xf=m.useCallback(yt=>{oc(!1),yt.run()},[]),Qf=zn();PCe({pointerFocusRef:Nh,nodesRef:Yl,stateRef:a,primarySelectedIdRef:Jl,providersRef:Ue,soundOnRef:B,keyHelpOpenRef:hn,modalOpenRef:Xt,waitingCursorRef:Xl,removeSelectedRef:Jo,activateSoundRef:$,clearSelection:I,selectAgent:_,focusAgent:ic,stepAgent:Yf,focusSession:Wi,requestClear:sc,handleRelayout:mh,undoRearrange:fh.undo,handleFit:Sh,togglePause:ge,toggleSessionList:u,toggleAccountsPanel:h,setDetailOpen:N,setUsageHistoryOpen:Ut,setUsagePanelOpen:j,setMachinePanelOpen:T,setBrowserWatchOpen:ma,setKeyHelpOpen:Wt,setTheme:rs,openSettings:K,openIntegrationRef:Es,openQuickOpen:Ql});const ed=a.current.agents.size,ui=m.useMemo(()=>vN(a.current.agents.values()),[a.current,a.current.revision]);uCe({stateRef:a,waitingSessions:ui,removedAgentIds:Ds,removedNodes:Pa,bringBack:ec}),NCe({stateRef:a,waitingSessions:ui,live:pe});const td=TEe({waitingSessions:ui,watchUnseen:en,incidents:re}),hi=REe({waitingSessions:ui,liveSince:Se,focusSession:Wi}),{loadNotifyPrefs:Zo}=hi;$Ee({loadAutoRestartPrefs:at,loadNotifyPrefs:Zo,loadReportsPrefs:Ra.loadReportsPrefs});const pi=_l(Qm),[rc,Th]=m.useState(!1),[nd,Xo]=m.useState(null),ad=m.useCallback(()=>Xo(null),[]),Ah=m.useCallback(yt=>{const Vi=a.current.agents.get(yt);return Vi?Vi.label||Vi.cwdBasename||"session":null},[]),Rh=m.useCallback(yt=>{Xo(null),Yo(yt)},[Yo]),Eh=m.useCallback(()=>Th(!1),[]),[qh,_h]=m.useState(null),eb=m.useCallback(()=>_h(null),[]),yn=sSe({providers:Re,sessionListOpen:r,toggleSessionList:u,accountsPanelOpen:c,toggleAccountsPanel:h,accountsPanelId:g5(ie),codexPanelOpen:c&&ie==="codex",toggleCodexPanel:()=>Ne("codex"),usagePanelOpen:w,setUsagePanelOpen:j,machinePanelOpen:S,setMachinePanelOpen:T,setUsageHistoryOpen:Ut,watchOn:Qt,watchUnseen:en,setBrowserWatchOpen:ma,setTrafficRadarOpen:Kt.setTrafficRadarOpen,openSettings:K,onFeedback:Kt.openFeedback,setRadioOpen:Th,openToolActivity:Xo,openCapacity:_h,toggles:Fs.toggles,integrations:Wn.map(yt=>({provider:yt,onPress:()=>An(yt.kind)})),openExploreIntegrations:()=>Rt(!0),openQuickOpen:Ql}),[tb,ba]=m.useState(0),$i=m.useCallback(yt=>{Yo(yt),pi&&b()},[Yo,pi,b]),zh=m.useCallback(()=>{r||u(),requestAnimationFrame(()=>{var yt;return(yt=document.querySelector("#session-list .sl-row"))==null?void 0:yt.focus()})},[r,u]),sd=()=>{(Re.claude?Fs.accounts:Fs.codex)(),k()},id=tt.both?s.jsx(gbe,{shown:ie,notices:tt.notices,onPick:tt.pick}):void 0,od=yt=>tt.bothMounted?yt===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(Iie,{}),s.jsx(DNe,{versionCheck:ke,welcome:je,desktopUpdate:Ae,pause:ee,announcements:td,notify:hi,waitingSessions:ui,waitingCursorRef:Xl,focusSession:Wi,live:pe,now:de,incidents:re,queueNamed:pi?0:tb}),!pi&&s.jsx(PNe,{waitingSessions:ui,waitingCursorRef:Xl,focusSession:Wi,now:de,onFit:ba,onMore:zh}),Vo&&s.jsx(FNe,{selected:Vo,now:de,selectedIds:A,focusAgent:ic,clearSelection:I}),!pi&&s.jsx("div",{className:"actions",children:s.jsx(Koe,{items:[yn.search,...yn.utilities]})})]}),pi?s.jsx(Voe,{items:[...yn.left,...yn.right[0],yn.utilities[0]],more:[yn.search,...yn.capacity,...yn.right.slice(1).flat(),...yn.integrations,...yn.explore,yn.utilities[1]]}):s.jsx(yq,{side:"left",label:e("shell.rail.left"),groups:[...yn.leftStripe,yn.integrations,yn.explore]}),s.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:Go?e("shell.board.removed",{label:Go.label}):""}),s.jsx(dje,{restart:Je,versionCheck:ke,upgrade:Ot,oldNameNotice:Aa,rating:Ge,onFeedback:Kt.openFeedback,everConnected:ue,live:pe,paused:le}),(O||Te)&&s.jsxs(Jbe,{width:Fe,children:[Te&&(ie==="claude"||tt.bothMounted)&&s.jsx(hbe,{leaving:Mv(c,F),onReport:Kt.openFeedback,onRoster:qe.observe,onClose:sd,lanWanted:nt,onLanShown:Bn,onLanAccounts:Zt,codexLanAccounts:Ln,switcher:id,side:od("claude"),onNotice:tt.noteClaude}),Te&&(ie==="codex"||tt.bothMounted)&&s.jsx(Kbe,{leaving:Mv(c,F),onClose:sd,switcher:id,side:od("codex"),onNotice:tt.noteCodex,lanAccounts:ga,lanReady:!Re.claude||ft!=null,lanWanted:nt,onLanShown:Bn,onLanAccounts:Ta}),O&&s.jsx(Wie,{leaving:Mv(r,U),state:a.current,now:de,selectedIds:A,onSelect:$i,onClose:()=>{Fs.sessionList(),f()},removedIds:Ds,onBringBackAll:Vn})]}),s.jsxs(GNe,{canvasRef:Is,bubbling:Bf,dragging:di,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:ue,providers:Re,workspace:Ie,onTour:Le,reservedRight:ac.current})),(qs.length>1||os.size>0)&&s.jsx(UNe,{catBarRef:ta,catBarOccluded:La,presentCats:qs,hiddenCats:os,toggleCat:On}),s.jsx(Mie,{graph:xh,layout:$n,viewport:kh,clicks:Zf,drag:Jf,appearance:wn,fm:Fo,radioOpen:rc,onRadioClose:Eh,autoFit:li,pause:ee,stateRef:a,measuredRef:ls,hiddenCats:os,now:de,openTool:Qe,focusAgent:ic,requestClear:sc,setKeyHelpOpen:Wt})]}),!pi&&s.jsx(yq,{side:"right",label:e("shell.rail.right"),groups:yn.right}),nd&&s.jsx(ble,{view:nd,onClose:ad,sessionLabel:Ah,onOpenSession:Rh}),qh&&s.jsx(Rbe,{view:qh,onClose:eb}),Pn&&s.jsx(VSe,{kind:Pn,connections:Ai(on,Pn)?vm(on,Pn):[],onClose:za,onReconnect:fa}),ss&&s.jsx(uNe,{integrations:on,onClose:qa,onOpen:An,onConnect:_a,onManage:is}),jh&&s.jsx(joe,{onClose:Gi,onRun:Xf,items:oce({rails:yn,sessions:cB(a.current),now:de,openSession:$i,settings:DB(Re.claude,e0(on),ph(on)),openSettings:K,singleKeys:Qf,fit:Sh,rearrange:mh,paused:le,togglePause:ge,clear:ed>0?()=>sc("button"):void 0,keyHelp:()=>Wt(!0),tour:Le,theme:wn.theme,setTheme:rs})}),wo(L)&&s.jsx(Yde,{state:a.current,now:de,providers:Re,incidents:re,liveSince:Se,leaving:L==="leaving",onClose:()=>{Fs.usage(),j(!1)}}),wo(R)&&s.jsx(zue,{usageOpen:w,leaving:R==="leaving",onClose:()=>{Fs.machine(),T(!1)}}),y&&Vo?s.jsx(tSe,{selected:Vo,now:de,openTool:Qe,setSummaryFor:dt,stateRef:a,removeSelectedNode:Wl,onClose:()=>{Fs.detail(),N(!1)}}):null,s.jsx(K0e,{dialogs:Kt,welcome:je,desktopUpdate:Ae,versionCheck:ke,restart:Je,upgrade:Ot,lanPairs:Gn,attention:qe,clearFlow:Ch,watchBadge:Ea,announcements:td,appearance:wn,providers:Re,stateRef:a,agentCount:ed,menus:J,sound:D,tones:G,customTones:X,notify:hi,panelDoors:{accounts:gt,localNetwork:mt}})]})}function DD(){try{fetch("/api/ui-language",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({code:Pe()})}).catch(()=>null)}catch{}}function a1e(){DD();try{return q2(DD)}catch{return()=>{}}}try{X8(window.localStorage)}catch{}R2();a1e();const s1e=jG.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 $,Gr as A,rU as B,Tt as C,At as D,xl as E,jn as F,w1e as G,hhe as H,Za as I,k1e as J,g1e as K,p1e as L,qt as M,au as N,y1e as O,p3 as P,St as Q,l3 as R,GN as S,Wg as T,Uq as U,$N as V,d1e as W,It as X,No as Y,Vs as Z,u1e as _,Xa as a,Fu as a0,ea as a1,bre as a2,Ka as a3,CTe as a4,Rj as a5,vn as a6,$m as a7,m3 as a8,we as a9,Ur as aa,To as ab,jse as ac,x1e as ad,LT as ae,kl as af,rae as ag,l1e as ah,r1e as ai,c1e as aj,Km as ak,Hee as al,BAe as am,HRe as an,o1e as ao,Tse as ap,m as b,_l as c,b1e as d,Pe as e,_W as f,jT as g,YSe as h,ua as i,s as j,v1e as k,JSe as l,Nn as m,gr as n,Mi as o,Sl as p,f1e as q,ht as r,Xn as s,x as t,se as u,ja as v,pt as w,As as x,m1e as y,wf as z};
|