glimmervoid 0.35.0 → 0.35.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -37600,6 +37600,8 @@ function createMyPrsPoller(dependencies) {
|
|
|
37600
37600
|
//#region server/ssh-signing.ts
|
|
37601
37601
|
var AGENT_LISTING_TIMEOUT_MS = 5e3;
|
|
37602
37602
|
var SIGNING_TIMEOUT_MS = 6e4;
|
|
37603
|
+
var FORWARDED_AGENT_RECONNECT_WAIT_MS = 3e4;
|
|
37604
|
+
var AGENT_RESCAN_INTERVAL_MS = 1e3;
|
|
37603
37605
|
function defaultAgentSearchRoots() {
|
|
37604
37606
|
const roots = ["/tmp", os.tmpdir()];
|
|
37605
37607
|
return roots.filter((root, index) => roots.indexOf(root) === index);
|
|
@@ -37621,7 +37623,7 @@ async function forwardedSocketsIn(searchRoot, ownerUid) {
|
|
|
37621
37623
|
const socketPaths = (await Promise.all(agentDirs.map(async (agentDir) => (await readEntryNames(agentDir)).map((entryName) => path.join(agentDir, entryName))))).flat();
|
|
37622
37624
|
return (await Promise.all(socketPaths.map((socketPath) => ownedSocketAt(socketPath, ownerUid)))).filter((candidate) => candidate !== null);
|
|
37623
37625
|
}
|
|
37624
|
-
function createSshSigner({ env = process.env, agentSearchRoots = defaultAgentSearchRoots(), ownerUid = process.getuid?.() ?? null } = {}) {
|
|
37626
|
+
function createSshSigner({ env = process.env, agentSearchRoots = defaultAgentSearchRoots(), ownerUid = process.getuid?.() ?? null, agentWaitMs = FORWARDED_AGENT_RECONNECT_WAIT_MS } = {}) {
|
|
37625
37627
|
async function agentHolds(socketPath, publicKey) {
|
|
37626
37628
|
const listing = await execFileAsync("ssh-add", ["-L"], {
|
|
37627
37629
|
env: {
|
|
@@ -37642,8 +37644,16 @@ function createSshSigner({ env = process.env, agentSearchRoots = defaultAgentSea
|
|
|
37642
37644
|
for (const socketPath of candidates) if (await agentHolds(socketPath, publicKey)) return { SSH_AUTH_SOCK: socketPath };
|
|
37643
37645
|
return null;
|
|
37644
37646
|
}
|
|
37645
|
-
async function
|
|
37647
|
+
async function agentEnvBefore(publicKey, deadlineMs) {
|
|
37646
37648
|
const agentEnv = await agentEnvFor(publicKey);
|
|
37649
|
+
if (agentEnv || Date.now() >= deadlineMs) return agentEnv;
|
|
37650
|
+
await new Promise((resolve) => {
|
|
37651
|
+
setTimeout(resolve, AGENT_RESCAN_INTERVAL_MS);
|
|
37652
|
+
});
|
|
37653
|
+
return agentEnvBefore(publicKey, deadlineMs);
|
|
37654
|
+
}
|
|
37655
|
+
async function signWithAgent({ publicKey, namespace, payload }) {
|
|
37656
|
+
const agentEnv = await agentEnvBefore(publicKey, Date.now() + agentWaitMs);
|
|
37647
37657
|
if (!agentEnv) return {
|
|
37648
37658
|
ok: false,
|
|
37649
37659
|
error: NO_AGENT_HOLDS_KEY
|
|
@@ -243,7 +243,7 @@ void main() {
|
|
|
243
243
|
`}function tL(){if(!KI)return;let e=VI(WI,UI?.anomalies),t=KI.hidden;KI.hidden=!e,e&&t&&UI&&($I(),GI&&eL())}function nL(e){WI=e,tL()}function rL(e){if(KI)return KI;let t=QI();return e.appendChild(t),tL(),t}function iL(e){UI=e,tL(),KI&&!KI.hidden&&($I(),GI&&eL())}function aL(e){return e.replace(/\r\n?/g,`
|
|
244
244
|
`).split(`
|
|
245
245
|
`)}function oL(e){return{kind:`unchanged`,text:e}}function sL(e){return{kind:`skipped`,text:`${e} unchanged lines`}}function cL(e,t){return e.length<=7?e.map(t):[...e.slice(0,3).map(t),sL(e.length-6),...e.slice(e.length-3).map(t)]}function lL(e){return e}function uL(e){let t=[],n=0;for(;n<e.length;){if(e[n].kind!==`unchanged`){t.push(e[n]),n++;continue}let r=n;for(;r<e.length&&e[r].kind===`unchanged`;)r++;t.push(...cL(e.slice(n,r),lL)),n=r}return t}function dL(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[r]===t[r];)r++;return r}function fL(e,t,n){let r=Math.min(e.length,t.length)-n,i=0;for(;i<r&&e[e.length-1-i]===t[t.length-1-i];)i++;return i}function pL(e,t){let n=e.length,r=t.length;if(n===0)return t.map(e=>({kind:`added`,text:e}));if(r===0)return e.map(e=>({kind:`removed`,text:e}));let i=r+1,a=new Int32Array((n+1)*i);for(let o=n-1;o>=0;o--)for(let n=r-1;n>=0;n--){let r=o*i+n;a[r]=e[o]===t[n]?a[r+i+1]+1:Math.max(a[r+i],a[r+1])}let o=[],s=0,c=0;for(;s<n&&c<r;)e[s]===t[c]?(o.push(oL(e[s])),s++,c++):a[(s+1)*i+c]>=a[s*i+c+1]?(o.push({kind:`removed`,text:e[s]}),s++):(o.push({kind:`added`,text:t[c]}),c++);for(;s<n;)o.push({kind:`removed`,text:e[s]}),s++;for(;c<r;)o.push({kind:`added`,text:t[c]}),c++;return o}function mL(e,t){let n=aL(e),r=aL(t),i=dL(n,r),a=fL(n,r,i),o=n.slice(i,n.length-a),s=r.slice(i,r.length-a);return o.length+s.length>2e3?{lines:[],isTooLarge:!0}:{lines:uL([...cL(n.slice(0,i),oL),...pL(o,s),...cL(n.slice(n.length-a),oL)]),isTooLarge:!1}}var hL=Object.freeze([{kind:`approve`,label:`Approve`},{kind:`revise`,label:`Send feedback`},{kind:`terminal`,label:`Answer in terminal`}]);function gL(e){return e===`approve`||e===`approve-accept-edits`}function _L(e){return(e.state===`decided`||e.state===`closed`)&&gL(e.lastDecision)}function vL(e,t){let n=e.reviews.find(e=>e.agentId===t);return n!==void 0&&_L(n)}function yL(e,t){return e.reviews.find(e=>e.agentId===t)??e.reviews[0]??null}function bL(e){let t=yL(e.state,e.selectedAgentId);return t?e.selectedRevision&&t.revisions.some(t=>t.revision===e.selectedRevision)?e.selectedRevision:t.revisions.at(-1)?.revision??null:null}function xL(e,t){return yL(e,t)?.openRevision?.revision??null}function SL(e,t,n){if(n===null)return null;let r=yL(e,t)?.revisions??[],i=r.findIndex(e=>e.revision===n);return i<=0?null:r[i-1].revision}function CL(e,t){let n=t-e;return Number.isFinite(n)?Gf(n,{rounding:`floor`,wording:`abbreviated`,suffix:` ago`,justNowBelowSeconds:60}):`just now`}function wL(e,t,n){return t!==null&&t.state===`open`&&t.openRevision!==null&&t.openRevision.revision===n&&e.body!==null&&e.isConnected&&e.isDraft!==!0&&!e.isDecisionInFlight}function TL(e,t,n){let r=wL(e,t,n),i=(e.pendingCommentCount??0)>0,a=e.hasUnsavedComment!==!0;return hL.map(({kind:e,label:t})=>({kind:e,label:t,enabled:r&&(e===`terminal`||a&&(e===`revise`?i:!i))}))}function EL(e,t){return e.openRevision===null?t!==null&&e.approvedRevision===t?`Approved`:e.state===`released`?`Answer in the terminal`:e.state===`decided`?e.lastDecision===`revise`?`Feedback sent, waiting for the next revision`:`Approved`:`Closed`:e.openRevision.revision===t?``:`Rev ${e.openRevision.revision} is the one open`}function DL(e){let t=0;for(let n of e.comments??[])t+=n.comment.trim().length+(n.heading?.length??0);return t}function OL(e){return new TextEncoder().encode(JSON.stringify(e)).byteLength+cd}function kL(e){let t=e.plan;if(t!==void 0&&t.length===0)return`the edited plan is empty, so nothing was sent`;if(t!==void 0&&new TextEncoder().encode(t).byteLength>524288)return`the edited plan is over the plan size cap, so nothing was sent`;let n=e.comments??[];return n.length>40?`more than 40 section comments are pending, so nothing was sent`:n.find(e=>e.comment.length>4e3||(e.heading?.length??0)>4e3)?`a section comment is over ${Rc} characters, so nothing was sent`:DL(e)>1e4?`the feedback composes more than the ${Bc} characters the hook reply carries, so nothing was sent`:OL(e)>ld?`the decision is larger than one control frame carries, so nothing was sent`:null}function AL(e){return e?`, ${e}`:``}function jL(e,t,n){if(!e.isConnected)return`Disconnected`;if(!t||n===null)return`No plan revision selected`;if(e.isDecisionInFlight)return`Sending your decision`;if(e.body===null)return`Loading`;if(e.isDraft===!0)return`Draft`;let r=EL(t,n);if(r)return r;if(e.hasUnsavedComment===!0)return`Save or cancel the open comment first.`;let i=e.pendingCommentCount??0;return i<=0?``:i===1?`1 comment to send. Remove it to approve.`:`${i} comments to send. Remove them to approve.`}function ML(e,t,n){let r=jL(e,t,n);return r?`${r}${AL(e.problem)}`:e.problem??``}function NL(e){let t=yL(e.state,e.selectedAgentId),n=bL(e);return{tabs:e.state.reviews.map(e=>({agentId:e.agentId,label:e.agentId===null?`Main`:e.agentType||`Agent`,selected:e===t})),revisions:(t?.revisions??[]).map(e=>({revision:e.revision,label:`Rev ${e.revision}`,isOpen:e.revision===t?.openRevision?.revision,receivedAt:e.receivedAt,selected:e.revision===n})),selectedAgentId:t?.agentId??null,selectedRevision:n,previousRevision:SL(e.state,t?.agentId??null,n),status:ML(e,t,n),actions:TL(e,t,n),modes:[{kind:`read`,label:`Read`,enabled:!0},{kind:`changes`,label:`Changes`,enabled:SL(e.state,t?.agentId??null,n)!==null&&e.isDraft!==!0},{kind:`edit`,label:`Edit`,enabled:wL(e,t,n)}]}}function PL(e,t){let n=e.reviews.findIndex(e=>e.agentId===t.agentId),r=[...(n===-1?null:e.reviews[n])?.revisions??[]],i=r.findIndex(e=>e.revision===t.revision),a={revision:t.revision,receivedAt:t.receivedAt,chars:t.chars,title:t.title};r[i===-1?r.length:i]=a,r.sort((e,t)=>e.revision-t.revision);let o={agentId:t.agentId,agentType:t.agentType,revisions:r,state:t.state,openRevision:t.state===`open`?{revision:t.revision,since:t.receivedAt}:null,approvedRevision:t.approvedRevision,lastDecision:t.lastDecision},s=[...e.reviews];return s[n===-1?s.length:n]=o,{reviews:s}}function FL({headingOffsets:e,scrollTop:t,isScrolledToEnd:n,readingLineOffset:r}){if(e.length===0)return null;if(n)return e.length-1;let i=t+r,a=0;for(let t=0;t<e.length&&!(e[t]>i);t++)a=t;return a}var IL=12,LL=8,RL=``,zL=48,BL=new Map;function VL(e,t){return JSON.stringify([e,t])}function HL(e){return e.id??RL}function UL(e,t){let n=BL.get(e);n||(n=new Map,BL.set(e,n));let r=VL(t.agentId,t.revision);for(n.delete(r),n.set(r,t.plan);n.size>IL;){let e=n.keys().next().value;if(typeof e!=`string`)break;n.delete(e)}}function WL(e){BL.delete(e)}function GL(e,t,n){return!e||n===null?null:BL.get(e)?.get(VL(t,n))??null}function KL(e){let t=V(`section`,`plan-face`);t.hidden=!0;let n=V(`header`,`plan-head`),r=V(`select`,`plan-heading-picker`);r.setAttribute(`aria-label`,`Plan section`);let i=V(`div`,`plan-view-panel`),a=V(`div`,`plan-sheet-head`),o=V(`button`,`plan-control plan-sheet-close`,`×`);o.type=`button`,o.setAttribute(`aria-label`,`Close`),a.append(V(`span`,null,`View`),o);let s=V(`div`,`plan-view-group plan-author-group`),c=V(`div`,`plan-tabs`);c.setAttribute(`role`,`tablist`),c.setAttribute(`aria-label`,`Plan author`),s.append(V(`span`,`plan-sheet-label`,`Author`),c);let l=V(`div`,`plan-view-group plan-revision-group`),u=V(`div`,`plan-revision-stepper`),d=V(`button`,`plan-control plan-revision-previous`,`‹`);d.type=`button`,d.setAttribute(`aria-label`,`Previous revision`);let f=V(`button`,`plan-control plan-revision-next`,`›`);f.type=`button`,f.setAttribute(`aria-label`,`Next revision`);let p=V(`span`,`plan-revision-label`),m=V(`span`,`plan-revision-age`);u.append(d,p,f,m);let h=V(`div`,`plan-revision-list`);h.setAttribute(`role`,`radiogroup`),h.setAttribute(`aria-label`,`Revision`),l.append(V(`span`,`plan-sheet-label`,`Revision`),u,h);let g=V(`div`,`plan-view-group plan-mode-group`),_=V(`div`,`plan-modes`);_.setAttribute(`role`,`radiogroup`),_.setAttribute(`aria-label`,`Show`),g.append(V(`span`,`plan-sheet-label`,`Show`),_);let v=V(`div`,`plan-head-spacer`),y=V(`div`,`plan-draft-notice`),ee=V(`span`,`plan-draft-dot`);ee.setAttribute(`aria-hidden`,`true`);let b=V(`button`,`plan-control plan-draft-chip`,`Peek draft`);b.type=`button`,y.append(ee,b),i.append(a,s,l,g,v,y);let te=V(`button`,`plan-control plan-view-button`,`View`);te.type=`button`,te.setAttribute(`aria-haspopup`,`dialog`),te.setAttribute(`aria-expanded`,`false`);let ne=V(`button`,`plan-control plan-minimize-button`,`Minimize`);ne.type=`button`,ne.addEventListener(`click`,e.showTerminal),n.append(r,i,te,ne);let re=V(`div`,`plan-sheet-backdrop`),ie=V(`div`,`plan-body-layout`),ae=V(`nav`,`plan-heading-rail`);ae.setAttribute(`aria-label`,`Plan sections`);let x=V(`article`,`plan-reading-column`);ie.append(ae,x);let oe=V(`textarea`,`plan-editor`);oe.setAttribute(`aria-label`,`Plan markdown`),oe.spellcheck=!1;let se=V(`footer`,`plan-action-bar`),ce=V(`span`,`plan-status`);ce.setAttribute(`role`,`status`);let le=V(`div`,`plan-decision-slot`),ue=V(`label`,`plan-accept-edits`),S=V(`input`,`plan-accept-edits-checkbox`);S.type=`checkbox`,ue.append(S,V(`span`,null,`Accept edits`)),le.append(ue,ce),se.append(le);let C=new Map;for(let[e,t]of[[`terminal`,`Answer in terminal`],[`revise`,`Send feedback`],[`approve`,`Approve`]]){let n=V(`button`,`plan-action`,t);n.type=`button`,n.dataset.decision=e,n.addEventListener(`click`,()=>{n.disabled||at(e)}),C.set(e,n),se.append(n)}t.append(n,ie,se,re);let w=null,de={reviews:[]},fe=null,pe=null,me=!0,he=``,ge=``,_e=``,ve=``,ye=!1,be=null,T=!1,xe=null,Se=!1,Ce=!1,we=null,Te=[],Ee=null,De=null,Oe=new Map,ke=new Map,Ae=new Map,je=[],Me=!1,Ne=null,Pe=!1;function Fe(e,t=!0){Pe=e,i.replaceChildren(...e?[a,g,l,s,y,v]:[a,s,l,g,v,y]),c.setAttribute(`role`,e?`radiogroup`:`tablist`);for(let t of c.querySelectorAll(`button`)){let n=t.getAttribute(`aria-selected`)===`true`||t.getAttribute(`aria-checked`)===`true`;t.setAttribute(`role`,e?`radio`:`tab`),t.removeAttribute(e?`aria-selected`:`aria-checked`),t.setAttribute(e?`aria-checked`:`aria-selected`,String(n))}i.dataset.open=String(e),re.dataset.open=String(e),te.setAttribute(`aria-expanded`,String(e)),ie.inert=e,se.inert=e,r.inert=e,te.inert=e,ne.inert=e,e?(i.setAttribute(`role`,`dialog`),i.setAttribute(`aria-label`,`Plan view`),i.setAttribute(`aria-modal`,`true`),o.focus()):(i.removeAttribute(`role`),i.removeAttribute(`aria-modal`),t&&te.focus())}function Ie(e){e.addEventListener(`keydown`,t=>{let n={ArrowLeft:-1,ArrowUp:-1,ArrowRight:1,ArrowDown:1}[t.key];if(n===void 0&&t.key!==`Home`&&t.key!==`End`)return;let r=[...e.querySelectorAll(`button:not(:disabled)`)];if(r.length===0)return;t.preventDefault();let i=(r.indexOf(document.activeElement)+(n??0)+r.length)%r.length;t.key===`Home`&&(i=0),t.key===`End`&&(i=r.length-1);let a=Pe;r[i].click(),!(a&&e!==_)&&(e===_||!Pe)&&e.querySelector(`[aria-checked="true"], [aria-selected="true"]`)?.focus()})}let Le=df.subscribe((e,t)=>{t.includes(`layout`)&&Pe&&Fe(!1,!1)});e.signal?.addEventListener(`abort`,Le,{once:!0}),Ie(_),Ie(c),Ie(h),te.addEventListener(`click`,()=>Fe(!Pe)),o.addEventListener(`click`,()=>Fe(!1)),re.addEventListener(`click`,()=>Fe(!1)),i.addEventListener(`keydown`,e=>{if(!Pe)return;if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),Fe(!1);return}if(e.key!==`Tab`)return;let t=[...i.querySelectorAll(`button:not(:disabled)`)].filter(e=>e.getClientRects().length>0&&e.tabIndex>=0),n=t[0],r=t.at(-1);e.shiftKey&&document.activeElement===n?(e.preventDefault(),r?.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n?.focus())});function Re(e){x.querySelector(`#${CSS.escape(e)}`)?.scrollIntoView({behavior:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?`instant`:`smooth`,block:`start`})}r.addEventListener(`change`,()=>Re(r.value));function ze(){Me=!1;let e=je.map(e=>x.querySelector(`#${CSS.escape(e.dataset.headingId??``)}`)).filter(e=>e!==null),t=x.getBoundingClientRect().top-x.scrollTop,n=FL({headingOffsets:e.map(e=>e.getBoundingClientRect().top-t),scrollTop:x.scrollTop,isScrolledToEnd:x.scrollTop>0&&x.scrollTop+x.clientHeight>=x.scrollHeight-2,readingLineOffset:zL}),i=n===null?null:e[n]?.id??null;for(let e of je)e.dataset.headingId===i?e.setAttribute(`aria-current`,`location`):e.removeAttribute(`aria-current`);i!==null&&(r.value=i)}function Be(){Me||t.hidden||je.length===0||(Me=!0,requestAnimationFrame(ze))}x.addEventListener(`scroll`,Be,{passive:!0});function Ve(){Ne=null,T=!1,Se=!1,Ce=!1,we=null}function He(t){Ee=t,e.reportProblem(t),kt()}function Ue(e){pe=e,Ee=null,Ve(),Fe(!1,Pe),kt()}function We(e){let t=de.reviews.find(e=>e.agentId===fe)?.revisions??[],n=t[t.findIndex(e=>e.revision===pe)+e];n&&Ue(n.revision)}d.addEventListener(`click`,()=>We(-1)),f.addEventListener(`click`,()=>We(1));function Ge(e,t){return`${w??``}:${e??`main`}:${t??`latest`}`}function Ke(){return Ge(fe,pe)}function qe(e,t,n){return`${e??``}:${VL(t,n??0)}`}function Je(){return qe(w,fe,pe)}function Ye(){return ke.get(Je())??null}function Xe(){return Ye()?.size??0}function Ze(){if(Ne===null)return!1;let e=ke.get(Ne.target.bucketKey)?.get(Ne.target.sectionSlot)??``;return Ne.field.value.trim()!==e}function Qe(e){let t=ke.get(e);if(!t)return[];let n=[];for(let e of Te){let r=t.get(HL(e));r&&n.push({heading:e.heading,comment:r})}return n}function $e(e,t){let n=t.trim(),r=ke.get(e.bucketKey)??new Map;ke.set(e.bucketKey,r),n.length===0&&r.delete(e.sectionSlot),n.length>0&&r.set(e.sectionSlot,n),r.size===0&&ke.delete(e.bucketKey),kt()}function et(e){if(Ce||ye)return;let t={bucketKey:Je(),sectionSlot:HL(e)},n=V(`div`,`plan-comment-composer`),r=V(`label`,`plan-comment-label`,`Comment on ${e.heading??`Introduction`}`),i=V(`textarea`,`plan-comment-input`);i.maxLength=Rc,i.value=ke.get(t.bucketKey)?.get(t.sectionSlot)??``,r.append(i);let a=V(`div`,`plan-comment-actions`),o=V(`button`,`plan-control plan-comment-cancel`,`Cancel`);o.type=`button`;let s=V(`button`,`plan-control plan-comment-save`,`Save comment`);s.type=`button`,a.append(o,s),n.append(r,a);let c={target:t,element:n,field:i};Ne=c,i.addEventListener(`input`,Ot),o.addEventListener(`click`,()=>{Ne===c&&(Ne=null,kt())}),s.addEventListener(`click`,()=>{Ne===c&&(Ne=null),$e(t,i.value)}),kt(),i.focus()}function tt(e){let t={bucketKey:Je(),sectionSlot:HL(e)};if(Ne?.target.bucketKey===t.bucketKey&&Ne.target.sectionSlot===t.sectionSlot)return Ne.element;let n=Ye()?.get(t.sectionSlot);if(!n)return null;let r=V(`div`,`plan-comment-card`),i=V(`div`,`plan-comment-head`),a=V(`button`,`plan-control plan-comment-edit`,`Edit`);a.type=`button`,a.addEventListener(`click`,()=>et(e));let o=V(`button`,`plan-control plan-comment-remove`,`Remove`);return o.type=`button`,o.disabled=ye,a.disabled=ye,o.addEventListener(`click`,()=>$e(t,``)),i.append(V(`span`,`plan-comment-label`,`Your comment`),a,o),r.append(i,V(`p`,`plan-comment-text`,n)),r}function nt(t,n,r={}){if(!w||n.revision===null||ye)return!1;let i=kL(r);if(i!==null)return He(i),!1;let a={agentId:n.agentId,revision:n.revision,decision:t,...r};return e.sendDecision(w,a)?(Ee=null,ye=!0,be=gL(t)?n:null,kt(),!0):!1}function rt(e){if(!T)return{};let t=oe.value;return t===GL(w,e.agentId,e.revision)?{}:{plan:t}}function it(e){let t=qe(w,e.agentId,e.revision),n=Qe(t);n.length!==0&&nt(`revise`,e,{comments:n})&&e.revision!==null&&(De={bucketKey:t,agentId:e.agentId,revision:e.revision},kt())}function at(e){let t={agentId:fe,revision:pe};e===`revise`?it(t):nt(e===`approve`&&!ue.hidden&&S.checked?`approve-accept-edits`:e,t,rt(t))}function ot(e){Ne=null,T=e===`edit`,Se=e===`changes`,T&&xe!==Je()&&(oe.value=GL(w,fe,pe)??``,xe=Je()),Ee=null,kt()}function st(e){return`${e.kind}:${Ge(e.agentId,e.revision)}`}function ct(e){for(Ae.set(st(e),e);Ae.size>LL;){let e=Ae.keys().next().value;if(typeof e!=`string`)break;Ae.delete(e)}}function E(e,t){return e.agentId===t.agentId?e.kind===`draft`?t.revision===0:t.revision===0?!1:e.revision===null||e.revision===t.revision:!1}function lt(e){for(let[t,n]of Ae)if(E(n,e))return Ae.delete(t),n;return null}function ut(){for(let[e,t]of Ae)if(t.kind===`draft`)return Ae.delete(e),t;return null}function dt(){if(Ae.size!==1)return null;let e=Ae.entries().next().value;return e?(Ae.delete(e[0]),e[1]):null}function ft(){if(!w)return;let t=Ke();he!==t&&e.requestPlan(w,fe,pe??void 0)&&(he=t,ct({kind:`selection`,agentId:fe,revision:pe}))}function pt(){t.hidden||ft()}function mt(){return SL(de,fe,pe)}function ht(t){if(!w)return;let n=Ge(fe,t);_e!==n&&e.requestPlan(w,fe,t)&&(_e=n,ct({kind:`diff-base`,agentId:fe,revision:t}))}function gt(){if(!w)return;let t=`${w}:${fe??`main`}`;ve!==t&&e.requestDraft(w,fe)&&(ve=t,ct({kind:`draft`,agentId:fe,revision:null}))}function _t(e,t){return`${e??``}:${t??``}`}function vt(){return de.reviews.find(e=>e.agentId===fe)?.revisions.find(e=>e.revision===pe)?.receivedAt??0}function yt(){let e=Oe.get(_t(w,fe));return e!==void 0&&e>vt()}function bt(){Ce?(Ve(),kt()):(Ne=null,T=!1,Se=!1,gt(),kt())}b.addEventListener(`click`,bt);function xt(e){ae.replaceChildren(),r.replaceChildren(),je=[];for(let t of e){let e=t.id??`plan-introduction`,n=t.heading??`Introduction`,i=V(`button`,`plan-heading-link`,n);i.type=`button`,i.dataset.level=String(t.level),i.dataset.headingId=e,i.title=n,i.dataset.commented=String(Ye()?.has(HL(t))===!0),je.push(i),i.addEventListener(`click`,()=>Re(e)),ae.append(i);let a=V(`option`,null,n);a.value=e,r.append(a)}}function St(e){let t=mt();if(t===null){x.append(V(`p`,`plan-loading`,`This is the first revision, so there is nothing to diff`));return}let n=GL(w,fe,t);if(n===null){x.append(V(`p`,`plan-loading`,`Loading the previous revision`)),ht(t);return}let r=mL(n,e);r.isTooLarge?(x.append(V(`p`,`plan-loading`,`This diff is too large to show, so the newer revision stands alone`)),x.append(VF(IF(e)))):x.append(WF(r))}function Ct(e){if(x.replaceChildren(),T){xt(Te),x.append(oe);return}if(e===null){if(Te=[],xt(Te),ge===Ke()){x.append(V(`p`,`plan-loading`,`This plan revision could not be loaded`));return}x.append(V(`p`,`plan-loading`,`Loading plan`)),ft();return}let t=IF(e);if(Te=LF(t),xt(Te),Se){St(e);return}if(Ce){x.append(VF(t));return}let n=Ye();x.append(HF(Te,{hasComment:e=>n?.has(HL(e))===!0,isComposing:e=>Ne?.target.bucketKey===Je()&&Ne.target.sectionSlot===HL(e),onComment:et,attachmentFor:tt}))}function wt(e){s.hidden=e.tabs.length<2,c.replaceChildren();for(let t of e.tabs){let e=V(`button`,`plan-tab`,t.label);e.type=`button`,e.setAttribute(`role`,Pe?`radio`:`tab`),e.setAttribute(Pe?`aria-checked`:`aria-selected`,String(t.selected)),e.tabIndex=t.selected?0:-1,e.addEventListener(`click`,()=>{fe=t.agentId,pe=null,Ee=null,he=``,ge=``,_e=``,ve=``,Ve(),Fe(!1,Pe),kt()}),c.append(e)}}function Tt(){return Ce?we:GL(w,fe,pe)}function Et(e){return NL({state:de,selectedAgentId:fe,selectedRevision:pe,body:e,isConnected:me,isDecisionInFlight:ye,isDraft:Ce,pendingCommentCount:Xe(),hasUnsavedComment:Ze(),problem:Ee})}function Dt(e){ce.textContent=e.status,ce.hidden=e.status.length===0;let t=e.actions.some(e=>e.kind===`approve`&&e.enabled);ue.hidden=!t,S.disabled=!t;for(let t of e.actions){let e=C.get(t.kind);e&&(e.disabled=!t.enabled)}}function Ot(){Dt(Et(Tt()))}function kt(){let e=Pe&&i.contains(document.activeElement),t=NL({state:de,selectedAgentId:fe,selectedRevision:pe,body:null,isConnected:me});(fe!==t.selectedAgentId||pe!==t.selectedRevision)&&Ve(),fe=t.selectedAgentId,pe=t.selectedRevision,xe!==Je()&&(xe=null);let n=Tt(),a=Et(n);wt(a);let s=a.revisions.findIndex(e=>e.selected),c=a.revisions[s],l=Date.now();u.hidden=a.revisions.length<2,p.textContent=`Rev ${s+1} of ${a.revisions.length}`,m.textContent=c?CL(c.receivedAt,l):``,d.disabled=s<=0,f.disabled=s<0||s>=a.revisions.length-1,h.replaceChildren();for(let e of[...a.revisions].reverse()){let t=V(`button`,`plan-revision-option`);t.type=`button`,t.dataset.revision=String(e.revision),t.setAttribute(`role`,`radio`),t.setAttribute(`aria-checked`,String(e.selected)),t.tabIndex=e.selected?0:-1,t.append(V(`span`,`plan-revision-name`,e.label),V(`span`,`plan-revision-age`,CL(e.receivedAt,l))),e.isOpen&&t.append(V(`span`,`plan-revision-open`,`OPEN`)),t.addEventListener(`click`,()=>Ue(e.revision)),h.append(t)}_.replaceChildren();let g=T?`edit`:Se?`changes`:`read`,v=a.modes.find(e=>e.kind===g&&e.enabled)??a.modes[0];for(let e of a.modes){let t=V(`button`,`plan-control plan-mode`,e.label);t.type=`button`,t.dataset.mode=e.kind,t.disabled=!e.enabled,t.setAttribute(`role`,`radio`),t.setAttribute(`aria-checked`,String(e.kind===g)),t.tabIndex=e.kind===v.kind?0:-1,t.addEventListener(`click`,()=>{t.disabled||(ot(e.kind),_.querySelector(`[aria-checked="true"]`)?.focus())}),_.append(t)}y.hidden=!yt()&&!Ce,b.hidden=y.hidden,b.setAttribute(`aria-pressed`,String(Ce)),Dt(a),Ct(n),r.disabled=je.length===0,Be(),e&&!i.contains(document.activeElement)&&o.focus()}function At(t){be!==null&&vL(t,be.agentId)&&(be=null,xe=null,e.showTerminal())}function jt(e){Ne=null,e!==w&&(be=null,ye=!1,Ee=null,Ae.clear()),Fe(!1,!1),w=e,t.hidden=!1,he=``,ge=``,kt(),pt()}function Mt(){Ne=null,Fe(!1,!1),t.hidden=!0}function Nt(e,t){return t.kind!==`selection`||e.agentId!==fe?!1:t.revision===null?pe===null||pe===e.revision:t.revision===pe}function Pt(e){e.kind===`draft`?(ve=``,He(`the draft could not be read, so nothing was shown`)):e.kind===`diff-base`?_e=``:ge=Ge(e.agentId,e.revision)}function Ft(e){De!==null&&xL(e,De.agentId)!==De.revision&&(ke.delete(De.bucketKey),De=null)}function It(e){ye=!1,Lt({reviews:e.reviews});let t=e.body;if(!t){let e=dt()??ut();e!==null&&Pt(e);return}let n=lt(t);if(t.revision===0){if(ve=``,n===null||t.agentId!==fe)return;we=t.plan,Ce=!0}else UL(e.id,t),n!==null&&Nt(t,n)&&(fe=t.agentId,pe=t.revision,he=``,ge=``)}function Lt(e){let t=xL(e,fe);t!==null&&t!==xL(de,fe)&&(pe=t,Ve()),Ft(e),de=e,ye=!1,At(e)}function Rt(e){let n=!1;e.state&&Lt(e.state),e.draft&&Oe.set(_t(e.draft.id,e.draft.agentId),e.draft.changedAt),e.decisionRefused&&(be=null,ye=!1,De=null),typeof e.isConnected==`boolean`&&(n=e.isConnected&&!me,me=e.isConnected,n&&(he=``,ge=``,_e=``,ve=``,ye=!1)),e.requestFailed&&(ge=he),e.response&&It(e.response),t.hidden||kt(),(n||e.decisionRefused)&&pt()}return{el:t,show:jt,hide:Mt,update:Rt}}var qL=`#plan/`;function JL(e){return`${qL}${encodeURIComponent(e)}`}function YL(e){if(!e.startsWith(qL))return null;let t=e.slice(6);if(!t||t.includes(`/`))return null;try{return decodeURIComponent(t)||null}catch{return null}}var XL=`http://www.w3.org/2000/svg`;function ZL(e,t){let n=document.createElementNS(XL,e);for(let[e,r]of Object.entries(t))n.setAttribute(e,r);return n}function QL(e,t){let n=document.createElementNS(XL,`svg`);return n.setAttribute(`width`,String(e)),n.setAttribute(`height`,String(t)),n.setAttribute(`viewBox`,`0 0 ${e} ${t}`),n.setAttribute(`aria-hidden`,`true`),n}function $L(e){let t=new Map;for(let n of e.files){let e=n.path.split(`/`);for(let r=0;r<e.length;r++){let i=e.slice(0,r).join(`/`),a=t.get(i);a!==void 0&&a.localeCompare(n.path)<=0||t.set(i,n.path)}}return t}function eR(e,t){let n=[],r=new Set(e.files.map(e=>e.path));for(let i of e.links){let a=t.get(i.providerRepo),o=a?.firstChangedPathByDirectory.get(i.packageDir),s=o??i.importers.find(e=>r.has(e))??i.importers[0]??i.consumerManifest,c=o&&a?a.repo:e,l=i.importerCount===1?`file`:`files`,u=i.providerChangedPathCount===1?`file`:`files`,d=i.changedImporterCount===1?`file`:`files`,f=i.isLocalLink?`Linked locally (${i.versionSpec}), so ${i.providerRepo} changes reach it now.`:`Uses ${i.versionSpec} from the registry, so ${i.providerRepo} changes reach it only after a publish.`;i.providerChangedPathCount>0&&(f+=` ${i.providerRepo} changed ${i.providerChangedPathCount} ${u} in ${i.packageDir||`the repository root`}.`),i.changedImporterCount>0&&(f+=` ${i.changedImporterCount} importing ${d} changed here.`),n.push({factId:i.factId,kind:`link`,severity:6,path:s,openPath:`${c.sessionPathPrefix}${s}`,headline:`${e.name} imports ${i.packageName} from ${i.providerRepo} in ${i.importerCount} ${l}`,detail:f})}for(let t of e.collisions)n.push({factId:t.factId,kind:`collision`,severity:5,path:t.path,openPath:`${e.sessionPathPrefix}${t.path}`,headline:`${t.path} is also changed in "${t.otherSessionName}"`,detail:`Another live session is changing this file.`});for(let t of e.coChangeGaps){let r=t.confidence>0?Math.round(t.support/t.confidence):0;n.push({factId:t.factId,kind:`co-change`,severity:4,path:t.path,openPath:`${e.sessionPathPrefix}${t.path}`,headline:`Usually changes with ${t.partner} (${t.support} of ${r} commits)`,detail:`${t.partner} is absent from these changes.`})}for(let t of e.untestedFiles)n.push({factId:t.factId,kind:`untested`,severity:3,path:t.path,openPath:`${e.sessionPathPrefix}${t.path}`,headline:`No test reaches ${t.path}`,detail:`No dependent test was found in the import graph.`});for(let t of e.hotspots)n.push({factId:t.factId,kind:`hotspot`,severity:2,path:t.path,openPath:`${e.sessionPathPrefix}${t.path}`,headline:`${t.path} is a hotspot`,detail:`${t.fixCommitCount} of its last ${t.commitCount} commits were fixes.`});for(let t of e.blastRadius)t.transitiveDependentCount<10||n.push({factId:t.factId,kind:`blast`,severity:1,path:t.path,openPath:`${e.sessionPathPrefix}${t.path}`,headline:`Wide blast radius: ${t.transitiveDependentCount} files depend on ${t.path}`,detail:`${t.directDependentCount} direct dependents; ${t.dependentTestCount} dependent tests.`});return n.sort((e,t)=>t.severity-e.severity||e.path.localeCompare(t.path)||e.factId.localeCompare(t.factId))}function tR(e,t){let n=new Map(e.blastRadius.map(e=>[e.path,e])),r=e.files.filter(e=>e.isCommitted).length;return{header:{name:e.name,fileCount:e.files.length,committedCount:r,uncommittedCount:e.files.length-r,base:e.base},subsystems:e.subsystems.map(e=>({title:e.title,fileCount:e.paths.length})),warnings:eR(e,t),files:e.files.map(t=>({path:t.path,openPath:`${e.sessionPathPrefix}${t.path}`,status:t.status,isCommitted:t.isCommitted,dependentCount:n.get(t.path)?.transitiveDependentCount??0,testCount:n.get(t.path)?.dependentTestCount??0})),error:e.error}}function nR(e){let t=new Set(e.repos.flatMap(e=>e.links.map(e=>e.providerRepo))),n=new Map;for(let r of e.repos)t.has(r.name)&&!n.has(r.name)&&n.set(r.name,{repo:r,firstChangedPathByDirectory:$L(r)});let r=e.repos.map(e=>tR(e,n));return{repos:!e.error&&r.every(e=>e.header.fileCount===0&&e.warnings.length===0&&!e.error)?[]:r,narrative:{state:e.narratorState,claims:e.narratorState===`ready`?e.narrative?.claims.map(e=>({text:e.text,factIds:e.factIds}))??[]:[],status:{disabled:null,pending:`Narrative is being prepared.`,ready:null,failed:`Narrative could not be prepared.`}[e.narratorState]},error:e.error??null}}function rR(e,t,n,r){let i=V(`button`,n);return i.type=`button`,i.title=`Open ${e} in the diff`,i.addEventListener(`click`,()=>r(t)),i}function iR(e,t){let n=V(`section`,`review-map-repo`),r=V(`div`,`review-map-repo-head`);r.append(V(`strong`,`review-map-repo-name`,e.header.name)),n.append(r);let i=V(`div`,`review-map-summary`);if(i.append(V(`span`,``,`${e.header.committedCount} committed`)),i.append(V(`span`,``,`${e.header.uncommittedCount} uncommitted`)),i.append(V(`span`,``,`Base: ${ol(e.header.base,{chars:8})||`unknown`}`)),n.append(i),e.error&&n.append(V(`p`,`review-map-error`,e.error)),e.subsystems.length>0){let t=V(`div`,`review-map-subsystems`);for(let n of e.subsystems)t.append(V(`span`,`review-map-chip`,`${n.title} (${n.fileCount})`));n.append(t)}if(e.warnings.length>0){n.append(V(`h3`,`review-map-label`,`Signals`));let r=V(`div`,`review-map-warnings`);for(let n of e.warnings){let e=rR(n.path,n.openPath,`review-map-warning`,t);e.dataset.severity=String(n.severity),e.dataset.kind=n.kind,e.append(V(`span`,`review-map-warning-headline`,n.headline)),e.append(V(`span`,`review-map-detail`,n.detail)),r.append(e)}n.append(r)}if(e.files.length>0){n.append(V(`h3`,`review-map-label`,`Files`));let r=V(`div`,`review-map-files`);for(let n of e.files){let e=rR(n.path,n.openPath,`review-map-file`,t);e.dataset.status=n.status,e.append(V(`span`,`review-map-file-path`,n.path)),e.append(V(`span`,`review-map-file-meta`,`${n.status} · ${n.isCommitted?`committed`:`uncommitted`} · ${n.dependentCount} dependents · ${n.testCount} tests`)),r.append(e)}n.append(r)}return n}function aR(e,t){let n=V(`div`,`review-map`);if(e.error&&n.append(V(`p`,`review-map-error`,e.error)),e.narrative.status&&n.append(V(`p`,`review-map-narrative-status`,e.narrative.status)),e.narrative.claims.length>0){let t=V(`section`,`review-map-narrative`);t.append(V(`h3`,`review-map-label`,`Narrative`));for(let n of e.narrative.claims){let e=V(`p`,`review-map-claim`,n.text);e.dataset.factIds=n.factIds.join(` `),t.append(e)}n.append(t)}for(let r of e.repos)n.append(iR(r,t));return n}function oR({status:e,mergeReason:t,fetched:n,hasDiffError:r,hasChanges:i,hasCommits:a,canMerge:o,isWorkspace:s,live:c,effectiveBase:l}){return e===`parked`&&t===`base-diverged`?{text:`Parked: base branch diverged`,namesMergeTarget:!1}:e===`parked`?{text:`Parked: merge conflict`,namesMergeTarget:!1}:e===`merging`?{text:`Merging`,namesMergeTarget:!1}:e===`merged`?{text:`Merged`,namesMergeTarget:!1}:r?{text:`Could not read changes`,namesMergeTarget:!1}:n?i?s?{text:`Changes in this worktree`,namesMergeTarget:!1}:o?{text:`Ready to merge into ${lR(l)}`,namesMergeTarget:!0}:c?a?{text:`Not ready to merge`,namesMergeTarget:!1}:{text:`Uncommitted changes`,namesMergeTarget:!1}:{text:`Session ended`,namesMergeTarget:!1}:{text:`No changes yet`,namesMergeTarget:!1}:{text:`Checking for changes`,namesMergeTarget:!1}}function sR(e,t){return e.namesMergeTarget?null:`merges into ${lR(t)}`}function cR({status:e,mergeReason:t,live:n,isMergeRendered:r,hasChanges:i}){return e===`parked`&&n&&t!==`base-diverged`?`resolve`:!i&&e!==`parked`&&e!==`merging`?`none`:r?`merge`:`none`}function lR(e){return e||`base`}function uR(e,t){return`Merge into ${lR(e)}, push it, and rebase this worktree, then keep working (${t})`}function dR(e){return e===`base-diverged`?`Resync the base branch by hand, then Merge again.`:`Needs manual merge`}function fR(e,t,n){let r=e!==`parked`||e===`parked`&&t===`base-diverged`;return{isRendered:r,isEnabled:r&&e!==`merging`&&n}}function pR({status:e,hasCommits:t,live:n,state:r}){return e===`merging`||!t?null:!n&&(e===`parked`||e===`merged`)?`Session ended.`:!n||e===`parked`?null:r===`INITIALIZING`||r===`STARTING`?`Starting up. Mergeable once the session is live.`:null}function mR({fetched:e,changedFileCount:t,hasCommits:n}){return!e||t>0||n}function hR(e){return e||`its upstream`}function gR(e){if(!e)return null;let t=e.branch||`Base branch`,{state:n,ahead:r,behind:i}=e,a=hR(e.upstream);return n===`no-upstream`?`${t}: no upstream`:n===`unknown`&&e.error&&e.action===void 0?`${t}: sync check failed: ${e.error}`:n===`unknown`?`${t}: sync state unknown vs ${a}`:n===`in-sync`?`${t}: in sync with ${a}`:n===`ahead`?`${t}: ${r} ahead of ${a}`:n===`behind`?`${t}: ${i} behind ${a}`:n===`diverged`?`${t}: ${r} ahead, ${i} behind ${a}`:null}function _R(e){return!e||e.fetched===!1?`recheck`:e.state===`ahead`||e.state===`behind`?`resync`:`recheck`}function vR(e,t,n){let r=n?` (${t})`:``;if(!e||_R(e)===`recheck`)return`Click to fetch and check again${r}`;let i=e.branch||`Base branch`,a=hR(e.upstream);return e.state===`behind`?`Click to fast-forward ${i} to ${a}${r}`:`Click to push ${i} to ${a}${r}`}function yR(e){return e?.state!==`in-sync`||e.fetched===!1}function bR({fetched:e,changedFileCount:t,view:n}){return!e||t===0?!1:n!==`diff`}function xR(e){if(e.error)return`Resync failed: ${e.error}`;let t=e.branch||`The base branch`,n=hR(e.upstream);return e.action===`fast-forwarded`?`Fast-forwarded ${t} to ${n}.`:e.action===`pushed`?`Pushed ${t} to ${n}.`:e.state===`diverged`?`${t} has diverged from ${n}. Resolve manually.`:e.state===`in-sync`?null:e.state===`no-upstream`?`${t} has no upstream to resync against.`:`Could not determine sync status.`}var SR=new Set([`pending-review`,`parked`]),CR=600,wR=ub(`merge`,db),TR=ub(`resolve-or-resync`,db),ER=260,DR=700,OR=new Map,kR=new Map,AR=new Map,jR=new Map,MR=new Map,NR=new Map,PR=new Set,FR=new Set,IR=new Set,LR=UD(),RR=null,zR=null,BR=null,VR=null,HR=new Map,UR=null,WR=null,GR=null,KR=null,qR=null,JR=!1,YR=!1,XR=null,ZR=null,QR=null,$R=null,ez=new Map,tz=null,nz=null,rz=null,iz=null,az=null,oz=new Map,sz=null,cz=!1,lz=null;function uz(e,t){let n=V(`button`,`review-icon-button`);n.type=`button`,n.title=e,n.setAttribute(`aria-label`,e);let r=QL(16,16);return r.append(ZL(`path`,{d:t,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`})),n.append(r),n}function dz(){JR=!1,BR?.querySelector(`.review-more-menu`)?.remove(),BR?.querySelector(`.review-more-button`)?.setAttribute(`aria-expanded`,`false`)}function fz({panel:e}){if(zR=e,!zR)return;let t=zR,n=V(`div`,`review-sidebar-head`),r=V(`span`,`review-sidebar-title`,`Review`),i=e=>{t.toggleAttribute(`data-collapsed`,e),HD(!e)},a=V(`div`,`review-header-tabs`);a.setAttribute(`role`,`group`),a.setAttribute(`aria-label`,`Review view`);for(let[e,t]of[[`map`,`Map`],[`diff`,`Diff`],[`notes`,`Notes`]]){let n=V(`button`,`review-header-tab`,t);n.type=`button`,n.addEventListener(`click`,()=>dB(e)),HR.set(e,n),a.append(n)}UR=V(`span`,`review-notes-count`),a.append(UR);let o=uz(`Close review`,`M6 3L11 8L6 13`);o.classList.add(`review-sidebar-close`),o.addEventListener(`click`,()=>i(!0)),n.append(r,a,o);let s=V(`div`,`review-sidebar-rail`),c=uz(`Open review`,`M10 3L5 8L10 13`);c.classList.add(`review-sidebar-open`),c.addEventListener(`click`,()=>i(!1)),GR=V(`div`,`review-rail-status`),KR=V(`span`,`review-rail-added`),qR=V(`span`,`review-rail-removed`),GR.append(KR,qR),WR=V(`span`,`review-rail-label`,`Review`),s.append(c,WR,GR),BR=V(`div`,`review-controls`),VR=V(`div`,`review-sidebar-body`),tz=V(`div`,`review-notes-footer`),nz=V(`button`,`review-btn review-btn-primary`,`Send notes`),nz.type=`button`,nz.title=`Paste the drafted review notes into this session as one message`,nz.addEventListener(`click`,Zz),rz=V(`div`,`review-notes-status`),tz.append(rz,nz),az=V(`div`,`review-notes-list`),iz=V(`div`,`review-notes-outcome`),iz.setAttribute(`role`,`status`);let l=V(`div`,`review-resize-handle`);l.setAttribute(`aria-hidden`,`true`),t.append(s,n,BR,VR,iz,tz,l),t.toggleAttribute(`data-collapsed`,!VD()),document.addEventListener(`keydown`,e=>{e.key===`Escape`&&JR&&(e.preventDefault(),dz(),BR?.querySelector(`.review-more-button`)?.focus())}),document.addEventListener(`pointerdown`,e=>{JR&&e.target instanceof Element&&(BR?.contains(e.target)&&e.target.closest(`.review-more-button, .review-more-menu`)||dz())});let u=0,d=0,f=e=>{let n=Math.max(ER,Math.min(DR,e));return Number.isFinite(n)?(t.style.setProperty(`--sidebar-width`,`${n}px`),n):null},p=e=>{l.hasPointerCapture(e.pointerId)&&f(d+(u-e.clientX))},m=!1,h=e=>{if(!m)return;m=!1,l.hasPointerCapture(e.pointerId)&&l.releasePointerCapture(e.pointerId),document.documentElement.style.cursor=``,document.documentElement.style.userSelect=``;let n=t.style.getPropertyValue(`--sidebar-width`);n&&gO(parseInt(n,10))};l.addEventListener(`pointerdown`,e=>{e.button===0&&(e.preventDefault(),u=e.clientX,d=t.getBoundingClientRect().width,l.setPointerCapture(e.pointerId),m=!0,document.documentElement.style.cursor=`col-resize`,document.documentElement.style.userSelect=`none`)}),l.addEventListener(`pointermove`,p),l.addEventListener(`pointerup`,h),l.addEventListener(`pointercancel`,h),l.addEventListener(`lostpointercapture`,h);let g=hO();g!==null&&f(g),AI(e=>{JR=!1,FR.clear(),IR.clear(),RR=null,Wz(),e&&Fz(e),e&&!Lz(e)&&Rz(e),hB()}),hB()}function pz(e){zR&&(e?tf(zR,e):nf(zR))}function mz(e,t){let n=OR.get(e);OR.set(e,t),xk(n,t)&&(AR.delete(e),jR.delete(e),MR.delete(e),e===OI()&&Iz(e)),e===OI()&&hB()}function hz(e,t,n=null){let r=OR.get(e)||`none`,i=t||`none`;if(kR.set(e,n),mz(e,i),SR.has(i)&&!SR.has(r)){let t=OI(),n=t?SR.has(OR.get(t)||`none`):!1;(!t||!U.has(t)||!n)&&kI(e)}}function gz(e,t,n=null){kR.set(e,n),mz(e,t||`none`)}function _z(e,t){let n=AR.get(e)??null;AR.set(e,t),jR.delete(e),e===OI()&&(xz(n,t),RR&&fB(RR,t),hB(),pB())}function vz(e,t){let n=xf(e);n&&(jR.set(n,t),n===OI()&&hB())}function yz(e,t){let n=xf(e);if(!n)return;let r=el.safeParse(t);r.success&&r.data.sessionId===n&&(MR.set(n,r.data),n===OI()&&hB())}function bz(e){return{committed:e?.committed?.diff||``,uncommitted:e?.uncommitted?.diff||``}}function xz(e,t){if(oz.size===0||!e)return;let n=yk(bz(e),bz(t),oz.keys());if(n.length!==0){for(let e of n)oz.delete(e);sz!==null&&n.includes(sz)&&(sz=null),lz=`${n.length} note${n.length===1?``:`s`} dropped because the diff changed.`}}function Sz(e,t){let n=xf(e),r=t;NR.set(n,r),r&&r.action!==void 0&&Cz(n,r),n===OI()&&hB()}function Cz(e,t){PR.delete(e),clearTimeout($R??void 0),$R=null;let n=xR(t);QR=n?{forId:e,text:n,isError:!!t.error}:null,QR&&!QR.isError&&($R=setTimeout(()=>{QR&&QR.forId===e&&(QR=null),hB()},5e3))}function wz(e){let t=xf(e);t&&t===OI()&&Fz(t)}function Tz(e){let t=xf(e);if(t!==OI())return;let n=!AR.has(t)||jR.has(t),r=!MR.has(t)||Ez(MR.get(t));n&&Fz(t),r&&!n&&Iz(t),hB()}function Ez(e){return e?!!e.error||e.repos.some(e=>e.error!==null):!1}function Dz(e){let t=xf(e);OR.delete(t),kR.delete(t),AR.delete(t),jR.delete(t),MR.delete(t),NR.delete(t),PR.delete(t),QR&&QR.forId===t&&(clearTimeout($R??void 0),QR=null),t===OI()?kI(null):hB()}function Oz(){let e=OI();if(!e||Lz(e))return!1;let t=U.get(e);if(!t)return!1;let n=OR.get(e)||`none`,r=!!AR.get(e)?.hasCommits,i=fR(n,kR.get(e)||null,Mz(t.currentState,r));return cR({status:n,mergeReason:kR.get(e)||null,live:Pz(t.currentState),isMergeRendered:i.isRendered,hasChanges:jz(e)})!==`merge`||!i.isEnabled?!1:(Nz(e,t.currentState),!0)}function kz(){let e=OI();if(!e||Lz(e))return!1;let t=U.get(e);if(!t)return!1;let n=OR.get(e)||`none`,r=kR.get(e)||null;return cR({status:n,mergeReason:r,live:Pz(t.currentState),isMergeRendered:fR(n,r,!1).isRendered,hasChanges:jz(e)})===`resolve`&&(B({type:`resolve-session-merge`,id:e}),!0)}function Az(){let e=OI();return!e||!U.has(e)||Lz(e)||Bz(e)?!1:(Vz(e),!0)}function jz(e){let t=AR.get(e)??null,n=[..._k(t?.committed?.diff||``),..._k(t?.uncommitted?.diff||``)];return mR({fetched:AR.has(e),changedFileCount:Sk(n).files,hasCommits:!!t?.hasCommits})}function Mz(e,t){return(Ys.includes(e)||e===F.RUNNING)&&t}function Nz(e,t){t===F.RUNNING?kf({title:`Merge while working`,message:`This session still looks like it is working. Merging rebases its worktree under it. Merge anyway?`,confirmLabel:`Merge anyway`,onConfirm:()=>B({type:`merge-continue-session`,id:e,force:!0})}):B({type:`merge-continue-session`,id:e})}function Pz(e){return e!==F.DORMANT&&e!==F.DONE&&e!==F.FAILED}function Fz(e){B({type:`request-session-diff`,id:e}),Iz(e)}function Iz(e){MR.has(e)||MR.set(e,null),B({type:`request-change-map`,id:e})}function Lz(e){return U.get(e)?.card.dataset.workspace!==void 0}function Rz(e){NR.set(e,null),B({type:`request-branch-sync`,id:e}),e===OI()&&hB()}function zz(e){PR.add(e),clearTimeout($R??void 0),QR&&QR.forId===e&&(QR=null),B({type:`resync-branch`,id:e}),e===OI()&&hB()}function Bz(e){return PR.has(e)||NR.get(e)===null}function Vz(e){Bz(e)||(_R(NR.get(e))===`resync`?zz(e):Rz(e))}function Hz(e,t){return t?{text:`Resyncing...`,loading:!0,error:!1}:QR&&QR.forId===e?{text:QR.text,loading:!1,error:QR.isError}:null}function Uz(e,t){return e?.card?.dataset.session||t}function Wz(){oz.clear(),sz=null,lz=null,cz=!1}function Gz(e){return oz.get(e)??null}function Kz(){return`${oz.size} note${oz.size===1?``:`s`} drafted`}function qz(e,t){let n=V(`div`,`review-notes-entry`),r=t.side===`old`?` (removed line)`:``;n.append(V(`span`,`review-notes-entry-where`,`${t.section} ${t.path}:${t.line}${r}`)),n.append(V(`span`,`review-notes-entry-note`,t.note));let i=V(`button`,`review-note-remove`,`Remove`);return i.type=`button`,i.title=`Drop this note`,i.addEventListener(`click`,()=>uB(e)),n.append(i),n}function Jz(){if(az){az.replaceChildren(),az.hidden=oz.size===0;for(let[e,t]of oz)az.append(qz(e,t))}}function Yz(){if(!tz||!nz||!rz)return;let e=OI(),t=!!e&&U.has(e);tz.hidden=!t||LR===`map`||oz.size===0,nz.disabled=cz||oz.size===0,rz.textContent=Kz(),UR&&(UR.hidden=oz.size===0,UR.textContent=String(oz.size),UR.setAttribute(`aria-label`,Kz())),iz&&(iz.textContent=cz?`Sending notes...`:lz,iz.hidden=!t||LR===`map`||!iz.textContent),Jz(),LR===`notes`&&t&&Xz()}function Xz(){VR&&az&&(VR.replaceChildren(),oz.size===0?gB(`No notes yet`,`Open the Diff tab and press note on a line to draft one.`):VR.append(az))}function Zz(){let e=OI();e&&!cz&&oz.size!==0&&(cz=!0,lz=null,Yz(),Nd(`send-diff-annotations`,{id:e,annotations:[...oz.values()]}).then(eB,Qz))}function Qz(e){cz=!1;let t=e instanceof Error?e.message:``;lz=t?`Could not send the notes: ${t}.`:`Could not send the notes.`,Yz()}function $z(e){return e.type===`send-diff-annotations-result`&&typeof e.error==`string`&&e.error?e.error:e.type===`error`&&typeof e.message==`string`&&e.message?e.message:`Could not send the notes.`}function eB(e){cz=!1,e.type!==`send-diff-annotations-result`||e.ok!==!0?(lz=$z(e),Yz()):e.pending===!0?(lz=`Notes queued until the session wakes. They stay drafted here, and pressing Send notes again re-sends them.`,Yz()):(lz=`Notes sent.`,oz.clear(),sz=null,hB())}function tB(e,t){let n=V(`div`,`review-note`);n.dataset.noteFor=e,n.append(V(`span`,`review-note-text`,t));let r=V(`button`,`review-note-remove`,`Remove`);return r.type=`button`,r.title=`Drop this note`,r.addEventListener(`click`,()=>uB(e)),n.append(r),n}function nB(e,t){let n=V(`div`,`review-note-editor`);n.dataset.editorFor=e;let r=V(`input`,`review-note-input`);r.type=`text`,r.value=t,r.maxLength=ad,r.placeholder=`Note for this line`,r.addEventListener(`keydown`,t=>{t.key===`Enter`?(t.preventDefault(),lB(e,r.value)):t.key===`Escape`&&(t.preventDefault(),cB())});let i=V(`button`,`review-note-save`,`Save`);i.type=`button`,i.addEventListener(`click`,()=>lB(e,r.value));let a=V(`button`,`review-note-cancel`,`Cancel`);return a.type=`button`,a.addEventListener(`click`,cB),n.append(r,i,a),n}function rB(e){let t=[],n=Gz(e);return sz===e&&t.push(nB(e,n?n.note:``)),n&&t.push(tB(e,n.note)),t}function iB(e,t){let n=rB(t);return e.after(...n),n}function aB(e){let t=e.nextElementSibling;for(;t instanceof HTMLElement&&(t.dataset.noteFor!==void 0||t.dataset.editorFor!==void 0);){let e=t.nextElementSibling;t.remove(),t=e}}function oB(e){let t=ez.get(e);if(!t)return;let n=null;for(let r of t.rows){aB(r);let t=iB(r,e);for(let e of t){let t=e.querySelector(`input`);!n&&t instanceof HTMLInputElement&&(n=t)}}n&&(n.focus(),n.select())}function sB(e){let t=sz;sz=e,t&&t!==e&&oB(t),oB(e)}function cB(){let e=sz;e&&(sz=null,oB(e))}function lB(e,t){let n=ez.get(e);if(!n)return;let r=t.trim();r&&(oz.size>=50&&!oz.has(e)?(lz=`Only 50 notes can be sent at once.`,Yz()):(oz.set(e,{...n.target,section:n.section,note:r}),lz=null,sz=null,oB(e),Yz()))}function uB(e){oz.delete(e),lz=null,oB(e),Yz()}function dB(e){LR=e,e!==`diff`&&(RR=null),WD(e),hB()}function fB(e,t){if(!t)return;let n=_k(t.committed?.diff),r=_k(t.uncommitted?.diff);for(let t of n)(t.path===e||t.oldPath===e)&&FR.add(`committed:${t.path}`);for(let t of r)(t.path===e||t.oldPath===e)&&FR.add(`uncommitted:${t.path}`)}function pB(){if(!VR||!RR)return;let e=VR.querySelectorAll(`.review-file`);for(let t of e)if(t.dataset.path===RR||t.dataset.oldPath===RR){t.scrollIntoView({block:`nearest`}),RR=null;return}}function mB(e){RR=e,fB(e,AR.get(OI()??``)),dB(`diff`),pB()}function hB(){if(!BR||!VR)return;BR.replaceChildren(),VR.replaceChildren();for(let[e,t]of HR)t.setAttribute(`aria-pressed`,String(LR===e));ez.clear(),Yz(),WR&&(WR.hidden=!0),GR&&(GR.hidden=!0);let e=OI(),t=e?U.get(e):null;if(!e||!t){gB(`No session selected`,`Click a session name to review its changes here.`);return}let n=Lz(e),r=OR.get(e)||`none`,i=kR.get(e)||null,a=t.currentState,o=SR.has(r),s=AR.has(e),c=s?AR.get(e):null,l=jR.get(e)??null,u=c?_k(c.committed?.diff||``):[],d=c?_k(c.uncommitted?.diff||``):[],f=!!c?.hasCommits,p=Pz(a),m=fR(r,i,Mz(a,f)),h=NR.get(e),g=PR.has(e),_=lR(t.effectiveBase),v=Sk([...u,...d]),y=cR({status:r,mergeReason:i,live:p,hasChanges:mR({fetched:s,changedFileCount:v.files,hasCommits:f}),isMergeRendered:m.isRendered}),ee=oR({status:r,mergeReason:i,fetched:s,hasDiffError:l!==null,hasChanges:v.files>0||f,hasCommits:f,canMerge:!n&&m.isEnabled,isWorkspace:n,live:p,effectiveBase:_}),b=V(`div`,`review-status-headline`);if(b.append(V(`span`,`review-status-text`,ee.text)),!n&&!yR(h)){let t=gR(h);if(t){b.title=t;let n=uz(`Refresh branch sync`,`M13 6A5 5 0 1 0 13 10M13 2v4H9`);n.classList.add(`review-branch-sync-refresh`),n.title=vR(h,TR,y!==`resolve`),n.disabled=Bz(e),n.setAttribute(`aria-description`,t),n.addEventListener(`click`,()=>Vz(e)),b.append(V(`span`,`sr-only`,t),n)}}BR.append(b);let te=V(`div`,`review-status-meta`);if(bR({fetched:s,changedFileCount:v.files,view:LR})&&te.append(V(`span`,`review-status-files`,`${v.files} file${v.files===1?``:`s`}`),V(`span`,`review-status-added`,`+${v.added}`),V(`span`,`review-status-removed`,`-${v.removed}`),V(`span`,`review-status-spacer`)),!n&&yR(h)){let t=_B(e,y!==`resolve`);t&&te.append(t)}te.childElementCount>0&&BR.append(te),r===`parked`&&BR.append(V(`div`,`review-status-explanation`,dR(i))),WR&&(WR.hidden=!1),GR&&(GR.hidden=!1,GR.setAttribute(`aria-label`,`${ee.text}, +${v.added}, -${v.removed}`),GR.title=ee.text),KR&&(KR.textContent=`+${v.added}`),qR&&(qR.textContent=`-${v.removed}`);let ne=n?null:xB(e,{status:r,reviewable:o,mergeAction:m,live:p,state:a,effectiveBase:_,primaryAction:y});ne&&BR.append(ne);let re=n?null:Hz(e,g),ie=!n&&y===`merge`&&!m.isEnabled?pR({status:r,hasCommits:f,live:p,state:a}):null;if(ie){let e=V(`div`,`review-control-reason`,ie);e.id=`review-merge-reason`,BR.append(e),BR.querySelector(`#review-merge-btn`)?.setAttribute(`aria-describedby`,e.id)}if(re?.text){let e=V(`div`,re.loading?`review-control-reason review-loading`:`review-control-reason`,re.text);e.id=`review-resync-reason`,re.error&&e.classList.add(`review-control-reason-error`),e.setAttribute(`role`,`status`),te.append(e),te.isConnected||BR.insertBefore(te,b.nextSibling),BR.querySelector(`.review-branch-sync-text, .review-branch-sync-refresh`)?.setAttribute(`aria-describedby`,e.id)}if(YR&&XR===e&&BR.append(V(`div`,`review-resolve-sent`,`Resolve prompt sent`)),LR!==`notes`){if(LR===`map`){let t=MR.get(e);if(!t){VR.append(V(`div`,`review-nochanges review-loading`,`Loading map...`));return}VR.append(aR(nR(t),mB))}else l?VR.append(V(`p`,`review-diff-error`,l)):(u.length>0&&VR.append(vB(`committed`,`Committed`,sR(ee,_),u)),d.length>0&&VR.append(vB(`uncommitted`,`Uncommitted`,null,d)))}}function gB(e,t){if(!VR)return;let n=V(`div`,`review-empty`);n.append(V(`div`,`review-empty-title`,e),V(`div`,`review-empty-desc`,t)),VR.append(n)}function _B(e,t){let n=NR.get(e);if(n===void 0)return null;if(n===null)return V(`span`,`review-branch-sync-text review-loading`,`Checking branch sync...`);let r=gR(n)||`Base branch: sync state unknown`,i=uz(`Refresh branch sync`,`M13 6A5 5 0 1 0 13 10M13 2v4H9`);return i.className=`review-branch-sync-text`,i.removeAttribute(`aria-label`),i.append(V(`span`,`review-branch-sync-label`,r)),i.disabled=PR.has(e),n.state&&(i.dataset.syncState=n.state),n.fetched===!1&&(i.dataset.stale=`true`),i.title=vR(n,TR,t),i.addEventListener(`click`,()=>Vz(e)),i}function vB(e,t,n,r){let i=V(`div`,`review-section`);i.dataset.kind=e;let a=Sk(r),o=V(`div`,`review-section-head`),s=V(`div`,`review-section-id`);s.append(V(`span`,`review-section-label`,t)),n&&s.append(V(`span`,`review-section-meaning`,n)),o.append(s);let c=V(`div`,`review-section-stat`);c.append(V(`span`,`review-stat-files`,`${a.files} file${a.files===1?``:`s`}`)),c.append(V(`span`,`review-add`,`+${a.added}`),V(`span`,`review-del`,`-${a.removed}`)),o.append(c),i.append(o);let l=V(`div`,`review-diff`);for(let t of r)l.append(yB(t,e));return i.append(l),i}function yB(e,t){let n=`${t}:${e.path}`,r=FR.has(n),i=V(`div`,`review-file`);i.dataset.path=e.path,e.oldPath&&(i.dataset.oldPath=e.oldPath),i.dataset.status=e.status,i.dataset.open=r?`true`:`false`;let a=V(`button`,`review-file-head`);a.type=`button`,a.setAttribute(`aria-expanded`,r?`true`:`false`);let o=V(`span`,`review-file-twisty`,r?`▾`:`▸`);o.setAttribute(`aria-hidden`,`true`),a.append(o,V(`span`,`review-file-path`,e.path));let s=V(`span`,`review-file-counts`);if(e.binary&&s.append(V(`span`,`review-bin`,`bin`)),e.binary||s.append(V(`span`,`review-add`,`+${e.added}`),V(`span`,`review-del`,`-${e.removed}`)),a.append(s),a.addEventListener(`click`,()=>{let e=FR.has(n);e&&FR.delete(n),e||FR.add(n),hB()}),i.append(a),!r)return i;let c=V(`div`,`review-file-body`);if(e.binary)return c.append(V(`div`,`review-file-binary`,`Binary file not shown`)),i.append(c),i;let l=0,u=!1;for(let r of e.hunks){if(l>=CR&&!IR.has(n)){u=!0;break}c.append(V(`div`,`review-hunk-head`,r.header));for(let i of r.lines){if(l>=CR&&!IR.has(n)){u=!0;break}let r=V(`div`,`review-line review-line-${i.type}`),a=i.type===`add`?`+`:i.type===`del`?`-`:i.type===`meta`?`\\`:` `;r.append(V(`span`,`review-line-gutter`,a)),r.append(V(`span`,`review-line-text`,i.text));let o=bk(e,i);if(c.append(r),l++,!o)continue;let s=vk(t,o.path,o.line,o.side),d=ez.get(s)??{target:o,section:t,rows:[]};d.rows.push(r),ez.set(s,d),r.dataset.noteKey=s;let f=V(`button`,`review-annotate`,`note`);f.type=`button`,f.title=`Note on ${o.path}:${o.line}`,f.addEventListener(`click`,()=>sB(s)),r.append(f),iB(r,s)}if(u)break}if(u){let e=V(`button`,`review-expand`,`Show the rest of this file`);e.type=`button`,e.addEventListener(`click`,()=>{IR.add(n),hB()}),c.append(e)}return i.append(c),i}function bB({id:e,label:t,shortcut:n,title:r,disabled:i=!1,danger:a=!1,onClick:o}){let s=V(`button`,a?`review-btn review-btn-danger`:`review-btn review-btn-primary`);return s.type=`button`,e&&(s.id=e),r&&(s.title=r),s.disabled=i,s.innerHTML=n?`${t} <kbd class="review-shortcut" aria-hidden="true">${n}</kbd>`:t,s.addEventListener(`click`,o),s}function xB(e,{status:t,reviewable:n,mergeAction:r,live:i,state:a,effectiveBase:o,primaryAction:s}){let c=V(`div`,`review-actions`),l=s===`resolve`;s===`merge`&&c.append(bB({id:`review-merge-btn`,label:`Merge`,shortcut:wR,title:uR(o,wR),disabled:!r.isEnabled,onClick:()=>Nz(e,a)})),l&&c.append(bB({label:`Resolve`,shortcut:TR,title:`Paste a resolve prompt into this session so the agent can finish the merge (${TR})`,onClick:()=>{B({type:`resolve-session-merge`,id:e}),YR=!0,XR=e,clearTimeout(ZR??void 0),ZR=setTimeout(()=>{YR=!1,XR=null,hB()},3e3),hB()}}));let u=V(`div`,`review-action-controls`);if(u.append(c),!n||i)return c.childElementCount>0?u:null;let d=uz(`More review actions`,`M3 8h0.01M8 8h0.01M13 8h0.01`);if(d.classList.add(`review-more-button`),d.setAttribute(`aria-haspopup`,`menu`),d.setAttribute(`aria-expanded`,String(JR)),d.setAttribute(`aria-controls`,`review-more-menu`),d.addEventListener(`click`,()=>{JR=!JR,hB(),(BR?.querySelector(JR?`.review-more-menu button:not(:disabled)`:`.review-more-button`)??BR?.querySelector(`.review-more-button`))?.focus()}),c.append(d),!JR)return u;let f=V(`div`,`review-more-menu`);if(f.id=`review-more-menu`,f.setAttribute(`role`,`menu`),f.setAttribute(`aria-label`,`More review actions`),n&&!i){let n=bB({label:`Discard worktree`,danger:!0,disabled:t===`merging`,onClick:()=>{JR=!1,hB(),kf({title:`Discard worktree`,message:`Throw away the worktree changes for "${Uz(U.get(e),e)}"? This cannot be undone.`,confirmLabel:`Discard`,onConfirm:()=>B({type:`discard-session-worktree`,id:e})})}});n.setAttribute(`role`,`menuitem`),f.append(n)}return u.append(f),u}var SB=1e4,CB=null,wB=null,TB=null,EB=null,DB=[],OB=!1,kB=$D(),AB=null,jB=null,MB=[],NB=null,PB=null,FB=null,IB=null,LB=!1;function RB(){return!!CB&&!$d(CB)}function zB(){return MB.find(e=>e.id===NB)??null}function BB(){IB&&=(clearTimeout(IB.timeoutHandle),null)}function VB(){IB=null,dV()}function HB(e){BB(),LB=!1,NB=e,FB=e?{sessionId:e,grouping:VA(),firstOffset:0,nextOffset:0,hasDroppedEarliestRows:!1,filePath:``,hasLoadedOnce:!1}:null,OB=!0}function UB(e){let t=tj(MB,PB,NB,e);return PB&&t===PB&&(PB=null),t!==NB&&(HB(t),!0)}function WB(e){if(!AB)return;let t=e.endingAt===void 0?{type:`session-trace`,id:e.id,after:e.after}:{type:`session-trace`,id:e.id,endingAt:e.endingAt};AB(t)&&(IB={request:e,timeoutHandle:setTimeout(VB,SB)})}function GB(e=!1){if(!AB)return;let t=nj({selectedSessionId:NB,isPanelVisible:e||RB(),hasPendingRequest:!!IB,hasLoadedOnce:FB?.hasLoadedOnce??!1,nextOffset:FB?.nextOffset??0});t&&WB(t)}function KB(){return{selectedSessionId:NB,hasPendingRequest:!!IB,hasLoadedOnce:FB?.hasLoadedOnce??!1,hasDroppedEarliestRows:FB?.hasDroppedEarliestRows??!1,firstOffset:FB?.firstOffset??0,residentRowCount:FB?YA(FB.grouping):0}}function qB(){if(!AB)return;let e=ij(KB());e&&WB(e)}function JB(e){MB.some(t=>t.id===e)&&e!==NB&&(PB=null,HB(e),GB(),dV())}function YB(){let e=V(`label`,`trace-session-field`),t=V(`span`,`trace-session-label`,`Session`),n=V(`select`,`trace-session-select`);n.disabled=MB.length===0;for(let e of MB){let t=V(`option`,null,e.label);t.value=e.id,t.selected=e.id===NB,n.append(t)}return n.addEventListener(`change`,()=>JB(n.value)),e.append(t,n),e}function XB(e){e.toggleAttribute(`data-hidden`,lj(kB,e.dataset.kind??``))}function ZB(){if(TB)for(let e of TB.querySelectorAll(`.trace-row`))XB(e)}function QB(e){if(TB)for(let t of TB.querySelectorAll(`details`))t.open=e}function $B(){let e=V(`div`,`trace-filters`);for(let t of jA){let n=V(`button`,`trace-filter`,t.label);n.type=`button`;let r=()=>{n.setAttribute(`aria-pressed`,String(!lj(kB,t.kind)))};r(),n.addEventListener(`click`,()=>{kB=cj(kB,t.kind),eO(kB),r(),ZB()}),e.append(n)}for(let[t,n]of[[`Expand all`,!0],[`Collapse all`,!1]]){let r=V(`button`,`trace-expand-control`,t);r.type=`button`,r.addEventListener(`click`,()=>{QB(n)}),e.append(r)}return e}function eV(){let e=Xd(`trace`,`Session trace`,`Bodies load from the local trace file only when requested.`),t=V(`div`,`trace-controls`);t.append(YB());let n=FB?.filePath??``,r=V(`code`,`trace-path`,n);r.title=n,t.append(r);let i=FB?sj(FB.firstOffset,FB.hasDroppedEarliestRows,FB.grouping.turns[0]):null;return i!==null&&t.append(V(`span`,`trace-session-start`,`Started ${new Date(i).toLocaleString()}`)),e.append(t,$B()),e}function tV(e){let t=V(`div`,`trace-copy-wrap`),n=V(`button`,`trace-copy`,`Copy`);n.type=`button`;let r=V(`span`,`trace-copy-status`);return r.setAttribute(`role`,`status`),n.addEventListener(`click`,()=>{let t=ef(e);t?(t.then(()=>{r.textContent=`Copied`}).catch(()=>{r.textContent=`Copy failed`}),setTimeout(()=>{r.textContent=``},1600)):r.textContent=`Copy failed`}),t.append(n,r),t}function nV(){let e=V(`div`,`trace-earlier-wrap`),t=V(`button`,`trace-load-earlier`,`Load earlier`);return t.type=`button`,t.addEventListener(`click`,()=>{qB()}),e.append(t),e}function rV(e,t,n=``){let r=V(`details`,`trace-row${n?` ${n}`:``}`);r.dataset.kind=e.kind,r.dataset.tone=e.tone,XB(r);let i=V(`summary`,`trace-row-summary`);i.append(V(`span`,`trace-offset`,Kk(t,e.record.ts)),V(`span`,`trace-kind`,e.tag),V(`span`,`trace-row-label`,e.text));for(let t of e.badges){let e=V(`span`,`trace-badge`,t);e.dataset.badge=t,i.append(e)}let a=V(`div`,`trace-row-body`);r.append(i,a);let o=!1;return r.addEventListener(`toggle`,()=>{if(!r.open||o)return;o=!0;let t=kA(e.record);a.append(tV(t),V(`pre`,`trace-row-pre`,t))}),r}function iV(e){return V(`span`,`trace-turn-metrics`,UA(e))}function aV(e,t){e&&t&&(t.textContent=UA(e))}function oV(e,t){let n=e.children,r=Math.min(t.rows.length,n.length);for(let e=0;e<r;e+=1){let r=n[e]?.querySelector(`.trace-offset`);r&&(r.textContent=Kk(t.startedAt,t.rows[e].record.ts))}}function sV(e,t,n){let r=rV(t,e.startedAt,`trace-turn-head`);return Wd(r,`.trace-row-summary`).append(n),r}function cV(e){let t=V(`section`,`trace-turn`),n=iV(e);if(e.head&&t.append(sV(e,e.head,n)),!e.head){let e=V(`h2`,`trace-leading-title`);e.append(V(`span`,`trace-leading-label`,`Before first prompt`),n),t.append(e)}let r=V(`div`,`trace-rows`);for(let t of e.rows)r.append(rV(t,e.startedAt));return e.hasTrimmedRows&&t.append(V(`p`,`trace-trimmed`,`Earlier rows trimmed`)),t.append(r),{section:t,rowsElement:r,metricsElement:n}}function lV(e){return e?IB?.request.id===e.id&&!FB?.hasLoadedOnce?`Loading trace.`:uj(e):uj(null)}function uV(){if(!CB)return;let e=V(`div`,`trace-content`);wB=eV(),e.append(wB),TB=null,EB=null,DB=[];let t=zB(),n=FB?.grouping.turns??[];if(!t||n.length===0){e.append(V(`p`,`trace-empty`,lV(t))),CB.replaceChildren(e),OB=!1;return}rj(KB())&&(EB=nV(),e.append(EB));let r=V(`div`,`trace-turns`);for(let e of n){let t=cV(e);DB.push(t),r.append(t.section)}TB=r,ZB(),e.append(r),CB.replaceChildren(e),OB=!1}function dV(){CB&&(RB()?uV():OB=!0)}function fV(){if(!wB||!RB())return;let e=eV();wB.replaceWith(e),wB=e}function pV(e){if(!TB)return;let t=FB?.grouping.turns[e.turnIndex];if(!t)return;if(e.isNewTurn){let e=cV(t);DB.push(e),TB.append(e.section);return}let n=DB[e.turnIndex];if(n){for(let r of e.rows)n.rowsElement.append(rV(r,t.startedAt));aV(t,n.metricsElement)}}function mV(e){let t=e.parentElement;t&&!t.querySelector(`.trace-trimmed`)&&t.insertBefore(V(`p`,`trace-trimmed`,`Earlier rows trimmed`),e)}function hV(){rj(KB())?!EB&&TB?.parentElement&&(EB=nV(),TB.parentElement.insertBefore(EB,TB)):(EB?.remove(),EB=null)}function gV(){if(!FB)return;let e=$A(FB.grouping);if(!(e.droppedTurnCount>0||e.droppedRowCount>0)){hV();return}let t=!FB.hasDroppedEarliestRows;if(FB.hasDroppedEarliestRows=!0,DB=DB.slice(e.droppedTurnCount),TB)for(let t=0;t<e.droppedTurnCount;t+=1)TB.firstElementChild?.remove();let n=DB[0];if(n&&e.droppedRowCount>0){for(let t=0;t<e.droppedRowCount;t+=1)n.rowsElement.firstElementChild?.remove();mV(n.rowsElement),aV(FB.grouping.turns[0],n.metricsElement)}t&&fV(),hV()}function _V(e){if(!FB)return;let t=KA(FB.grouping,e);if(RB()&&!OB&&TB){for(let e of t)pV(e);gV()}else TB=null,gV(),RB()?uV():OB=!0}function vV(e){if(!e||typeof e!=`object`)return null;let t=e;return typeof t.id!=`string`||!Array.isArray(t.records)||typeof t.next!=`number`||typeof t.start!=`number`?null:{id:t.id,records:t.records,start:t.start,next:t.next,reset:t.reset===!0,path:typeof t.path==`string`?t.path:``}}function yV(){LB&&!IB&&(LB=!1,GB())}function bV(e){if(!TB)return;let t=DB[0]??null,n=t?.rowsElement.parentElement??null,r=FB?.grouping.turns[e.newTurns.length]??null;if((e.mergedHead||e.mergedRows.length>0)&&t&&n&&r){let i=t.rowsElement;if(e.mergedHead){n.querySelector(`.trace-leading-title`)?.remove();let a=iV(r),o=sV(r,e.mergedHead,a);n.insertBefore(o,i),t.metricsElement=a}e.mergedHead||aV(r,t.metricsElement);let a=document.createDocumentFragment();for(let t of e.mergedRows)a.append(rV(t,r.startedAt));i.prepend(a),oV(i,r)}let i=document.createDocumentFragment(),a=[];for(let t of e.newTurns){let e=cV(t);a.push(e),i.append(e.section)}TB.prepend(i),DB.unshift(...a)}function xV(e){if(!FB)return;let t=qA(FB.grouping,e),n=RB()&&!OB&&!!TB&&!t.needsRerender,r=CB?.parentElement??null,i=r?.scrollHeight??0,a=r?.scrollTop??0;n&&bV(t),gV(),n||dV(),n&&fV(),r&&(r.scrollTop=a+r.scrollHeight-i)}function SV(e){CB||(CB=V(`div`,`trace-panel`),e.append(CB),uV())}function CV(e){AB=e}function wV(e){jB=e}function TV(e){PB=e,jB?.()}function EV(e){MB=ej(e);let t=UB(RB());t&&GB(),(t||!wB)&&dV(),!t&&wB&&fV()}function DV(){if(!CB)return;let e=UB(!0);GB(!0),oj({hasSelectionChanged:e,isRenderedTraceStale:OB,hasRenderedOnce:!!wB})&&uV()}function OV(e){let t=vV(e);if(!t)return;let n=aj({pendingRequest:IB?.request??null,resident:FB?{sessionId:FB.sessionId,firstOffset:FB.firstOffset,nextOffset:FB.nextOffset,hasLoadedOnce:FB.hasLoadedOnce}:null,reply:{id:t.id,start:t.start,next:t.next,reset:t.reset}});n===`ignore`?yV():(BB(),n===`stale`?yV():n===`reset`?(HB(t.id),FB&&(FB.filePath=t.path),GB(),dV(),yV()):FB&&(FB.filePath=t.path,n===`prepend`?(FB.firstOffset=t.start,xV(t.records),yV()):(n===`seed`&&(FB.hasLoadedOnce=!0,FB.firstOffset=t.start),FB.nextOffset=t.next,_V(t.records),yV())))}function kV(e){let t=e?.id;typeof t==`string`&&t===NB&&RB()&&(IB?LB=!0:GB())}function AV(e){let t=e?.id;typeof t==`string`&&IB?.request.id===t&&(BB(),LB=!1,dV())}function jV(e){BB(),LB=!1,e?GB():dV()}function MV(e){let{waiting:t,failed:n,done:r,complete:i,dormant:a,total:o}=e,s=e=>e>1?`s`:``,c=r+i,l=t+n;return t>0?{text:`${t} session${s(t)} need input`,severity:`warning`,alertCount:l}:n>0?{text:`${n} session${s(n)} failed`,severity:`critical`,alertCount:l}:o>0&&c===o?{text:`All sessions exited`,severity:`done`,alertCount:l}:o>0&&a===o?{text:`${a} session${s(a)} dormant`,severity:``,alertCount:l}:{text:``,severity:``,alertCount:l}}var NV=!1,PV=new Set;function FV(e){NV=!!e,aH();for(let e of PV)e(NV)}function IV(e){return PV.add(e),()=>PV.delete(e)}function LV(){return NV}var RV=[{cls:`agent-badge`,title:`Agent CLI this session supervises`},{cls:`worktree-badge`,text:`worktree`,title:`Running in a linked git worktree`,ariaLabel:`Linked git worktree`},{cls:`post-turn-badge`,ariaHidden:!0},{cls:`usage-badge`,title:`Tokens and estimated API list-price cost for this conversation`},{cls:`wakeup-badge`},{cls:`prompt-badge`,title:`Waiting on a permission or input prompt`}];function zV({cls:e,text:t=``,title:n,ariaLabel:r,ariaHidden:i}){let a=V(`span`,e,t);return n&&(a.title=n),r&&a.setAttribute(`aria-label`,r),i&&a.setAttribute(`aria-hidden`,`true`),a}function BV(e,t){e.textContent=t?`SANE YOLO`:`YOLO`,e.title=t?`Skips permission prompts; Sane YOLO blocks catastrophic commands`:`Running with --dangerously-skip-permissions`}function VV(e,t){t&&(e.dataset.saneYolo=``),t||delete e.dataset.saneYolo;let n=e.querySelector(`.perms-badge`);n&&BV(n,t)}function HV(e,t){let n=Sf(e);n&&VV(n.card,t)}function UV(e,t,n,r={}){let i=n||F.INITIALIZING,a=V(`div`,`session-card`);a.dataset.id=e,a.dataset.session=t,a.dataset.state=i,r.skipPerms&&(a.dataset.skipPerms=``),r.saneYolo&&(a.dataset.saneYolo=``),r.worktree&&(a.dataset.worktree=``),r.workspace&&(a.dataset.workspace=``),r.path&&(a.dataset.path=String(r.path));let o=V(`div`,`session-card-header`),s=V(`span`,`session-name`,t);s.title=`Double-click or press F2 to rename`,s.tabIndex=0;let c=r.skipPerms?V(`span`,`perms-badge`):null;c&&BV(c,r.saneYolo===!0);let l=V(`span`,`session-task-title`);KV(l,r.taskTitle);let u=V(`span`,`card-elapsed`);u.setAttribute(`aria-hidden`,`true`);let d=V(`div`,`session-actions`),f=V(`div`,`session-overflow`),p=V(`button`,`btn-action btn-restart-menu visible`,`↻`);p.type=`button`,p.title=`Restart`,p.setAttribute(`aria-label`,`Restart`),p.setAttribute(`aria-haspopup`,`menu`),p.setAttribute(`aria-expanded`,`false`);let m=V(`div`,`session-overflow-menu`);m.id=`restart-menu-${e}`,m.setAttribute(`role`,`menu`),p.setAttribute(`aria-controls`,m.id);let h=WV(`Restart`,`Keeps this conversation`,`overflow-restart`),g=WV(`Restart fresh`,`Ends this conversation and starts a new one`,`overflow-restart-fresh`),_=WV(`Resume conversation...`,`Pick an earlier conversation`,`overflow-resume`),v=WV(`Edit repositories...`,`Add or remove repositories in this workspace`,`overflow-workspace-repos`);m.append(h,g,_,v),f.append(p,m);let y=V(`button`,`btn-action btn-debug`,`⚙`);y.title=`Debug state`,y.setAttribute(`aria-label`,`Debug session state`);let ee=V(`button`,`btn-action btn-trace`,`≡`);ee.type=`button`,ee.title=`Trace`,ee.setAttribute(`aria-label`,`Trace`);let b=V(`button`,`btn-action btn-remove visible`,`×`);b.type=`button`,b.title=`Remove session`,b.setAttribute(`aria-label`,`Remove session`);let te=V(`button`,`btn-action btn-face-plan`,`Plan`);te.type=`button`,te.title=`Show plan`;let ne=V(`button`,`btn-action btn-face-plan btn-docs`,`Docs`);ne.type=`button`,ne.title=`Open docs the agent surfaced`,d.append(ne,te,y,ee,f,b);let re=V(`div`,`session-card-tags`),ie=RV.map(e=>zV(e));c&&ie.push(c),re.append(...ie),o.append(s,u,l,re,d);let ae=V(`div`,`terminal-wrap`);return a.append(o,ae),{card:a,header:o,nameEl:s,elapsedEl:u,taskTitleEl:l,btnRestart:h,btnRestartFresh:g,btnRestartMenu:p,btnResume:_,btnWorkspaceRepos:v,btnTrace:ee,btnRemove:b,btnPlan:te,btnDocs:ne,btnDebug:y,restartMenu:m,termWrap:ae}}function WV(e,t,n){let r=V(`button`,`overflow-item ${n}`);return r.type=`button`,r.setAttribute(`role`,`menuitem`),r.setAttribute(`aria-label`,e),r.append(V(`span`,`restart-menu-label`,e),V(`span`,`restart-menu-hint`,t)),r}function GV(e,t){e.tabIndex=0,e.setAttribute(`role`,`button`),e.addEventListener(`click`,t),e.addEventListener(`keydown`,e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t())})}function KV(e,t){e.title=t??``,t&&e.removeAttribute(`aria-label`),t||e.setAttribute(`aria-label`,`Describe the task`),!e.querySelector(`input`)&&(e.textContent=t??``)}function qV(e,t){let n=e.titleTargetEl?.isConnected?e.titleTargetEl:e.taskTitleEl;if(n.querySelector(`input`))return;let r=document.createElement(`input`);r.type=`text`,r.className=`session-title-input`,r.setAttribute(`aria-label`,`Task`),r.value=e.taskTitleIsCustom?e.taskTitle??``:``,r.placeholder=e.taskTitle??`What is this session working on?`,r.maxLength=120;let i=n.getAttribute(`role`),a=n.getAttribute(`tabindex`);n.removeAttribute(`role`),n.removeAttribute(`tabindex`),n.replaceChildren(r),r.focus(),r.select();function o(o){r.removeEventListener(`blur`,s),r.removeEventListener(`keydown`,c),o&&B({type:`set-session-title`,id:t,title:r.value.trim()}),n.replaceChildren(),i!==null&&n.setAttribute(`role`,i),a!==null&&n.setAttribute(`tabindex`,a),KV(n,e.taskTitle)}function s(){o(!0)}function c(e){e.stopPropagation(),e.key===`Enter`&&(e.preventDefault(),o(!0)),e.key===`Escape`&&(e.preventDefault(),o(!1))}r.addEventListener(`blur`,s),r.addEventListener(`keydown`,c)}var JV=`session-rename-input`;function YV(e){return!!e?.querySelector(`.${JV}`)}function XV(e,t){let n=e.renameTargetEl?.isConnected?e.renameTargetEl:e.nameEl;if(!n||YV(n))return;let r=e.card?.dataset.session??n.textContent??``;function i(){let t=e.card?.dataset.session??r;n.textContent=t,e.nameEl&&e.nameEl!==n&&(e.nameEl.textContent=t)}let a=document.createElement(`input`);a.type=`text`,a.className=JV,a.value=r,a.maxLength=64,n.textContent=``,n.appendChild(a),a.focus(),a.select();function o(){let n=a.value.trim();if(c(),!n||n===r)i();else{for(let[,t]of U)if(t!==e&&t.card.dataset.session===n){i(),rS(`Session "${n}" already exists.`);return}B({type:`rename-session`,id:t,newName:n}),i()}}function s(){c(),i()}function c(){a.removeEventListener(`blur`,o),a.removeEventListener(`keydown`,l)}function l(e){e.key===`Enter`&&(e.preventDefault(),o()),e.key===`Escape`&&(e.preventDefault(),s()),e.stopPropagation()}a.addEventListener(`blur`,o),a.addEventListener(`keydown`,l)}var ZV=`<button type="button" class="debug-close" aria-label="Close debug overlay" title="Close">×</button>`;function QV(e){return e?Zf(new Date(e)):`-`}function $V(e){return`${(Number(e||0)/1e3).toFixed(1)}s`}function eH(e){return e.decision===`gated`?`(${Number(e.active)||0} bg)`:e.decision===`wait`||e.decision===`release`?`(quiet ${$V(e.quietMs)})`:``}function tH(e){let t=`<span class="debug-dim">${QV(e.ts)}</span>`;if(e.kind===`signal`){let n=zI([e.signal,e.source].filter(Boolean).join(`/`));return e.action===`transition`?`${t} ${n} → <span class="debug-label">${zI(e.event||``)}</span>`:e.action===`gate-held`?`${t} ${n} → held <span class="debug-dim">(${Number(e.active)||0} bg)</span>`:`${t} ${n} → <span class="debug-dim">no-op</span>`}if(e.kind===`gate`){let n=(e.repeats??0)>1?` <span class="debug-dim">x${Number(e.repeats)}</span>`:``,r=eH(e),i=r?` <span class="debug-dim">${r}</span>`:``;return`${t} gate <span class="debug-label">${zI(e.decision||`?`)}</span>${i}${n}`}if(e.kind===`notify`){let n=zI(e.category||e.to||`?`);return e.category?`${t} notify <span class="debug-label">${n}</span>: fired`:`${t} notify ${n}: <span class="debug-dim">silent (${zI(e.reason||``)})</span>`}return e.kind===`notify-state`?`${t} notify ${zI(e.category||`?`)}: <span class="debug-dim">${zI(e.from||`?`)} → ${zI(e.to||`?`)}</span>`:`${t} <span class="debug-dim">${zI(e.kind||`decision`)}</span>`}function nH(e,t){if(!e.debugOverlay)return;let n=t,r=ZV;if(r+=`<div class="debug-section"><div class="debug-section-title">State</div>`,r+=`<div class="debug-field"><span class="debug-label">Current:</span> <span class="debug-value">${zI(n.state)}</span></div>`,r+=`</div>`,r+=`<div class="debug-section"><div class="debug-section-title">Transitions (last ${n.transitions.length})</div>`,n.transitions.length===0&&(r+=`<div class="debug-field debug-dim">No transitions recorded</div>`),n.transitions.length>0)for(let e of n.transitions){let t=e.detail&&typeof e.detail==`object`?e.detail:null,n=t?[t.signal,t.source,t.deferred?`deferred`:null].filter(Boolean):[],i=n.length>0?` <span class="debug-dim">${zI(n.join(`/`))}</span>`:``;r+=`<div class="debug-field"><span class="debug-dim">${QV(e.timestamp)}</span> ${zI(e.from)} → ${zI(e.to)} <span class="debug-label">${zI(e.event)}</span>${i}</div>`}r+=`</div>`;let i=n.detection||{},a=i.lastSignal,o=i.titleState||{};r+=`<div class="debug-section"><div class="debug-section-title">Detection</div>`,r+=`<div class="debug-field"><span class="debug-label">Last signal:</span> <span class="debug-value">${a?`${zI(a.signal)} (${zI(a.source||`?`)}${a.confidence?`/${zI(a.confidence)}`:``})`:`none`}</span></div>`,r+=`<div class="debug-field"><span class="debug-label">Hooks injected:</span> <span class="debug-value">${i.hooksInjected?`yes`:`no`}</span></div>`,r+=`<div class="debug-field"><span class="debug-label">Hook seen:</span> <span class="debug-value">${i.hookSeen?`yes`:`no (degraded → title)`}</span></div>`,r+=`<div class="debug-field"><span class="debug-label">Title state:</span> <span class="debug-value">${zI(o.lastKind||`none`)}${o.hasSeenSpinner?` · spun`:``}</span></div>`,r+=`</div>`;let s=i.agents||{},c=i.gate;r+=`<div class="debug-section"><div class="debug-section-title">Agents</div>`,r+=`<div class="debug-field"><span class="debug-label">Active:</span> <span class="debug-value">${Number(s.active)||0} (counted ${Number(s.counted)||0}, declared ${Number(s.declared)||0})</span></div>`,r+=`<div class="debug-field"><span class="debug-label">Idle:</span> <span class="debug-value">${Number(s.idleNames)||0} names, ${Number(s.idleTasks)||0} tasks</span></div>`;let l=c?`held ${$V(c.heldForMs)} (seq ${Number(c.seq)||0}, lastActivity ${Number(c.lastActivitySeq)||0})`:`none`;r+=`<div class="debug-field"><span class="debug-label">Gate:</span> <span class="debug-value">${zI(l)}</span></div>`,r+=`</div>`;let u=Array.isArray(n.decisions)?n.decisions:[];r+=`<div class="debug-section"><div class="debug-section-title">Decisions (last ${u.length})</div>`,u.length===0&&(r+=`<div class="debug-field debug-dim">No decisions recorded</div>`);for(let e of u)r+=`<div class="debug-field">${tH(e)}</div>`;r+=`</div>`,e.debugOverlay.innerHTML=r}function rH(e,t){if(e.debugOpen){iH(e);return}let n=document.createElement(`div`);n.className=`debug-overlay`,n.innerHTML=`${ZV}<div class="debug-field debug-dim">Loading...</div>`,e.card.appendChild(n),e.debugOverlay=n,e.debugOpen=!0,n.addEventListener(`click`,t=>{t.stopPropagation(),t.target instanceof Element&&t.target.closest(`.debug-close`)&&iH(e)}),B({type:`debug-state`,id:t})}function iH(e){e.debugOverlay&&=(e.debugOverlay.remove(),null),e.debugOpen=!1}function aH(){for(let[,e]of U)e.btnDebug.classList.toggle(`visible`,NV),e.btnTrace.classList.toggle(`visible`,NV),!NV&&e.debugOpen&&iH(e)}function oH(e){let t=typeof e.id==`string`?U.get(e.id):void 0;t?.debugOpen&&nH(t,e.payload)}function sH(e){Sf(e)?.debugOpen&&B({type:`debug-state`,id:e})}function cH({hasPlan:e,pendingPromptKind:t,hasOpenReview:n,hasApprovedReview:r=!1}){return e&&(n||t===`plan`&&!r)?`plan`:`terminal`}function lH({hasPlan:e,isBorrowed:t,face:n}){return!e||n===`plan`?`hidden`:t?`face`:`navigate`}var uH=`DORMANT`;function dH(e){return e?Gf(Date.now()-e,{rounding:`round`,wording:`compact`,suffix:` ago`,justNowBelowSeconds:60}):``}function fH(e,t,n){let r=V(`button`,`resume-item`);r.type=`button`,r.setAttribute(`role`,`option`),e.id===t&&r.classList.add(`resume-item-current`);let i=[e.worktreeName,e.gitBranch?e.gitBranch.replace(/^refs\/heads\//,``):null,dH(e.mtime)].filter(Boolean).join(` · `);return r.innerHTML=`<span class="resume-item-title">${zI(e.title||e.id)}</span><span class="resume-item-meta">${zI(i)}${e.id===t?` · current`:``}</span>`,r.addEventListener(`click`,()=>n(e.id)),r}function pH(e,t={}){let n=(t.currentState||``)===uH,{overlay:r,dialog:i,close:a,actions:o,btnCancel:s}=Of({title:`Resume a conversation`,dialogClass:`dialog resume-dialog`}),c=V(`p`,`dialog-message`,`Pick a Claude conversation from this repo (any worktree) to continue in this card.`),l=V(`div`,`resume-list`);l.setAttribute(`role`,`listbox`),l.setAttribute(`aria-label`,`Resumable conversations`),l.append(V(`div`,`resume-empty`,`Loading conversations...`));let u=V(`button`,`btn-dialog btn-dialog-cancel`,`Start fresh`);u.title=`Clear any resume binding so this card starts a new conversation`,o.prepend(u),i.append(c,l,o);function d(t){B({type:`resume-conversation`,id:e,conversationId:t||``}),a(),t&&(n?B({type:`start-session`,id:e}):rS(`Conversation will resume on this session's next restart.`))}s.addEventListener(`click`,a),u.addEventListener(`click`,()=>d(null)),requestAnimationFrame(()=>s.focus()),Nd(`list-conversations`,{id:e}).then(e=>{if(!r.isConnected)return;let t=e.type===`conversations`?e.conversations:[];if(l.innerHTML=``,e.error){l.append(V(`div`,`resume-empty`,`Could not list conversations: ${e.error}`));return}if(t.length===0){l.append(V(`div`,`resume-empty`,`No prior conversations found for this repo.`));return}let n=e.type===`conversations`?e.current??null:null;for(let e of t)l.append(fH(e,n,d))}).catch(e=>{r.isConnected&&(l.innerHTML=``,l.append(V(`div`,`resume-empty`,`Could not list conversations: ${RP(e)}`)))})}var mH={critical:`✕`,warning:`▲`,done:`✓`,"":`▸`},hH=null,gH=null,_H=e=>e==null?``:String(e),vH=e=>qs.includes(e),yH=e=>Js.includes(e);function bH(e){let t=e.currentState,n=vH(t)||yH(t);e.btnRestart.classList.toggle(`visible`,n),e.btnRestartFresh.classList.toggle(`visible`,n),e.btnResume.classList.add(`visible`),e.btnWorkspaceRepos.classList.toggle(`visible`,e.card.dataset.workspace!==void 0),e.btnTrace.classList.toggle(`visible`,LV()),e.btnPlan.classList.toggle(`visible`,lH(e)!==`hidden`),e.btnRemove.classList.add(`visible`)}function xH(e){e.restartMenu.classList.remove(`open`),e.btnRestartMenu.setAttribute(`aria-expanded`,`false`)}function SH(e,t){GV(e.taskTitleEl,()=>qV(e,t)),e.nameEl.addEventListener(`dblclick`,n=>{n.preventDefault(),XV(e,t)}),e.nameEl.addEventListener(`click`,()=>{YV(e.nameEl)||kI(t)}),e.nameEl.addEventListener(`keydown`,n=>{n.target===e.nameEl&&(n.key===`F2`||n.key===`Enter`)&&(n.preventDefault(),XV(e,t))});function n(n){xH(e),e.btnRestartMenu.focus(),Nf(n,t,{readState:()=>e.currentState,send:B,confirm:kf})}e.btnRestart.addEventListener(`click`,()=>n(`restart`)),e.btnRestartFresh.addEventListener(`click`,()=>n(`restart-fresh`)),e.btnResume.addEventListener(`click`,()=>{xH(e),pH(t,{currentState:e.currentState})}),e.btnWorkspaceRepos.addEventListener(`click`,()=>{xH(e),HP(t)}),e.btnTrace.addEventListener(`click`,()=>{xH(e),TV(t)}),e.btnDocs.addEventListener(`click`,()=>{xH(e),oI(t)}),e.btnPlan.addEventListener(`click`,()=>{let n=lH(e);n!==`hidden`&&(n===`face`?NH(t):location.hash=JL(t))}),e.btnRemove.addEventListener(`click`,()=>{xH(e);let n=e.card.dataset.session,r=e.card.dataset.merge,i=r===`pending-review`||r===`parked`;kf({title:`Remove Session`,message:i?`"${n}" has unmerged worktree changes that will be permanently discarded if you remove it. Merge or review them first to keep them. Remove anyway?`:`Remove session "${n}"?`,confirmLabel:i?`Discard & Remove`:`Remove`,onConfirm:()=>B({type:`remove-session`,id:t})})}),e.btnRestartMenu.addEventListener(`click`,t=>{t.stopPropagation();for(let[,t]of U)t!==e&&xH(t);let n=e.restartMenu.classList.toggle(`open`);e.btnRestartMenu.setAttribute(`aria-expanded`,String(n))});let r=[e.btnRestart,e.btnRestartFresh,e.btnResume,e.btnWorkspaceRepos];function i(t){if(t.key!==`ArrowDown`&&t.key!==`ArrowUp`)return;t.preventDefault(),t.stopPropagation();for(let[,t]of U)t!==e&&xH(t);e.restartMenu.classList.add(`open`),e.btnRestartMenu.setAttribute(`aria-expanded`,`true`);let n=r.filter(e=>e.classList.contains(`visible`)),i=document.activeElement,a=i instanceof HTMLButtonElement?n.indexOf(i):-1;n[((t.key===`ArrowDown`?a+1:a<0?n.length-1:a-1)+n.length)%n.length]?.focus()}e.btnRestartMenu.addEventListener(`keydown`,i),e.restartMenu.addEventListener(`keydown`,i),document.addEventListener(`keydown`,t=>{t.key===`Escape`&&e.restartMenu.classList.contains(`open`)&&(t.preventDefault(),xH(e),e.btnRestartMenu.focus())},{signal:e.abortController.signal}),document.addEventListener(`click`,t=>{let n=t.target instanceof Node?t.target:null;!e.restartMenu.contains(n)&&n!==e.btnRestartMenu&&xH(e)},{signal:e.abortController.signal}),e.termWrap.addEventListener(`mousedown`,()=>{(e.currentState===F.WAITING||e.currentState===F.COMPLETE)&&B({type:`dismiss`,id:t})}),e.btnDebug.addEventListener(`click`,n=>{n.stopPropagation(),rH(e,t)}),document.addEventListener(`click`,t=>{let n=t.target instanceof Node?t.target:null;e.debugOpen&&!e.card.contains(n)&&iH(e)},{signal:e.abortController.signal})}function CH(e,t,n){let r=Sf(e);if(r){r.taskTitle=typeof t==`string`?t:null,r.taskTitleIsCustom=n===!0;for(let e of[r.taskTitleEl,r.titleTargetEl])e&&KV(e,r.taskTitle)}}function wH(e){return typeof e==`string`&&U.has(e)}function TH(){return U.size}function EH(){return[...U.keys()]}function DH(e){let t=e||{};t.cursorBlink!=null&&LO(t.cursorBlink),t.debugMode!=null&&(FV(t.debugMode),nL(t.debugMode));for(let[,e]of U)e.term&&t.cursorBlink!=null&&(e.term.options.cursorBlink=t.cursorBlink)}function OH(){Wy(U.values(),Ky())}function kH(){if(!wf)return;let e=0,t=0,n=0,r=0,i=0,a=0;for(let[,o]of U){a++;let s=o.currentState;s===F.WAITING?e++:s===F.FAILED?t++:s===F.DONE?n++:s===F.COMPLETE?r++:s===F.DORMANT&&i++}let{text:o,severity:s,alertCount:c}=MV({waiting:e,failed:t,done:n,complete:r,dormant:i,total:a});if((o!==hH||s!==gH)&&(hH=o,gH=s,wf.dataset.severity=s,wf.textContent=``,o)){let e=V(`span`,`aggregate-glyph`,mH[s]??mH[``]);e.setAttribute(`aria-hidden`,`true`),wf.append(e,document.createTextNode(o))}document.title=c>0?`(${c}) Glimmervoid`:`Glimmervoid`}function AH(e,t,n,r={}){if(!Cf)return;let i=xf(e),a=_H(n)||F.DORMANT,o=UV(i,_H(t),a,r),s=a===F.DORMANT;Cf.appendChild(o.card);let c;function l(){c.face=`terminal`,c.card.dataset.face=`terminal`,c.termWrap.hidden=!1,c.planFace.hide(),bH(c),mk(c,i)}let u=new AbortController,d=KL({signal:u.signal,requestPlan:(e,t,n)=>B({type:`session-plan`,id:e,agentId:t,revision:n}),requestDraft:(e,t)=>B({type:`session-plan`,id:e,agentId:t,draft:!0}),showTerminal:l,sendDecision:(e,t)=>B({type:`plan-decision`,id:e,...t}),reportProblem:e=>rS(`${o.nameEl.textContent||i}: ${e}`)});return c={term:null,fitAddon:null,webglAddon:null,needsWebGLReload:!1,webglAttachedWithoutLayout:!1,dataWs:null,card:o.card,nameEl:o.nameEl,taskTitleEl:o.taskTitleEl,taskTitle:r.taskTitle??null,taskTitleIsCustom:r.taskTitleIsCustom??!1,hasEndedTurn:!1,elapsedEl:o.elapsedEl,path:_H(r.path),stateSince:typeof r.stateSince==`number`&&Number.isFinite(r.stateSince)?r.stateSince:Date.now(),restartMenu:o.restartMenu,termWrap:o.termWrap,btnDebug:o.btnDebug,btnRestart:o.btnRestart,btnRestartFresh:o.btnRestartFresh,btnRestartMenu:o.btnRestartMenu,btnResume:o.btnResume,btnWorkspaceRepos:o.btnWorkspaceRepos,btnTrace:o.btnTrace,btnPlan:o.btnPlan,btnDocs:o.btnDocs,btnRemove:o.btnRemove,debugOverlay:null,debugOpen:!1,abortController:u,currentState:a,face:`terminal`,isBorrowed:!1,hasPlan:!1,pendingPromptKind:null,pendingPromptDetail:null,planReviewState:{reviews:[]},planFace:d},c._ensureTerminalReady=()=>mk(c,i),c._showTerminalFace=l,c._showPreferredFace=()=>{jH(c)===`plan`?NH(i):l()},c._setBorrowed=e=>{c.isBorrowed=e,bH(c)},o.card.append(d.el),U.set(i,c),SH(c,i),bH(c),c.btnDocs.classList.toggle(`visible`,JF(i)),a===F.RUNNING&&ip(c,!0),s||(ak(o.termWrap,c),lk(c,i)),kH(),c}function jH(e){let t=e.planReviewState.reviews.some(e=>e.state===`open`),n=e.planReviewState.reviews.some(_L);return cH({hasPlan:e.hasPlan,pendingPromptKind:e.pendingPromptKind,hasOpenReview:t,hasApprovedReview:n})}function MH(e){let t=Sf(e);return!t?.isBorrowed||jH(t)!==`plan`?!1:NH(e)}function NH(e){let t=Sf(e);return!t?.isBorrowed||!t.hasPlan?!1:(t.face=`plan`,t.card.dataset.face=`plan`,t.termWrap.hidden=!0,t.planFace.show(xf(e)),bH(t),!0)}function PH(e,t){let n=Sf(e);n&&(n.hasPlan=t===!0,bH(n),MH(e))}function FH(e){let t=Sf(e.id);t&&(t.planReviewState=PL(t.planReviewState,e),t.hasPlan=e.hasPlan,t.planFace.update({state:t.planReviewState}),bH(t),MH(e.id))}function IH(e){let t=Sf(e.id);t&&t.planFace.update({draft:e})}function LH(e){let t=Sf(e.id);t&&(t.planReviewState={reviews:e.reviews},t.hasPlan=!0,t.planFace.update({response:e}),bH(t))}function RH(e){if(e.type!==`error`&&e.type!==`session-error`||e.scope!==`plan`&&e.scope!==`plan-decision`)return;let t=Sf(e.id);t&&(e.scope===`plan`?t.planFace.update({requestFailed:!0}):t.planFace.update({decisionRefused:!0}))}function zH(e){for(let[,t]of U)t.planFace.update({isConnected:e})}function BH(e,t){let n=Sf(e);n&&(n.effectiveBase=typeof t==`string`?t:void 0)}function VH(e,t){let n=Sf(e);if(!n)return;n.agent=typeof t==`string`?t:null;let r=GP(t);UH(n,`.agent-badge`,`agent`,{on:r!==``,value:r,text:r})}function HH(e,t){let n=Sf(e);n&&(t?n.card.dataset.worktree=``:delete n.card.dataset.worktree)}function UH(e,t,n,r){let{on:i,value:a=``,text:o,title:s}=r,c=e.card.querySelector(t);if(i)e.card.dataset[n]=a,c&&(o!==void 0&&(c.textContent=o),s!==void 0&&(c.title=s));else{if(delete e.card.dataset[n],!c)return;o!==void 0&&(c.textContent=``),s!==void 0&&c.removeAttribute(`title`)}}function WH(e,t){let n=Sf(e);n&&(n.hasEndedTurn=t)}function GH(e,t,n=!1){let r=Sf(e);r&&(r.activeAgents=Math.max(0,Number(t)||0),r.awaitingBackgroundTasks=qd(r.currentState,n===!0),r.card.toggleAttribute(`data-monitoring`,r.awaitingBackgroundTasks))}function KH(e,t){let n=Sf(e);if(!n)return;let r=Zae(t);UH(n,`.usage-badge`,`usage`,{on:!!r,text:r||``,title:r?Qae(t):void 0})}function qH(e,t,n=null,r=!1){let i=Sf(e);i&&(i.pendingPromptKind=typeof t==`string`?t:null,i.pendingPromptDetail=n,UH(i,`.prompt-badge`,`prompt`,{on:!!t||r,value:r?`compacting`:_H(t),title:r?`Context compaction in progress`:`Waiting on a permission or input prompt`,text:r?`compacting`:t===`plan`?`Plan ready`:t===`permission`?`permission`:`input`}),MH(e))}function JH(e){return e?`sleeping until ~${Xf(new Date(e))}`:`scheduled`}function YH(e,t){let n=Sf(e);n&&UH(n,`.wakeup-badge`,`wakeup`,{on:!!t,value:t?.kind||`wakeup`,text:JH(t?.at),title:t?.reason?`Scheduled revival: ${t.reason}`:`Scheduled revival pending`})}function XH(e,t){let n=Sf(e);if(!n)return;let r=Array.isArray(t.findings)?t.findings:[],i=t.filesFixed||0,a=null,o=0;!t.skipped&&t.mode===`fix`&&i>0&&(a=`fixed`,o=i),!t.skipped&&t.mode===`report`&&r.length>0&&(a=`flagged`,o=new Set(r.map(e=>e.file)).size);let s={};for(let e of r)s[e.rule]=(s[e.rule]||0)+(e.count||0);let c=Object.keys(s).map(e=>`${e}: ${s[e]}`).join(`, `),l=a===`fixed`?`auto-fixed`:`flagged`;UH(n,`.post-turn-badge`,`pt`,{on:!!a,value:a||void 0,text:`${a===`fixed`?`✓`:`⚠`} ${o}`,title:`Post-turn ${l} ${o} file(s)${c?` (${c})`:``}`})}function ZH(e,t){t===`pending-review`||t===`parked`||t===`merging`?e.dataset.merge=t:delete e.dataset.merge}function QH(e,t,n=null){let r=Sf(e),i=_H(t)||`none`;r&&ZH(r.card,i),hz(xf(e),i,_H(n)||null)}function $H(e,t,n=null){let r=Sf(e),i=_H(t)||`none`;r&&ZH(r.card,i),gz(xf(e),i,_H(n)||null)}function eU(e,t){_z(xf(e),t)}function tU(e,t){let n=Sf(e);if(!n)return;let r=_H(t);n.card.dataset.session=r,n.nameEl.textContent=r}function nU(e){let t=Sf(e);t&&(iH(t),U.delete(xf(e)),WL(xf(e)),t.resizeObserver&&t.resizeObserver.disconnect(),t.abortController&&t.abortController.abort(),t.dataWs&&t.dataWs.readyState<=WebSocket.OPEN&&t.dataWs.close(),nE(t),t.term&&t.term.dispose(),t.term=null,t.fitAddon=null,t.card&&t.card.remove(),kH())}function rU(e,t,n){if(!t||!e.term)return;e.term.clear(),e.term.reset();let r=n===F.DONE?`Session complete`:`Session failed`,i=n===F.DONE?`\x1B[34m`:`\x1B[31m`;e.term.write(`\r\n\x1b[2m${i} ${r}\x1b[0m\r\n\r\n\x1b[2m Press Restart to start a new session.\x1b[0m\r\n`)}function iU(e,t){e.term&&(t===F.DONE||t===F.FAILED)&&(e.term.clear(),e.term.reset())}function aU(e,t,n){let r=document.activeElement;return EI({previousState:t,nextState:n,isPhoneLayout:vf(),isDocumentVisible:document.visibilityState===`visible`,isDocumentFocused:document.hasFocus(),isActiveViewer:e._isActiveViewer?.()===!0,hasFocusInsideTerminal:r instanceof Node&&e.termWrap.contains(r)})}function oU(e,t,n,r=``){let i=Sf(e);if(!i)return;let a=_H(t),o=i.currentState;i.currentState=a,a!==F.RUNNING&&(i.awaitingBackgroundTasks=!1),a!==o&&(i.stateSince=typeof n==`number`&&Number.isFinite(n)?n:Date.now(),ip(i,a===F.RUNNING)),o===F.DORMANT&&a!==F.DORMANT&&fk(i,xf(e)),i.card.dataset.state=a,i.card.toggleAttribute(`data-monitoring`,qd(a,i.awaitingBackgroundTasks)),bH(i),(a===F.WAITING&&o!==F.WAITING||a===F.COMPLETE&&o!==F.COMPLETE)&&!RI(r)&&CD()&&Ub(TD()),aU(i,o,a)&&B({type:`dismiss`,id:xf(e),expectedState:F.COMPLETE});let s=a===F.DONE||a===F.FAILED,c=o!==F.DONE&&o!==F.FAILED&&o!==F.INITIALIZING;s&&c&&(i.card.classList.remove(`completion-flash`),requestAnimationFrame(()=>{requestAnimationFrame(()=>{i.card.classList.add(`completion-flash`),i.card.addEventListener(`animationend`,()=>i.card.classList.remove(`completion-flash`),{once:!0})})}),CD()&&Ub(TD())),(a===F.DONE||a===F.FAILED)&&rU(i,c,a),a===F.INITIALIZING&&iU(i,o),kH(),cp(i)}var sU=`(no path)`;function cU(e){if(!e)return sU;let t=String(e).replace(/[/\\]+$/,``),n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return(n===-1?t:t.slice(n+1))||`(no path)`}function lU(e,t,n){let r=Array.isArray(e)?e:[],i=new Map;for(let e of r){let n=t(e),r=n?String(n):sU,a=i.get(r);a||(a={key:r,label:r===`(no path)`?sU:cU(r),title:r,rows:[]},i.set(r,a)),a.rows.push(e)}if(n)for(let e of n){if(!e)continue;let t=String(e);t===`(no path)`||i.has(t)||i.set(t,{key:t,label:cU(t),title:t,rows:[]})}let a=[...i.values()];return a.sort((e,t)=>e.label.localeCompare(t.label,void 0,{numeric:!0,sensitivity:`base`})||e.key.localeCompare(t.key)),{flat:i.size<=1,order:a.map(e=>e.key),groups:a}}function uU(e,t){if(!e||!Array.isArray(e.groups))return[];let n=t||new Set,r=[];if(e.flat){for(let t of e.groups)for(let e of t.rows)r.push(e.id);return r}let i=new Map(e.groups.map(e=>[e.key,e]));for(let t of e.order){if(n.has(t))continue;let e=i.get(t);if(e)for(let t of e.rows)r.push(t.id)}return r}function dU(e,t){let n=V(e,t);return n.innerHTML=`<span class="focus-pill-name"></span><span class="focus-pill-badge"><span class="focus-pill-glyph"></span><span class="focus-pill-label"></span></span><span class="focus-pill-merge"></span>`,{pill:n,refs:{glyph:Wd(n,`.focus-pill-glyph`),label:Wd(n,`.focus-pill-label`),name:Wd(n,`.focus-pill-name`),merge:Wd(n,`.focus-pill-merge`)}}}function fU(e,t,n,r=!1){e.dataset.state=n;let{glyph:i,label:a,isMonitoring:o}=Jd(n,r);return e.toggleAttribute(`data-monitoring`,o),t.glyph.textContent=i,t.label.textContent=a,a}function pU(){let e=new Map,t=new Set;function n(n){let r=new Set(n.map(e=>e.id));for(let{id:r,state:i}of n){let n=e.get(r);e.set(r,i),i===F.COMPLETE?n&&n!==F.COMPLETE&&t.add(r):t.delete(r)}for(let n of e.keys())r.has(n)||(e.delete(n),t.delete(n))}function r(e){t.delete(e)}function i(e){return t.has(e)}return{noteStates:n,acknowledge:r,isUnseen:i}}var mU=e=>e.ui.path,hU=window.matchMedia?.(`(prefers-reduced-motion: reduce)`),gU=window.matchMedia?.(`(hover: none) and (min-width: 769px)`),_U=null,vU=null,yU=null,bU=null,xU=null,SU=null,CU=null,wU=null,TU=!1,EU=null,DU=new Map,OU=new Map,kU=pU(),AU=new Map,jU=new Map,MU=null,NU=new Set;function PU(){return uU(IU(KU()),NU)}function FU(e){let t=MU;if(MU=e||null,t&&t!==MU){let e=OU.get(t);e&&(e.tabIndex=-1,e.setAttribute(`aria-selected`,`false`))}if(MU){let e=OU.get(MU);e&&(e.tabIndex=0,e.setAttribute(`aria-selected`,`true`))}}function IU(e){return lU(e,mU,CI(e,mU))}function LU(e){let t=jU.get(e.key),n=AU.get(e.key);if(!t||!n){let r=Object.assign(V(`div`,`focus-rail-group`),{_addBtn:V(`button`,`focus-rail-group-add`,`+`),_forgetBtn:V(`button`,`focus-rail-group-remove`,`×`)});r.dataset.key=e.key,r.innerHTML=`<span class="focus-rail-group-label"></span><span class="focus-rail-group-rule" aria-hidden="true"></span>`;let i=r._addBtn;i.type=`button`,i.addEventListener(`click`,()=>FI(r.dataset.path,r.dataset.label));let a=r._forgetBtn;a.type=`button`,a.addEventListener(`click`,()=>{wI(r.dataset.path),QU()}),r.appendChild(a),r.appendChild(i),t=r,n=V(`div`,`focus-rail-list`),n.setAttribute(`role`,`listbox`),jU.set(e.key,t),AU.set(e.key,n)}Wd(t,`.focus-rail-group-label`).textContent=e.label,t.title=e.title,t.dataset.path=e.key,t.dataset.label=e.label;let r=e.key===sU,i=e.rows.length===0;return t._addBtn.hidden=r,r||(t._addBtn.title=`Add a session to ${e.label}`,t._addBtn.setAttribute(`aria-label`,`Add a session to ${e.label}`)),t._forgetBtn.hidden=r||!i,!r&&i&&(t._forgetBtn.title=`Remove ${e.label} from the rail`,t._forgetBtn.setAttribute(`aria-label`,`Remove ${e.label} from the rail`)),t.toggleAttribute(`data-empty`,i),n.setAttribute(`aria-label`,`${e.label} sessions`),{header:t,list:n}}function RU(){return TU}function zU(){return xU}function BU(){return df.snapshot().focusedSessionId}function VU({rail:e,center:t,resizer:n}){if(_U=e,yU=t,!_U||!yU)return;let r=_U,i=yU;WU(n),r.removeAttribute(`role`),r.removeAttribute(`aria-label`),r.setAttribute(`aria-keyshortcuts`,wre(db)),vU=V(`button`,`focus-rail-head`),vU.type=`button`,vU.append(V(`span`,`focus-rail-head-count`),Dre(lb(`next-attention`,db))),vU.addEventListener(`click`,nW),tW(!1,Tj(0)),r.append(vU),SU=V(`div`,`focus-empty`),SU.innerHTML=`<p class="focus-empty-title"></p><p class="focus-empty-desc"></p>`,CU=SU.querySelector(`.focus-empty-title`),wU=SU.querySelector(`.focus-empty-desc`),bU=V(`div`,`focus-card-slot`),xU=V(`div`,`focus-header-accessory-slot`),i.append(xU,SU,bU),r.addEventListener(`keydown`,GU)}var HU={minPx:180,maxPx:480},UU=16;function WU(e){e&&_U&&yI({resizer:e,column:_U,widthHost:_U,widthProperty:`--rail-width`,bounds:HU,keyStepPx:UU,getStoredWidth:zD,setStoredWidth:BD})}function GU(e){if(e.key===`Delete`||e.key===`Backspace`){let t=e.target instanceof HTMLElement?e.target:null,n=t?.dataset.id;if(!n||OU.get(n)!==t)return;e.preventDefault(),II(n,DU.get(n));return}if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`||e.altKey||e.metaKey||e.ctrlKey||e.shiftKey)return;let t=Sj(PU(),MU,e.key===`ArrowDown`?1:-1);t!=null&&(e.preventDefault(),FU(t),OU.get(t)?.focus())}function KU(e=PI(qU)){for(let t of e)t.unseen=kU.isUnseen(t.id);return bj(e)}function qU(e){return e.nameEl?e.nameEl.textContent:e.card&&(e.card.dataset.session||e.card.dataset.id)||``}function JU(e){let{pill:t,refs:n}=dU(`button`,`focus-pill`);t.type=`button`,t.dataset.id=e,t.setAttribute(`role`,`option`);let r=Object.assign(t,{_refs:n,_row:null});r.addEventListener(`click`,()=>YU(e));let i=V(`div`,`focus-pill-row`);i.setAttribute(`role`,`presentation`);let a=V(`button`,`focus-pill-remove`,`×`);return a.type=`button`,a.tabIndex=-1,gU?.matches||a.setAttribute(`aria-hidden`,`true`),a.title=`Remove session`,a.addEventListener(`click`,t=>{t.stopPropagation(),II(e,DU.get(e))}),i.append(r,a),r._row=i,r}function YU(e){jI(e)&&sW(e)}function XU(e,{id:t,ui:n,state:r,name:i,unseen:a}){e.toggleAttribute(`data-unseen`,a);let o=fU(e,e._refs,r,n.awaitingBackgroundTasks),s=[i,n.taskTitle,o].filter(Boolean).join(`, `);e.setAttribute(`aria-label`,s),e.title=s,e._refs.name.textContent=i;let c=DU.get(t)||`none`;e.dataset.merge=c===`none`?``:c,e._refs.merge.textContent=Kd[c]||``,e.dataset.activity=n._activity||``,e.classList.toggle(`focused`,t===BU());let l=t===MU;e.setAttribute(`aria-selected`,String(l)),e.tabIndex=l?0:-1}function ZU(e,t){if(!TU)return;let n=e?.card?.dataset.id,r=n?OU.get(n):null;if(!r)return;if(t===`flag`){r.dataset.activity=e._activity||``;return}if(hU?.matches||document.hidden)return;let i=r._refs?.glyph;i?.animate&&i.animate([{transform:`scale(1)`,opacity:.65},{transform:`scale(1.35)`,opacity:1,offset:.3},{transform:`scale(1)`,opacity:.9}],{duration:300,easing:`cubic-bezier(0.22, 1, 0.36, 1)`})}tp(ZU);function QU(){if(!TU)return;let e=_U;if(!e)return;let t=PI(qU);kU.noteStates(t);let n=KU(t),r=IU(n),i=new Set,a=(e,t)=>{let n=e.map(e=>e.id).join(`,`),r=t._lastOrderKey===n&&t.childElementCount===e.length;for(let n of e){let{id:e}=n;i.add(e);let a=OU.get(e);a||(a=JU(e),OU.set(e,a)),XU(a,n),!r&&a._row&&t.appendChild(a._row)}t._lastOrderKey=n},o=new Set(r.order);for(let t of r.groups){let{header:n,list:r}=LU(t);e.appendChild(n),e.appendChild(r),a(t.rows,r)}for(let[e,t]of[...jU])o.has(e)||(t.remove(),AU.get(e)?.remove(),jU.delete(e),AU.delete(e));for(let[e,t]of OU)i.has(e)||((t._row||t).remove(),OU.delete(e),e===MU&&(MU=null));for(let e of[...DU.keys()])U.has(e)||DU.delete(e);let s=BU();if(s&&!U.has(s)){df.dispatch(`focusSession`,null),MU=null;let e=n.find(e=>U.has(e.id));if(e){sW(e.id);return}}cW();let c=BU();if(c){let e=U.get(c);e&&e.card.parentElement!==bU&&aW(e,c)}eW()}function $U(){return KU().filter(Cj).map(({id:e})=>e)}function eW(){let e=wj(KU());tW(e>0,Tj(e))}function tW(e,t){vU&&(Wd(vU,`.focus-rail-head-count`).textContent=t,vU.disabled=!e,e?(vU.removeAttribute(`data-empty`),vU.removeAttribute(`aria-hidden`)):(vU.dataset.empty=``,vU.setAttribute(`aria-hidden`,`true`)))}function nW(){if(!TU)return;let e=$U();if(!e.length)return;let t=xj(e,EU);if(!t)return;EU=t;let n=U.get(t),r=t===BU();jI(t),sW(t),OU.get(t)?.scrollIntoView({block:`nearest`}),r&&iW(t),rW(n,t)}function rW(e,t){e&&requestAnimationFrame(()=>requestAnimationFrame(()=>{TU&&BU()===t&&e.term?.focus()}))}function iW(e){if(hU?.matches||document.hidden)return;let t=OU.get(e);t?.animate&&t.animate([{transform:`scale(1)`},{transform:`scale(1.045)`,offset:.3},{transform:`scale(1)`}],{duration:360,easing:`cubic-bezier(0.22, 1, 0.36, 1)`});let n=U.get(e)?.card;n?.animate&&n.animate([{opacity:.8},{opacity:1}],{duration:240,easing:`ease-out`})}function aW(e,t){bU&&(jP(e,t,bU,{className:`focus-centered`}),hk(e,t,!0))}function oW(){let e=BU();e&&(AP()===e&&MP(),df.dispatch(`focusSession`,null))}function sW(e){TU&&U.has(e)&&e!==BU()&&(oW(),df.dispatch(`focusSession`,e),MU=e,kU.acknowledge(e),MI(e),QU())}function cW(){if(!SU||!CU||!wU)return;let e=BU(),t=!!(e&&U.has(e));if(SU.hidden=t,t)return;let n=U.size>0;CU.textContent=n?`No session selected`:`Nothing to focus`,wU.textContent=n?uW():`Spawn a session to start watching.`}function lW(){return _U?.closest(`.focus-view`)?.dataset.rail===`off`}function uW(){return lW()?`Pick a session in Calm to focus it here.`:`Select a session from the rail on the left to focus it here.`}function dW(e){let t=_U?.closest(`.focus-view`);t&&(e&&t.removeAttribute(`data-rail`),e||(t.dataset.rail=`off`),cW())}function fW(e,t){DU.set(xf(e),typeof t==`string`&&t?t:`none`),TU&&QU()}function pW(e){TU&&U.has(e)&&sW(e)}function mW(e){return!TU||!U.has(e)?!1:(sW(e),NH(e))}function hW(e){if(!TU)return;let t=PU()[e-1];t&&YU(t)}function gW(e){if(!TU)return;let t=Sj(PU(),MU,e);t!=null&&(YU(t),OU.get(t)?.scrollIntoView({block:`nearest`}),rW(U.get(t),t))}function _W(){_U&&(TU=!0,oW(),MU=null,QU(),vW())}function vW(){if(!TU||BU())return;let e=NI();e&&sW(e)}function yW(){TU&&=(oW(),MU=null,!1)}function bW(e,t,n){let r=V(`a`,`settings-link`,n);return r.href=`#settings/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,r}var xW=`t-[0-9a-f]{8}`,SW=`No findings. Open a markdown file in a connected editor.`,CW=`No intent yet. The visions proposes one after its first pass.`,wW=`Unowned`,TW=RegExp(`^${xW}$`);function EW(){return{byProject:{},unowned:[]}}function DW(e){if(!e||typeof e!=`object`)return null;let t=e,n=typeof t.text==`string`?t.text:``;if(!n)return null;let r=Number(t.ts),i=Number(t.hits);return{id:typeof t.id==`string`&&TW.test(t.id)?t.id:null,text:n,uris:Array.isArray(t.uris)?t.uris.filter(e=>typeof e==`string`&&e!==``):[],ts:Number.isFinite(r)&&r>0?r:0,hits:Number.isInteger(i)&&i>0?i:1}}function OW(e){if(Array.isArray(e))return e.map(DW).filter(e=>e!==null);let t=DW(e);return t?[t]:[]}function kW(e){let t=e?.intent;if(!t||typeof t!=`object`)return EW();let n=t;if(!(Object.hasOwn(n,`byProject`)||Object.hasOwn(n,`unowned`)||Object.hasOwn(n,`global`)))return{byProject:{},unowned:OW(n)};let r=n.byProject&&typeof n.byProject==`object`?n.byProject:{},i=[];for(let[e,t]of Object.entries(r)){let n=OW(t);n.length!==0&&e&&i.push([e,n])}return{byProject:Object.fromEntries(i),unowned:OW(Object.hasOwn(n,`unowned`)?n.unowned:n.global)}}function AW(e,t){let n=typeof t?.id==`string`?t.id:null;if(!n)return e;let r=e.findIndex(e=>e.id===n);return r<=0?e:[e[r],...e.slice(0,r),...e.slice(r+1)]}function jW(e,t){let n=e||EW(),r=t?.intent;if(!r||typeof r!=`object`)return n;let i=r,a=AW(Array.isArray(i.threads)?OW(i.threads):OW(i),i.active),o=typeof t?.projectId==`string`&&t.projectId?t.projectId:null;if(!o)return{byProject:{...n.byProject},unowned:a};let s={...n.byProject};return a.length===0&&delete s[o],a.length>0&&(s[o]=a),{byProject:s,unowned:n.unowned}}function MW(e,t=null){let n=t&&typeof t.get==`function`?t.get(e):null;return typeof n==`string`&&n?n:e}function NW(e,{key:t,label:n,now:r}){return e.map((e,i)=>({key:`${t}:${e.id||i}`,label:n,text:e.text,hasText:!0,active:i===0,meta:LW(e,r)}))}function PW(e,t=null,n=Date.now()){let r=e||EW(),i=Object.entries(r.byProject||{}).filter(([e,t])=>e&&Array.isArray(t)&&t.length>0).map(([e,n])=>({projectId:e,label:MW(e,t),threads:n})).sort((e,t)=>e.label.localeCompare(t.label)).flatMap(({projectId:e,label:t,threads:r})=>NW(r,{key:e,label:t,now:n})),a=NW(Array.isArray(r.unowned)?r.unowned:[],{key:`unowned`,label:wW,now:n});return i.length+a.length>0?[...a,...i]:[{key:`unowned`,label:wW,text:CW,hasText:!1,active:!1,meta:``}]}function FW(e){return e?.text?`proposed by visions`:``}function IW(e,t=Date.now()){let n=Number(e);return!Number.isFinite(n)||n<=0?``:Gf(Number(t)-n,{rounding:`floor`,wording:`spelled`,suffix:` ago`,justNowBelowSeconds:60})}function LW(e,t=Date.now()){let n=FW(e);if(!n)return``;let r=typeof e?.id==`string`&&e.id?`thread ${e.id}, `:``,i=IW(e?.ts,t);return i?`${r}${n}, ${i}`:`${r}${n}`}function RW(e){let t=Number(e?.range?.start?.line);return!Number.isFinite(t)||t<0?`L?`:`L${Math.floor(t)+1}`}function zW(e){let t=Number(e?.range?.start?.character);return Number.isFinite(t)?t:0}function BW(e){let t=Number(e?.range?.start?.line);return Number.isFinite(t)?t:0}function VW(e){let t=typeof e==`string`?e:``;if(!t)return``;let n=t.lastIndexOf(`/`),r=n===-1?t:t.slice(n+1);if(!r)return t;try{return decodeURIComponent(r)}catch{return r}}function HW(e){return typeof e==`number`&&Number.isFinite(e)?Math.max(Math.floor(e),0):0}function UW(e){let t=HW(e);return t===1?`1 finding`:`${t} findings`}function WW(e){let t=HW(e);return t===1?`1 comment`:`${t} comments`}function GW(e){let t=HW(e?.findings?.length),n=HW(e?.comments?.length),r=typeof e?.hand==`string`&&e.hand?1:0,i=[];return r>0&&i.push(`raised hand`),t>0&&i.push(UW(t)),n>0&&i.push(WW(n)),i.length>0?i.join(`, `):UW(0)}function KW(e){let t=typeof e==`string`?e.trim():``;return t?`Raised hand: ${t}`:``}function qW(e){return(typeof e?.hand==`string`?e.hand.trim():``)||null}function JW(e,t){let n=new Map(e),r=typeof t?.uri==`string`?t.uri:``;if(!r)return n;let i=qW(t);return i?(n.set(r,i),n):(n.delete(r),n)}function YW(e){let t=new Map,n=Array.isArray(e?.documents)?e.documents:[];for(let e of n){let n=typeof e?.uri==`string`?e.uri:``,r=typeof e?.hand==`string`?e.hand.trim():``;n&&r&&t.set(n,r)}return t}var XW=`hand`,ZW=`unseen`,QW=`
|
|
246
|
-
`;function $W(e){let t=2166136261,n=3266489909;for(let r=0;r<e.length;r+=1){let i=e.charCodeAt(r);t=Math.imul(t^i,16777619)>>>0,n=Math.imul(n^i,2246822507)>>>0}return`${t.toString(36).padStart(7,`0`)}${n.toString(36).padStart(7,`0`)}`}function eG(e,t){return $W(JSON.stringify([e,...t]))}function tG(e,t){return eG(`finding`,[e,RW(t),String(t.code??``),String(t.message??``)])}function nG(e,t){return eG(`comment`,[e,sG(t),String(t.message??``)])}function rG(e){return eG(`fix`,[e.uri,vG(e),e.code,e.message,yG(e)])}function iG(e){return eG(`intent`,[e.key,e.text,e.active])}function aG(e,t,n,r=[],i=null){let a=[...n].map(([e,t])=>eG(`hand`,[e,t])).sort(),o=new Set;for(let r of[...e.keys(),...t.keys(),...n.keys()])o.add(eG(`document`,[r]));for(let[t,n]of e)for(let e of n)o.add(tG(t,e));for(let[e,n]of t)for(let t of n)o.add(nG(e,t));for(let e of r)o.add(rG(e));for(let e of PW(i,null,0))e.hasText&&o.add(iG(e));let s=[...o].sort();return{signature:[...a,...s].join(QW),handEntries:a,contentEntries:s}}function oG(e,t){let n=new Set(t.split(QW));return e.handEntries.some(e=>!n.has(e))?XW:e.contentEntries.some(e=>!n.has(e))?ZW:null}function sG(e){let t=Number(e?.line);return!Number.isFinite(t)||t<1?`L?`:`L${Math.floor(t)}`}function cG(e){return Array.isArray(e?.diagnostics)?e.diagnostics:[]}function lG(e,t){let n=new Map(e),r=typeof t?.uri==`string`?t.uri:``;if(!r)return n;let i=cG(t);return i.length===0?(n.delete(r),n):(n.set(r,i),n)}function uG(e){return Array.isArray(e?.comments)?e.comments:[]}function dG(e,t){let n=new Map(e),r=typeof t?.uri==`string`?t.uri:``;if(!r)return n;let i=uG(t);return i.length===0?(n.delete(r),n):(n.set(r,i),n)}function fG(e){let t=new Map,n=Array.isArray(e?.documents)?e.documents:[];for(let e of n){let n=typeof e?.uri==`string`?e.uri:``,r=Array.isArray(e?.diagnostics)?e.diagnostics:[];n&&r.length!==0&&t.set(n,r)}return t}function pG(e){let t=new Map,n=Array.isArray(e?.documents)?e.documents:[];for(let e of n){let n=typeof e?.uri==`string`?e.uri:``,r=Array.isArray(e?.comments)?e.comments:[];n&&r.length!==0&&t.set(n,r)}return t}function mG(e,t=new Map,n=new Map){let r=[],i=new Set([...e.keys(),...t.keys(),...n.keys()]);for(let a of i){let i=e.get(a),o=t.get(a),s=n.get(a)||null,c=Array.isArray(i)?i:[],l=Array.isArray(o)?o:[];(c.length!==0||l.length!==0||s)&&r.push({uri:a,name:VW(a)||a,hand:s,findings:[...c].sort((e,t)=>BW(e)-BW(t)||zW(e)-zW(t)),comments:[...l].sort((e,t)=>(Number(e?.line)||0)-(Number(t?.line)||0))})}return r.sort((e,t)=>hG(e.name,t.name)||hG(e.uri,t.uri)),r}function hG(e,t){return e<t?-1:+(e>t)}var gG=`No fixes yet. Silent fixes appear here once the lane applies or is refused one.`;function _G(e){let t=HW(e);return t===1?`1 fix`:`${t} fixes`}function vG(e){let t=Number(e?.line);return!Number.isFinite(t)||t<0?`L?`:`L${Math.floor(t)+1}`}function yG(e){return e?.applied===!0?`applied`:`refused`}function bG(e,{uri:t=``,ts:n=0}={}){if(!e||typeof e!=`object`)return null;let r=e,i=typeof r.message==`string`?r.message.trim():``;if(!i)return null;let a=Number(r.line),o=Number(r.ts??n);return{uri:typeof r.uri==`string`&&r.uri?r.uri:t,code:typeof r.code==`string`?r.code:``,line:Number.isFinite(a)&&a>0?Math.floor(a):0,message:i,applied:r.applied===!0,ts:Number.isFinite(o)&&o>0?o:0}}function xG(e){let t=typeof e?.uri==`string`?e.uri:``,n=Number(e?.ts);return bG(e?.fix,{uri:t,ts:Number.isFinite(n)?n:0})}function SG(e,t,{max:n=20}={}){let r=xG(t);return r?[r,...e].slice(0,Math.max(0,Math.floor(n))):[...e]}function CG(e,{max:t=20}={}){let n=Array.isArray(e?.fixes)?e.fixes:[],r=[];for(let e of n){let t=bG(e);t&&r.push(t)}return r.slice(0,Math.max(0,Math.floor(t)))}var wG=`No activity yet. The ingest lane reports what your sessions and tools are doing.`,TG={terminal:`terminal`,agentLogs:`agent`,git:`git`,fs:`files`,shellHistory:`shell`,editor:`editor`};function EG(e){let t=typeof e==`string`?e:``;return TG[t]||t||`source`}function DG(e,t=Date.now()){let n=Number(e);return!Number.isFinite(n)||n<=0?``:Gf(Number(t)-n,Vf)}function OG(e){if(!e||typeof e!=`object`)return null;let t=e,n=Number(t.seq);if(!Number.isFinite(n))return null;let r=typeof t.summary==`string`?t.summary.trim():``;if(!r)return null;let i=Number(t.ts),a=t.scope&&typeof t.scope==`object`?t.scope:{};return{seq:Math.floor(n),source:typeof t.source==`string`?t.source:``,kind:typeof t.kind==`string`?t.kind:``,ts:Number.isFinite(i)&&i>0?i:0,summary:r,root:typeof a.root==`string`&&a.root?a.root:null,sessionId:typeof a.sessionId==`string`&&a.sessionId?a.sessionId:null}}function kG(e){let t=Array.isArray(e?.events)?e.events:[],n=[];for(let e of t){let t=OG(e);t&&n.push(t)}return n}function AG(e){let t=Number(e?.overflow);return!Number.isFinite(t)||t<=0?0:Math.floor(t)}function jG(e){let t=HW(e);return t<=0?``:t===1?`1 more event not shown`:`${t} more events not shown`}function MG(e,t){return[...e].sort((e,t)=>t.seq-e.seq).slice(0,Math.max(0,Math.floor(t)))}function NG(e,t,{max:n=100}={}){let r=kG(t);if(r.length===0)return MG(e,n);let i=new Map;for(let t of e)i.set(t.seq,t);for(let e of r)i.set(e.seq,e);return MG([...i.values()],n)}function PG(e,{max:t=100}={}){return MG(kG(e),t)}function FG(e){let t=HW(e);return t===1?`1 event`:`${t} events`}function IG(e){if(!e?.root)return`machine`;let t=e.root.replace(/[\\/]+$/,``),n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return n===-1?t:t.slice(n+1)}var LG=new Map,RG=new Map,zG=new Map,BG=EW(),VG=new Map,HG=null,UG=null,WG=null,GG=null,KG=null,qG=[],JG=0,YG=null,XG=[],ZG=null,QG=aG(LG,RG,zG,XG,BG),$G=dO(),eK=Ek({getAck:()=>$G,setAck:e=>{$G=e,fO(e)},signature:()=>QG.signature,isLooking:()=>!$d(HG)});function tK(){let e=V(`section`,`visions-intent`);e.append(V(`h2`,`visions-intent-title`,`Intent`));let t=V(`div`,`visions-intent-list`);return e.append(t),WG={list:t},e}function nK(e){let t=V(`div`,`visions-intent-item`),n=V(`div`,`visions-intent-head`);n.append(V(`span`,`visions-intent-scope`,e.label),V(`span`,`visions-intent-meta`,e.meta));let r=V(`p`,`visions-intent-text`,e.text);return r.classList.toggle(`visions-intent-none`,!e.hasText),t.classList.toggle(`visions-intent-active`,e.active===!0),t.append(n,r),t}function rK(){WG&&WG.list.replaceChildren(...PW(BG,VG).map(nK))}function iK(e){VG=e instanceof Map?e:new Map,rK()}function aK(e){let t=V(`section`,`visions-doc`),n=V(`div`,`visions-doc-head`),r=V(`h2`,`visions-doc-name`);if(r.textContent=e.name,r.title=e.uri,n.append(r,V(`span`,`visions-doc-count`,GW(e))),t.append(n),e.hand&&t.append(oK(e.hand)),e.findings.length>0){let n=V(`div`,`visions-findings`);for(let t of e.findings)n.append(cK(t));t.append(n)}if(e.comments.length>0){let n=V(`div`,`visions-comments`);for(let t of e.comments)n.append(sK(t));t.append(n)}return t}function oK(e){let t=V(`div`,`visions-hand`);return t.textContent=KW(e),t}function sK(e){let t=V(`div`,`visions-comment`),n=V(`div`,`visions-comment-head`);n.append(V(`span`,`visions-comment-chip`,`visions`)),n.append(V(`span`,`visions-comment-line`,sG(e))),t.append(n);let r=V(`p`,`visions-comment-message`);return r.textContent=e?.message==null?``:String(e.message),t.append(r),t}function cK(e){let t=V(`div`,`visions-finding`);t.append(V(`span`,`visions-finding-line`,RW(e)));let n=e?.code==null?``:String(e.code);n&&t.append(V(`span`,`visions-finding-code`,n));let r=V(`span`,`visions-finding-message`);return r.textContent=e?.message==null?``:String(e.message),t.append(r),t}function lK({force:e=!1}={}){if(!UG||!e&&$d(HG))return;UG.textContent=``;let t=mG(LG,RG,zG);if(t.length===0){let e=V(`p`,`visions-empty`,SW);if(KG===!1){let t=bW(`lanes-visions`,`visions-enabled`,`Enable Visions`);e.append(document.createTextNode(` `),t)}UG.append(e)}else for(let e of t)UG.append(aK(e))}function uK(e){KG=e?.visions?.enabled===!0,lK()}function dK(){let e=V(`section`,`visions-activity`),t=V(`div`,`visions-activity-head`);t.append(V(`h2`,`visions-activity-title`,`Activity`));let n=V(`span`,`visions-activity-count`);t.append(n),e.append(t);let r=V(`div`,`visions-activity-list`);e.append(r);let i=V(`p`,`visions-activity-overflow`);return e.append(i),YG={count:n,list:r,overflow:i},e}function fK(e,t){let n=V(`div`,`visions-activity-row`);n.append(V(`span`,`visions-activity-source`,EG(e.source))),n.append(V(`span`,`visions-activity-age`,DG(e.ts,t))),n.append(V(`span`,`visions-activity-scope`,IG(e)));let r=V(`span`,`visions-activity-summary`);return r.textContent=e.summary,n.append(r),n}function pK({force:e=!1}={}){if(!YG||!e&&$d(HG))return;let{count:t,list:n,overflow:r}=YG;if(t.textContent=FG(qG.length),n.textContent=``,qG.length===0){n.append(V(`p`,`visions-empty`,wG)),r.textContent=``;return}let i=Date.now();for(let e of qG)n.append(fK(e,i));r.textContent=jG(JG)}function mK(){let e=V(`section`,`visions-fixes`),t=V(`div`,`visions-fixes-head`);t.append(V(`h2`,`visions-fixes-title`,`Fixes`));let n=V(`span`,`visions-fixes-count`);t.append(n),e.append(t);let r=V(`div`,`visions-fixes-list`);return e.append(r),ZG={count:n,list:r},e}function hK(e){let t=V(`div`,`visions-fix-row`);t.dataset.applied=e.applied?`yes`:`no`;let n=V(`span`,`visions-fix-file`);n.textContent=VW(e.uri)||e.uri,n.title=e.uri,t.append(n),t.append(V(`span`,`visions-fix-line`,vG(e))),t.append(V(`span`,`visions-fix-outcome`,yG(e))),t.append(V(`span`,`visions-fix-code`,e.code||``));let r=V(`span`,`visions-fix-message`);return r.textContent=e.message,t.append(r),t}function gK({force:e=!1}={}){if(!ZG||!e&&$d(HG))return;let{count:t,list:n}=ZG;if(t.textContent=_G(XG.length),n.textContent=``,XG.length===0)n.append(V(`p`,`visions-empty`,gG));else for(let e of XG)n.append(hK(e))}function _K(){QG=aG(LG,RG,zG,XG,BG),QG.signature!==``&&eK.refresh(),GG&&GG(oG(QG,$G))}function vK(e){GG=e,_K()}function yK(e){if(HG)return HG;let t=V(`div`,`visions-content`);t.append(tK());let n=V(`div`,`visions-feed`);return t.append(n),t.append(mK()),t.append(dK()),e.appendChild(t),HG=t,UG=n,rK(),lK({force:!0}),gK({force:!0}),pK({force:!0}),t}function bK(){rK(),lK({force:!0}),gK({force:!0}),pK({force:!0})}function xK(){QG.signature!==``&&eK.acknowledge(),_K()}function SK(e){XG=SG(XG,e),gK(),_K()}function CK(e){LG=lG(LG,e),lK(),_K()}function wK(e){RG=dG(RG,e),lK(),_K()}function TK(e){zG=JW(zG,e),lK(),_K()}function EK(e){BG=jW(BG,e),rK(),_K()}function DK(e){qG=NG(qG,e),JG=AG(e),pK(),_K()}function OK(e){qG=PG(e),JG=0,pK(),_K()}function kK(e){LG=fG(e),RG=pG(e),zG=YW(e),BG=kW(e),XG=CG(e),rK(),lK(),gK(),_K()}var AK=is(D(),qo());j({glimmervoidId:D().min(1),event:D().min(1),token:D().nullable().optional(),payload:AK}),j({id:D().min(1),name:D().min(1),event:D().min(1),matcher:D().optional(),type:N([`command`,`http`]),command:D().optional(),url:D().optional(),timeout:O().int().positive().optional(),enabled:k(),projects:A(D()).optional()}).passthrough();var jK=`Claude Code hooks injected into every session Glimmervoid spawns.`,MK=`Loading hooks`,NK=`No hooks yet. A hook runs a command, or calls a URL, when a Claude Code event fires in a Glimmervoid session. Start from one of these, or add your own.`,PK=`Start from`,FK=`Filter by name, event or command`,IK=`Nothing matches that filter.`,LK=`Preview`,RK=`The entry this becomes in the per-session settings file.`,zK=`Duplicate`,BK=`Discard changes`,VK=`Close the editor and lose the unsaved changes?`,HK=`Esc cancels. Ctrl+Enter saves.`,UK=`A change reaches a session at its next start or restart. Claude Code sessions only; Codex and Grok sessions do not read this file.`,WK=`Glimmervoid's own hooks`,GK=`Always present, read-only. Status detection depends on them.`,KK=`Your hooks`,qK=`New hook`,JK=`Edit hook`,YK=`Saved to config.json.`,XK=`All projects`,ZK=`This event takes no matcher.`,QK=`Blank uses Claude Code's default for the event.`,$K=Object.freeze([{value:`command`,label:`Command`,hint:`Run a shell command. It receives the event JSON on stdin.`},{value:`http`,label:`HTTP`,hint:`POST the event JSON to a URL.`}]),eq=Object.freeze([{id:`lint`,label:`Lint after edits`,summary:`PostToolUse on Edit|Write`,draft:{name:`Lint after edits`,event:`PostToolUse`,matcher:`Edit|Write`,type:`command`,command:`npx biome check --write "$(jq -r .tool_input.file_path)"`}},{id:`notify`,label:`Notify on Stop`,summary:`Stop, command`,draft:{name:`Notify on Stop`,event:`Stop`,matcher:``,type:`command`,command:`command -v notify-send >/dev/null 2>&1 && notify-send "Claude finished a turn" || { command -v osascript >/dev/null 2>&1 && osascript -e 'display notification "Claude finished a turn" with title "Claude Code"'; }`}},{id:`guard`,label:`Guard destructive Bash`,summary:`PreToolUse on Bash, exit 2 blocks`,draft:{name:`Guard destructive Bash`,event:`PreToolUse`,matcher:`Bash`,type:`command`,command:`jq -r .tool_input.command | grep -Eq "rm -rf|git push --force" && exit 2 || exit 0`}},{id:`log`,label:`Log every prompt`,summary:`UserPromptSubmit, appends JSON`,draft:{name:`Log every prompt`,event:`UserPromptSubmit`,matcher:``,type:`command`,command:`cat >> ~/.claude/prompts.jsonl`}}]),tq=Object.freeze({hooks:[],builtin:[],events:[]});function nq(e){return!e||typeof e.error==`string`}function rq(e){return!e||typeof e.error!=`string`?``:e.error}function iq(e,t){let n=e?.[t];return Array.isArray(n)?n:tq[t]}var aq=e=>iq(e,`hooks`),oq=e=>iq(e,`builtin`),sq=e=>iq(e,`events`);function cq(e){let t=e?.limits?.maxTimeoutSec;return typeof t==`number`&&Number.isInteger(t)&&t>0?t:600}function lq(e,t){if(!e||typeof e!=`object`)return!1;let n=e.requestId;return typeof n!=`string`||!t||n===t}function uq(e){let t=aq(e),n=t.filter(e=>e.enabled!==!1).length;return[{label:`yours`,value:String(t.length),tone:null},{label:`enabled`,value:String(n),tone:t.length>0&&n===0?`warn`:null},{label:`built in`,value:String(oq(e).length),tone:null}]}function dq(e,t){let n=new Map(t.map((e,t)=>[e.name,t])),r=e=>n.get(e.event)??t.length;return[...e].sort((e,t)=>{let n=r(e)-r(t);return n===0?String(e.name).localeCompare(String(t.name)):n})}function fq(e,t){let n=String(t||``).trim().toLowerCase();return n?e.filter(e=>[e.name,e.event,e.matcher,e.command,e.url].some(e=>typeof e==`string`&&e.toLowerCase().includes(n))):e}function pq(e){return e.length>=4}function mq(e){let t=[];for(let n of e){let e=t[t.length-1];e&&e.event===n.event?e.hooks.push(n):t.push({event:n.event,hooks:[n]})}return t}function hq(e){let t=e.type===`http`?{type:`http`,url:e.url||``}:{type:`command`,command:e.command||``};Number.isInteger(e.timeout)&&Number(e.timeout)>0&&(t.timeout=e.timeout);let n=e.matcher?{matcher:e.matcher,hooks:[t]}:{hooks:[t]};return JSON.stringify({hooks:{[e.event]:[n]}},null,2)}function gq(e){return`${e} copy`}function _q(e,t){return e.find(e=>e.name===t)||null}function vq(e,t){let n=_q(e,t);return n?n.matcher?`Matches ${n.matcher}. Blank matches every ${n.name}.`:ZK:``}function yq(e){return e.type===`http`?e.url||``:e.command||``}function bq(e){let t=$K.find(t=>t.value===e);return t?t.label:String(e||``)}function xq(e){return!Number.isInteger(e.timeout)||Number(e.timeout)<=0?``:`${e.timeout}s timeout`}function Sq(e,t){let n=Array.isArray(e.projects)?e.projects:[];return n.length===0?XK:n.map(e=>{let n=t.find(t=>t.id===e);return n?n.name:e}).join(`, `)}function Cq(e){return e.matcher?`${e.event} / ${e.matcher}`:e.event}function wq(e){return Cq(e)}function Tq(e,t){let n=Array.isArray(e.projects)?e.projects:[],r=new Set(t.map(e=>e.id));return n.filter(e=>!r.has(e))}function Eq(e){let t=e[0];return{id:null,name:``,event:t?t.name:``,matcher:``,type:`command`,command:``,url:``,timeout:``,enabled:!0,projects:[]}}function Dq(e){return{id:e.id??null,name:e.name||``,event:e.event||``,matcher:e.matcher||``,type:e.type===`http`?`http`:`command`,command:e.command||``,url:e.url||``,timeout:Number.isInteger(e.timeout)?String(e.timeout):``,enabled:e.enabled!==!1,projects:Array.isArray(e.projects)?[...e.projects]:[]}}function Oq(e,t,n=600){if(!e.name.trim())return`Give the hook a name.`;let r=_q(t,e.event);if(!r)return`Pick an event.`;if(e.matcher.trim()&&!r.matcher)return`${r.name} takes no matcher.`;if(e.type===`http`&&r.http===!1)return`${r.name} does not support HTTP hooks.`;if(e.type===`command`&&!e.command.trim())return`Enter the command to run.`;if(e.type===`http`&&!/^https?:\/\/\S+$/i.test(e.url.trim()))return`Enter a URL starting with http:// or https://.`;if(e.timeout.trim()!==``){let t=Number(e.timeout);if(!Number.isInteger(t)||t<1||t>n)return`Timeout must be a whole number of seconds from 1 to ${n}.`}return null}function kq(e){let t={name:e.name.trim(),event:e.event,type:e.type,enabled:e.enabled!==!1};return e.id&&(t.id=e.id),e.matcher.trim()&&(t.matcher=e.matcher.trim()),e.type===`command`&&(t.command=e.command.trim()),e.type===`http`&&(t.url=e.url.trim()),e.timeout.trim()!==``&&(t.timeout=Number(e.timeout)),e.projects.length>0&&(t.projects=[...e.projects]),t}function Aq(e,t){let n={...Eq(t),...e.draft};return _q(t,n.event)||(n.event=Eq(t).event),n}function jq(e,t){return JSON.stringify(kq(e))!==JSON.stringify(t)}function Mq(e){return{...e,enabled:e.enabled===!1}}function Nq(e){return`Delete the hook "${e.name}"? Sessions already running keep it until they restart.`}var Pq=null,Fq=null,Iq=null,Lq=null,Rq=null,zq=null,Bq=null,Vq=null,Hq=!1,Uq=null,Wq=``,Gq=new Set,Kq=new Set,qq=!1,Jq=(e,t)=>Xd(`hooks`,e,t);function Yq(e,t,n){let r=V(`p`,e,t);return n&&(r.dataset.tone=n),r}function Xq(e,t,n,r){let i=V(`button`,e,t);return i.type=`button`,r&&i.setAttribute(`aria-label`,r),i.addEventListener(`click`,n),i}function Zq(e){if(!Iq)return null;let t=Md(`hooks`);return Iq({requestId:t,...e}),t}function Qq(e,t,n){let r=V(`label`,`hooks-field`);return r.append(V(`span`,`hooks-field-label`,e),t),n&&r.append(V(`span`,`hooks-field-hint`,n)),r}function $q(e,t,n){let r=V(`input`,`settings-view-input`);return r.type=`text`,r.value=e,r.autocomplete=`off`,r.spellcheck=!1,t&&(r.placeholder=t),r.addEventListener(`input`,()=>n(r.value)),r}function eJ(e,t){let n=V(`textarea`,`settings-view-input hooks-command`);return n.rows=3,n.value=e,n.spellcheck=!1,n.addEventListener(`input`,()=>t(n.value)),n}function tJ(e,t,n){let r=V(`select`,`settings-view-input hooks-select`);for(let n of t){let t=V(`option`,null,n.name);t.value=n.name,t.title=n.description,n.name===e.event&&(t.selected=!0),r.append(t)}return r.addEventListener(`change`,()=>n(r.value)),r}function nJ(e,t){let n=V(`div`,`hooks-type-row`);n.setAttribute(`role`,`radiogroup`);for(let r of $K){let i=V(`label`,`settings-view-toggle hooks-choice`),a=V(`input`,`settings-view-checkbox`);a.type=`radio`,a.name=`hooks-type`,a.value=r.value,a.checked=e.type===r.value,a.title=r.hint,a.addEventListener(`change`,()=>{a.checked&&t(r.value)}),i.append(a,V(`span`,null,r.label)),n.append(i)}return n}function rJ(e,t){let n=V(`div`,`hooks-projects`);if(t.length===0)return n.append(V(`span`,`hooks-field-hint`,XK)),n;let r=V(`label`,`settings-view-project-choice hooks-choice`),i=V(`input`,`settings-view-checkbox`);i.type=`checkbox`,i.checked=e.projects.length===0,r.append(i,V(`span`,null,XK)),n.append(r);let a=[];for(let r of t){let t=V(`label`,`settings-view-project-choice hooks-choice`),o=V(`input`,`settings-view-checkbox`);o.type=`checkbox`,o.value=r.id,o.checked=e.projects.includes(r.id),o.addEventListener(`change`,()=>{e.projects=a.filter(e=>e.checked).map(e=>e.value),i.checked=e.projects.length===0}),a.push(o),t.append(o,V(`span`,null,r.name)),r.agent!==`claude-code`&&(t.append(V(`span`,`hooks-choice-note`,r.agent)),t.title=`Not a Claude Code project: this hook will not reach its sessions.`),n.append(t)}return i.addEventListener(`change`,()=>{if(!i.checked)i.checked=e.projects.length===0;else{for(let e of a)e.checked=!1;e.projects=[]}}),n}function iJ(e){let t=V(`div`,`hooks-templates`);t.append(V(`span`,`hooks-templates-label`,PK));for(let n of eq){let r=Xq(`hooks-chip`,n.label,()=>sJ(null,Aq(n,e)));r.title=n.summary,t.append(r)}return t}function aJ(e){Vq&&(Vq.textContent=e||``,Vq.hidden=!e)}function oJ(e){let t=sq(Pq),n=Qd(Pq),r=Jq(e.id?JK:qK,YK);r.classList.add(`hooks-editor`);let i=V(`form`,`hooks-form`);i.addEventListener(`submit`,e=>{e.preventDefault(),uJ()}),i.addEventListener(`keydown`,e=>{e.key===`Escape`?(e.preventDefault(),lJ()):e.key===`Enter`&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),uJ())}),e.id||i.append(iJ(t));let a=V(`span`,`hooks-field-hint`,vq(t,e.event)),o=$q(e.matcher,``,t=>{e.matcher=t}),s=Qq(`Command`,eJ(e.command,t=>{e.command=t}),`Runs through the shell with the event JSON on stdin. Exit 2 blocks the action where the event allows it.`),c=Qq(`URL`,$q(e.url,`http://127.0.0.1:8080/hook`,t=>{e.url=t}),`Claude Code POSTs the event JSON to it.`),l=()=>{s.hidden=e.type!==`command`,c.hidden=e.type!==`http`};l();let u=Qq(`Matcher`,o,null);u.append(a);let d=()=>{let n=t.find(t=>t.name===e.event);a.textContent=vq(t,e.event),o.disabled=!!n&&!n.matcher,o.disabled&&(o.value=``,e.matcher=``)};d();let f=V(`input`,`settings-view-input hooks-timeout`);f.type=`number`,f.inputMode=`numeric`,f.min=`1`,f.max=String(cq(Pq)),f.value=e.timeout,f.addEventListener(`input`,()=>{e.timeout=f.value});let p=V(`label`,`settings-view-toggle hooks-choice`),m=V(`input`,`settings-view-checkbox`);m.type=`checkbox`,m.checked=e.enabled,m.addEventListener(`change`,()=>{e.enabled=m.checked}),p.append(m,V(`span`,null,`Enabled`)),i.append(Qq(`Name`,$q(e.name,`Lint after edits`,t=>{e.name=t}),null),Qq(`Event`,tJ(e,t,t=>{e.event=t,d()}),null),u,Qq(`Type`,nJ(e,t=>{e.type=t,l()}),null),s,c,Qq(`Timeout (seconds)`,f,QK),Qq(`Projects`,rJ(e,n),null),Qq(``,p,null)),Vq=V(`p`,`hooks-editor-error`),Vq.setAttribute(`role`,`alert`),Vq.hidden=!0;let h=V(`div`,`hooks-editor-footer`),g=V(`span`,`hooks-editor-shortcut`,HK),_=Xq(`btn-dialog btn-dialog-cancel`,`Cancel`,lJ),v=V(`button`,`btn-dialog btn-dialog-confirm`,e.id?`Save changes`:`Add hook`);return v.type=`submit`,h.append(Vq,g,_,v),i.append(h),r.append(i),r}function sJ(e,t=null){Rq=t||(e?Dq(e):Eq(sq(Pq))),zq=kq(e?Dq(e):Eq(sq(Pq))),Bq=oJ(Rq),xJ({force:!0}),Bq.scrollIntoView({block:`nearest`});let n=Bq.querySelector(`input[type=text]`);n instanceof HTMLInputElement&&n.focus()}function cJ(){Rq=null,zq=null,Bq=null,Vq=null,Hq=!1,Uq=null,qq=!0,xJ({force:!0})}function lJ(){!Rq||!zq||!jq(Rq,zq)?cJ():kf({title:BK,message:VK,confirmLabel:`Discard`,danger:!0,onConfirm:cJ})}function uJ(){if(!Rq||Hq)return;let e=Oq(Rq,sq(Pq),cq(Pq));e?aJ(e):(Hq=!0,aJ(``),Uq=Zq({type:`save-hook`,hook:kq(Rq)}),Uq||(Hq=!1))}function dJ(e){let t=V(`details`,`hooks-preview`);t.open=Gq.has(e.id),t.addEventListener(`toggle`,()=>{t.open?Gq.add(e.id):Gq.delete(e.id)});let n=V(`summary`,`hooks-preview-summary`,LK);n.title=RK;let r=V(`pre`,`hooks-preview-code`,hq(e));return t.append(n,r),t}function fJ(e,{grouped:t=!1}={}){let n=Qd(Pq),r=V(`article`,`hooks-row`);r.setAttribute(`aria-label`,e.name),e.enabled===!1&&(r.dataset.state=`off`);let i=V(`div`,`hooks-row-main`),a=V(`div`,`hooks-row-head`);a.append(V(`span`,`hooks-row-name`,e.name));let o=t?e.matcher||``:Cq(e);o&&a.append(V(`span`,`hooks-row-event`,o));let s=V(`code`,`hooks-row-target`,yq(e));s.title=yq(e);let c=V(`p`,`hooks-row-meta`,[bq(e.type),xq(e),Sq(e,n)].filter(Boolean).join(` / `));i.append(a,s,c);let l=Tq(e,n);l.length>0&&i.append(Yq(`hooks-row-meta`,`Scoped to a project no longer in config: ${l.join(`, `)}`,`warn`)),i.append(dJ(e));let u=V(`div`,`hooks-row-actions`),d=V(`label`,`settings-view-toggle hooks-choice`),f=V(`input`,`settings-view-checkbox`);f.type=`checkbox`,f.checked=e.enabled!==!1,f.disabled=Kq.has(e.id),f.setAttribute(`aria-label`,`${e.name} enabled`),f.addEventListener(`change`,()=>{Kq.add(e.id),f.disabled=!0,Zq({type:`save-hook`,hook:Mq(e)})}),d.append(f,V(`span`,null,`On`));let p=Xq(`hooks-btn`,`Edit`,()=>sJ(e),`Edit ${e.name}`),m=Xq(`hooks-btn`,zK,()=>{let t=Dq({...e,name:gq(e.name)});t.id=null,sJ(null,t)},`Duplicate ${e.name}`),h=Xq(`hooks-btn hooks-btn-danger`,`Delete`,()=>{kf({title:`Delete hook`,message:Nq(e),confirmLabel:`Delete`,danger:!0,onConfirm:()=>{Kq.add(e.id),Zq({type:`delete-hook`,id:e.id}),xJ({force:!0})}})},`Delete ${e.name}`);return h.disabled=Kq.has(e.id),u.append(d,p,m,h),r.append(i,u),r}function pJ(e){let t=V(`article`,`hooks-row hooks-row-builtin`),n=V(`div`,`hooks-row-main`);return n.append(V(`span`,`hooks-row-event`,wq(e)),V(`p`,`hooks-row-meta`,e.purpose)),t.append(n),t}function mJ(){let e=Jq(`Hooks`,jK),t=V(`div`,`hooks-stats`);for(let e of uq(Pq))t.append(Zd(`hooks`,e.label,e.value,e.tone));return e.append(t,Yq(`hooks-meta`,UK)),e}function hJ(){let e=V(`input`,`settings-view-input hooks-filter`);return e.type=`search`,e.value=Wq,e.placeholder=FK,e.setAttribute(`aria-label`,FK),e.addEventListener(`input`,()=>{Wq=e.value;let t=Fq?.querySelector(`.hooks-list-yours`);t&&t.replaceWith(_J())}),e}function gJ(){let e=V(`div`,`hooks-empty-state`);return e.append(Yq(`hooks-empty`,NK),iJ(sq(Pq))),e}function _J(){let e=V(`div`,`hooks-list-yours`),t=aq(Pq);if(t.length===0)return e.append(gJ()),e;let n=fq(dq(t,sq(Pq)),Wq);if(n.length===0)return e.append(Yq(`hooks-empty`,IK)),e;for(let t of mq(n)){let n=V(`div`,`hooks-group`);n.append(V(`h3`,`hooks-group-title`,t.event));let r=V(`div`,`hooks-list`);for(let e of t.hooks)r.append(fJ(e,{grouped:!0}));n.append(r),e.append(n)}return e}function vJ(){let e=Jq(KK,null),t=Xq(`hooks-btn hooks-btn-add`,`+ New hook`,()=>sJ(null));t.disabled=!!Rq;let n=e.querySelector(`.hooks-section-head`);return n&&n.append(t),pq(aq(Pq))&&e.append(hJ()),e.append(_J()),e}function yJ(){let e=V(`details`,`hooks-builtin`),t=V(`summary`,`hooks-builtin-summary`);t.append(V(`span`,`hooks-section-title`,`${WK} (${oq(Pq).length})`),V(`span`,`hooks-section-hint`,GK));let n=V(`div`,`hooks-list`);for(let e of oq(Pq))n.append(pJ(e));return e.append(t,n),e}function bJ(){let e=V(`div`,`hooks-content`);return Pq?nq(Pq)?(e.append(Yq(`hooks-warning`,rq(Pq))),e):(e.append(mJ()),Bq&&e.append(Bq),e.append(vJ(),yJ()),e):(e.append(Yq(`hooks-empty`,MK)),e)}function xJ({force:e=!1}={}){if(!Fq||!e&&$d(Fq)||(Fq.replaceChildren(bJ()),!qq))return;qq=!1;let t=Fq.querySelector(`.hooks-btn-add`);t instanceof HTMLButtonElement&&t.focus()}function SJ(e){Iq=e}function CJ(){Iq&&(Lq=Md(`hooks-report`),Iq({type:`request-hooks-report`,requestId:Lq}))}function wJ(e){Fq||(Fq=V(`div`,`hooks-panel`),e.append(Fq),xJ({force:!0}))}function TJ(){xJ({force:!0})}function EJ(e){lq(e,Lq)&&(Pq=e,Kq.clear(),Hq=!1,xJ())}function DJ(e){let t=Uq!==null&&e.requestId===Uq;if(t&&(Uq=null,Hq=!1),e.ok){t&&cJ(),CJ();return}let n=typeof e.error==`string`&&e.error?e.error:`Could not save the hook`;t?aJ(n):(rS(n,{persist:!0}),CJ())}function OJ(e){e.ok||rS(typeof e.error==`string`&&e.error?e.error:`Could not delete the hook`,{persist:!0}),CJ()}function kJ(e,t,n){return{body:String(n||`Session needs attention`),tag:`glimmervoid-${e||``}-${t||``}`,renotify:!0,silent:!0}}var AJ=4e3;function jJ(e,t){return`glimmervoid-notify-claim-${e||``}-${t||``}`}function MJ(e,t,n,r=AJ){try{let i=e.getItem(t);if(i){let e=Number(i);if(Number.isFinite(e)&&n-e<r)return!1}return e.setItem(t,String(n)),!0}catch{return!0}}function NJ(){return typeof Notification>`u`?null:Notification}function PJ(){return NJ()!==null}function FJ(){let e=NJ();return e?e.permission:`unavailable`}async function IJ(){let e=NJ();if(!e)return`denied`;if(e.permission!=="default")return e.permission;try{return await e.requestPermission()}catch{return e.permission}}function LJ(){let e=NJ();e&&DD()&&e.permission==="default"&&IJ()}function RJ({session:e,category:t,message:n,kind:r,ignoreFocus:i=!1}={}){let a=NJ();if(a&&DD()&&a.permission===`granted`&&(i||typeof document>`u`||typeof document.hasFocus!=`function`||!document.hasFocus())&&MJ(window.localStorage,jJ(e,t),Date.now()))try{let i=new a(`Glimmervoid`,kJ(e,t,n));i.onclick=()=>{window.focus(),r===`plan`&&typeof e==`string`&&(window.location.hash=JL(e)),i.close()}}catch{}}function zJ(e){return e.filter(e=>!e.hasOwnPhoneScreen).map(e=>{let t=e.label.trim();return{id:e.view,label:t,glyph:e.glyph||t.charAt(0).toUpperCase(),el:e.el}})}var BJ=[{name:`glimmervoid`,state:F.RUNNING,awaitingBackgroundTasks:!1},{name:`glimmervoid (2)`,state:F.RUNNING,awaitingBackgroundTasks:!0},{name:`api`,state:F.WAITING,awaitingBackgroundTasks:!1},{name:`docs-site`,state:F.IDLE,awaitingBackgroundTasks:!1}];function VJ(){let e=V(`div`,`compact-status-preview`);e.setAttribute(`role`,`img`),e.setAttribute(`aria-label`,`Example sidebar sessions showing how status appears with this setting`);for(let t of BJ){let{pill:n,refs:r}=dU(`div`,`focus-pill compact-status-preview-pill`);r.name.textContent=t.name,fU(n,r,t.state,t.awaitingBackgroundTasks),e.append(n)}return e}var HJ=null,UJ=null,WJ=null,GJ=null,KJ=-1,qJ=null,JJ=1;function YJ(){if(!HJ||qJ===null)return;let e=oD({viewportWidthPx:document.documentElement.clientWidth,viewportHeightPx:document.documentElement.clientHeight,verticalProgress:qJ});Vd(HJ,sD(e,JJ))}function XJ(){GJ!==null&&(clearTimeout(GJ),GJ=null)}function ZJ(e=FD()){return QE({isEnabled:e,hasReducedMotion:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,isPhone:vf(),options:wO()})}function QJ(e,t){if(!HJ||!UJ||!WJ||ZJ())return;let n=wO();XJ();let r=ZE(n,KJ,Math.random,t);if(HJ.onanimationend=null,HJ.style.animation=`none`,!r){GJ=setTimeout(()=>QJ(!1),1e3);return}qJ=r.verticalProgress,JJ=n.flyingAnimalsScale,YJ();let i=WE[r.animalIndex];UJ.className=`nyan-sprite ${i.sprite}`,WJ.className=`nyan-trail ${i.trail}`,KJ=r.animalIndex,HJ.offsetWidth,HJ.style.animation=`nyan-fly ${r.durationSeconds}s linear`,e&&(HJ.style.animationDelay=`-${r.firstDelaySeconds}s`),HJ.onanimationend=e=>{HJ&&e.target===HJ&&(HJ.onanimationend=null,HJ.style.animation=`none`,GJ=setTimeout(()=>QJ(!1),r.gapMs))}}function $J(){HJ||ZJ()||(HJ=document.createElement(`div`),HJ.className=`nyan-flight`,HJ.setAttribute(`aria-hidden`,`true`),WJ=document.createElement(`div`),UJ=document.createElement(`div`),HJ.append(WJ,UJ),document.body.appendChild(HJ),window.addEventListener(`resize`,YJ),window.addEventListener(`orientationchange`,YJ),QJ(!0))}function eY(e){$J(),QJ(!1,e)}function tY(){XJ(),window.removeEventListener(`resize`,YJ),window.removeEventListener(`orientationchange`,YJ),HJ?.remove(),HJ=null,UJ=null,WJ=null,KJ=-1,qJ=null}var nY=!1;function rY(e){let t=document.documentElement;if(nY||(nY=!0,yf(()=>rY(FD())),window.matchMedia(`(prefers-reduced-motion: reduce)`).addEventListener(`change`,()=>rY(FD()))),e){if(t.dataset.flyingAnimals=`true`,ZJ(e)){tY();return}$J()}else delete t.dataset.flyingAnimals,tY()}function iY(){let e=V(`div`),t=V(`p`,`flying-animals-status`);t.id=`flying-animals-gallery-status`,t.setAttribute(`role`,`status`);let n=V(`div`,`flying-animals-gallery`);n.setAttribute(`aria-label`,`Animal gallery`);let r=[],i=()=>{let e=ZJ(),n=YE(wO().flyingAnimalsExcludedSprites);t.textContent=[e,n?``:`No animals are included, so automatic flights are paused.`].filter(Boolean).join(` `);for(let t of r)t.disabled=e!==null},a=wO();for(let e of WE){let o=V(`article`,`flying-animal-tile`),s=OO(e),c=V(`label`,`flying-animal-include`),l=V(`input`,`settings-view-checkbox`);l.type=`checkbox`,l.checked=!a.flyingAnimalsExcludedSprites.includes(e.sprite),l.setAttribute(`aria-label`,`Include ${e.name}`),l.addEventListener(`change`,()=>{let t=new Set(wO().flyingAnimalsExcludedSprites);l.checked&&t.delete(e.sprite),l.checked||t.add(e.sprite),CO([...t]),rY(FD()),i()}),c.append(l,document.createTextNode(`Include`));let u=V(`button`,`btn-dialog btn-dialog-cancel`,`Fly now`);u.type=`button`,u.setAttribute(`aria-describedby`,t.id),u.addEventListener(`click`,()=>eY(e.sprite)),r.push(u),o.append(s,V(`h2`,`flying-animal-name`,e.name),c,u),n.append(o)}return i(),e.append(t,n),e}var aY=`johncwaters/glimmervoid`,oY=Object.freeze([`opened`,`checks-failed`,`review-requested`,`approved`,`commented`,`merged`]),sY=Object.freeze([`notify`,`spawn`,`label`,`comment`]),cY=2e4,lY=65536,uY=50,dY=/^[a-z0-9][a-z0-9-]{0,63}$/,fY=/[\x00-\x1f\x7f,]|^-/,pY=(e,t)=>{let n=`${e} must be an integer between ${t.min} and ${t.max}`;return O({error:n}).int({error:n}).min(t.min,{error:n}).max(t.max,{error:n})},mY=k({error:`workflows.enabled must be a boolean`}),hY=pY(`workflows.maxConcurrentSessions`,VE),gY=pY(`workflows.maxActionsPerPoll`,HE),_Y=(e,t)=>A(t,{error:`${e} must be an array`}).min(1,{error:`${e} must list at least one entry when present`}),vY=D({error:`a workflow label name must be a string`}).trim().min(1,{error:`a workflow label name must not be empty`}).max(uY,{error:`a workflow label name must be at most ${uY} characters`}).refine(e=>!fY.test(e),{error:`a workflow label name must not start with a dash or hold a comma or control character`}),yY=D({error:`a workflow comment body must be a string`}).min(1,{error:`a workflow comment body must not be empty`}).max(lY,{error:`a workflow comment body must be at most ${lY} characters`}).refine(e=>e.trim().length>0,{error:`a workflow comment body must not be blank`}),bY=N(oY,{error:`workflows.rules[].trigger must be one of ${oY.join(`, `)}`}),xY=ns(`type`,[M({type:P(`notify`)}),M({type:P(`spawn`),promptTemplate:D({error:`a spawn action needs a promptTemplate string`}).min(1,{error:`a spawn action promptTemplate must not be empty`}).max(cY,{error:`a spawn action promptTemplate must be at most ${cY} characters`}).refine(e=>e.trim().length>0,{error:`a spawn action promptTemplate must not be blank`})}),M({type:P(`label`),name:vY}),M({type:P(`comment`),body:yY})],{error:`workflows.rules[].actions[].type must be one of ${sY.join(`, `)}`}),SY=M({mine:k({error:`workflows.rules[].filters.mine must be a boolean`}).optional(),teamReviewRequested:k({error:`workflows.rules[].filters.teamReviewRequested must be a boolean`}).optional(),authors:_Y(`workflows.rules[].filters.authors`,D({error:`workflows.rules[].filters.authors must hold GitHub logins`}).regex(Ds,{error:`workflows.rules[].filters.authors must hold GitHub logins`})).optional(),labels:_Y(`workflows.rules[].filters.labels`,vY).optional(),baseBranches:_Y(`workflows.rules[].filters.baseBranches`,D({error:`workflows.rules[].filters.baseBranches must hold branch names`}).min(1,{error:`workflows.rules[].filters.baseBranches must hold branch names`})).optional()},{error:`workflows.rules[].filters must be an object`}),CY=D({error:`workflows.rules[].id must be a string`}).regex(dY,{error:`workflows.rules[].id must be 1 to 64 lowercase letters, digits and dashes, starting with a letter or digit`}),wY=k({error:`workflows.rules[].enabled must be a boolean`}),TY=M({id:CY,name:D({error:`workflows.rules[].name must be a string`}).trim().min(1,{error:`workflows.rules[].name must not be empty`}).max(80,{error:`workflows.rules[].name must be at most 80 characters`}),enabled:wY.default(!1),repos:_Y(`workflows.rules[].repos`,Ul),filters:SY.default({}),trigger:bY,actions:_Y(`workflows.rules[].actions`,xY)},{error:`workflows.rules[] must be an object`}),EY=M({enabled:mY.default(!0),maxConcurrentSessions:hY.default(2),maxActionsPerPoll:gY.default(20),rules:A(TY,{error:`workflows.rules must be an array`}).default([])},{error:`workflows must be an object`}).superRefine((e,t)=>{let n=new Set;for(let[r,i]of e.rules.entries())n.has(i.id)?t.addIssue({code:`custom`,path:[`rules`,r,`id`],message:`workflows.rules[${r}].id "${i.id}" is declared more than once`}):n.add(i.id)}),DY=M({id:CY,enabled:wY},{error:`a dashboard update of workflows.rules[] carries only id and enabled`});M({enabled:mY.optional(),maxConcurrentSessions:hY.optional(),maxActionsPerPoll:gY.optional(),rules:A(DY,{error:`workflows.rules must be an array`}).optional()},{error:`a dashboard update of workflows carries only enabled, maxConcurrentSessions, maxActionsPerPoll and rule toggles`});var OY=O().int().nonnegative(),kY=N([`SUCCESS`,`FAILURE`,`PENDING`,`ERROR`,`EXPECTED`]).nullable();fu.extend({author:j({login:D()}).nullable(),labels:j({nodes:A(j({name:D()}))}),comments:j({totalCount:OY})});var AY=M({polledAtMs:OY,prs:A(M({repo:Ul,number:O().int().positive(),title:D(),url:wo(),author:D().nullable(),state:N([`OPEN`,`MERGED`,`CLOSED`]),createdAt:D(),mergedAt:D().nullable(),isDraft:k(),isCrossRepository:k(),baseRefName:D(),headRefName:D().min(1),headRefOid:I,labels:A(D()),commentCount:OY,reviewRequests:A(D()),checksState:kY,reviewDecision:N([`APPROVED`,`CHANGES_REQUESTED`,`REVIEW_REQUIRED`]).nullable()}))});M({repos:is(D().regex(/^[a-z0-9][a-z0-9._-]*\/[a-z0-9][a-z0-9._-]*$/),AY)});var jY={maxConcurrentInvestigations:Math.ceil,minUsersToInvestigate:Math.ceil,userEscalationThreshold:Math.ceil,trafficSpikeMinUsers:Math.ceil,trafficSpikeBaselineDays:Math.floor};[...Object.entries(jY).map(([e,t])=>({path:[`posthog`,e],min:1,round:t}))];var MY=Object.freeze([`auto`,`calculate`,`display`]),NY=Object.freeze([`codex`,`grok`]),PY=Object.freeze([`dailyUsd`,`monthlyUsd`]),FY=e=>k({error:`${e} must be a boolean`}).optional(),IY=(e,t=!1)=>{let n=D({error:`${e} must be a string`});return(t?n.transform(e=>e.trim()):n).optional()},LY=e=>e.label?e.label:e.max==null?e.exclusiveMin?`greater than ${e.min}`:`at least ${e.min}`:`between ${e.min} and ${e.max}`,RY=(e,t=cE)=>O({error:`${e} must be ${LY(t)}`}).finite().refine(e=>!t.exclusiveMin||e>t.min,{message:`${e} must be ${LY(t)}`}).refine(e=>t.exclusiveMin||e>=t.min,{message:`${e} must be ${LY(t)}`}).refine(e=>t.max==null||e<=t.max,{message:`${e} must be ${LY(t)}`}).optional(),zY=(e,t)=>RY(e,t).unwrap().int({error:`${e} must be a whole number ${LY(t)}`}).optional(),BY=(e,t)=>O({error:`${e} must be an integer between ${t.min} and ${t.max}`}).int({error:`${e} must be an integer between ${t.min} and ${t.max}`}).min(t.min,{error:`${e} must be an integer between ${t.min} and ${t.max}`}).max(t.max,{error:`${e} must be an integer between ${t.min} and ${t.max}`}).optional(),VY=(e,t)=>j(t,{error:`${e} must be an object`}).nullable().optional(),HY=Object.freeze([`claude`,`codex`]),UY=Object.freeze([`release`,`main`]),WY=Object.freeze([`report`,`fix`]);VY(`changeMap`,{narrator:VY(`changeMap.narrator`,{enabled:FY(`changeMap.narrator.enabled`),engine:N(HY,{error:`changeMap.narrator.engine must be one of ${HY.join(`, `)}`}).optional(),model:IY(`changeMap.narrator.model`,!0),timeoutSeconds:BY(`changeMap.narrator.timeoutSeconds`,zE)})}),j({refiner:j({enabled:FY(`taskTitle.refiner.enabled`),model:IY(`taskTitle.refiner.model`,!0),minIntervalSeconds:RY(`taskTitle.refiner.minIntervalSeconds`,{min:0}),timeoutSeconds:RY(`taskTitle.refiner.timeoutSeconds`,{min:0,exclusiveMin:!0,max:2147483647/1e3})},{error:`taskTitle.refiner must be an object`}).nullable().optional()},{error:`taskTitle must be an object`}).nullable().optional();var GY={enabled:FY(`branchGc.enabled`),worktrees:FY(`branchGc.worktrees`),prefixes:A(D({error:`branchGc.prefixes must be an array of strings`}).min(1,{error:`branchGc.prefixes entries must be non-empty strings`}),{error:`branchGc.prefixes must be an array of strings`}).optional(),dryRun:FY(`branchGc.dryRun`),staleDays:RY(`branchGc.staleDays`,mE),deleteUnmerged:FY(`branchGc.deleteUnmerged`),intervalMs:RY(`branchGc.intervalMs`,hE)},KY=j(GY,{error:`branchGc must be an object`});VY(`branchGc`,GY),KY.omit({prefixes:!0,dryRun:!0,worktrees:!0}).nullable().optional(),Object.freeze([`enabled`,`deleteUnmerged`]),Object.freeze([`staleDays`,`intervalMs`]),VY(`postTurnChecks`,{mode:N(WY,{error:`postTurnChecks.mode must be one of report, fix`}).optional()}),VY(`visions`,{enabled:FY(`visions.enabled`),autoFix:FY(`visions.autoFix`),projects:A(D({error:`visions.projects must be an array of strings`}),{error:`visions.projects must be an array of strings`}).optional(),dispatch:VY(`visions.dispatch`,{enabled:FY(`visions.dispatch.enabled`),model:IY(`visions.dispatch.model`,!0),quietMs:zY(`visions.dispatch.quietMs`,gE),cooldownMs:zY(`visions.dispatch.cooldownMs`,_E),maxPerHour:zY(`visions.dispatch.maxPerHour`,vE),activityMaxPerHour:zY(`visions.dispatch.activityMaxPerHour`,yE),dispatchTimeoutSeconds:zY(`visions.dispatch.dispatchTimeoutSeconds`,bE)}),intent:VY(`visions.intent`,{threadTtlMs:zY(`visions.intent.threadTtlMs`,xE)})}),j({teams:A(D({error:`github.teams must be an array of org/slug strings`}).refine(e=>As(e)!==null,{message:`github.teams entries must be org/slug with valid GitHub segments`}),{error:`github.teams must be an array of org/slug strings`}).optional()},{error:`github must be an object`}).nullable().optional(),VY(`teamReview`,{enabled:FY(`teamReview.enabled`),autoRebaseMyPrs:FY(`teamReview.autoRebaseMyPrs`),keepMergeableEnabled:FY(`teamReview.keepMergeableEnabled`),mergeQueueEnabled:FY(`teamReview.mergeQueueEnabled`),keepMergeableTimeoutMinutes:BY(`teamReview.keepMergeableTimeoutMinutes`,BE),org:IY(`teamReview.org`,!0),team:IY(`teamReview.team`,!0),skill:IY(`teamReview.skill`,!0),reReviewAfterHours:RY(`teamReview.reReviewAfterHours`),skipIdleAfterDays:RY(`teamReview.skipIdleAfterDays`)}),VY(`benchmarks`,{enabled:FY(`benchmarks.enabled`)}),j({enabled:FY(`factory.enabled`),maxRisk:mc.optional(),maxLiveWorkers:O().int().min(sE.min).optional(),checks:A(D().trim().min(1)).optional(),protectedPaths:A(D().trim().min(1)).optional(),reviewerModel:D().trim().min(1).nullable().optional(),dailyBudgetUsd:O().finite().nonnegative().nullable().optional(),verifierModel:D().trim().min(1).nullable().optional(),mirrorHarnessRuns:FY(`factory.mirrorHarnessRuns`)}).nullable().optional(),VY(`knowledgeGraph`,{enabled:FY(`knowledgeGraph.enabled`)});var qY={intervalMinutes:SE,maxConcurrentInvestigations:CE,investigationTimeoutSeconds:wE,fixTimeoutSeconds:kE,minUsersToInvestigate:TE,userEscalationThreshold:EE,recurrenceWindowDays:DE,transientRecurrenceLimit:OE,trafficSpikeMultiplier:AE,trafficSpikeMinUsers:jE,trafficSpikeCooldownMinutes:ME,trafficSpikeBaselineDays:NE};VY(`posthog`,{enabled:FY(`posthog.enabled`),recurrenceDedupe:FY(`posthog.recurrenceDedupe`),trafficSpikeEnabled:FY(`posthog.trafficSpikeEnabled`),autoFix:FY(`posthog.autoFix`),host:IY(`posthog.host`,!0).refine(e=>e==null||!e||/^https?:\/\//i.test(e),{message:`posthog.host must be an http(s) URL`}),apiKey:IY(`posthog.apiKey`,!0),repoPath:IY(`posthog.repoPath`,!0),projects:es([P(`all`),A(O({error:`posthog.projects must be "all" or an array of positive integer project ids`}).int({error:`posthog.projects must be "all" or an array of positive integer project ids`}).positive({error:`posthog.projects must be "all" or an array of positive integer project ids`}),{error:`posthog.projects must be "all" or an array of positive integer project ids`})],{error:`posthog.projects must be "all" or an array of positive integer project ids`}).optional(),projectMap:is(D(),qo(),{error:`posthog.projectMap must be an object`}).optional(),...Object.fromEntries(Object.entries(qY).map(([e,t])=>[e,Object.hasOwn(jY,e)?zY(`posthog.${e}`,t):RY(`posthog.${e}`,t)]))}),`${MY.join(`, `)}`,Object.fromEntries(NY.map(e=>[e,FY(`usage.vendors.${e}`)])),Object.fromEntries(PY.map(e=>[e,O({error:`usage.budget.${e} must be a positive number or null`}).positive({error:`usage.budget.${e} must be a positive number or null`}).nullable().optional()])),VY(`telegram`,{botToken:IY(`telegram.botToken`,!0),chatId:IY(`telegram.chatId`,!0)}),j({enabled:FY(`ingest.enabled`)},{error:`ingest must be an object`}).passthrough().optional(),j({enabled:FY(`trace.enabled`)},{error:`trace must be an object`}).optional(),j({enabled:FY(`planReview.enabled`)},{error:`planReview must be an object`}).optional();var JY=e=>A(D({error:`${e} must be an array of paths`}).trim().min(1,{error:`${e} must be an array of paths`}),{error:`${e} must be an array of paths`}).optional();j({unguardedRepos:JY(`guardrails.unguardedRepos`),blockedPaths:JY(`guardrails.blockedPaths`),unreadablePaths:JY(`guardrails.unreadablePaths`)},{error:`guardrails must be an object`}).passthrough().optional();var YY={enabled:FY(`telemetry.enabled`)};j(YY,{error:`telemetry must be an object`}).strict().optional(),j(YY,{error:`telemetry must be an object`}).passthrough().optional();function XY(e){return e.map(e=>({value:e,label:e[0].toUpperCase()+e.slice(1)}))}var ZY=Object.freeze({general:`machine-general`,updates:`machine-updates`,terminal:`machine-terminal`,repos:`machine-repositories`,repositories:`machine-repositories`,advanced:`machine-detection-sessions`,detection:`machine-detection-sessions`,telegram:`machine-telegram`,notifications:`machine-telegram`,"change-map":`lanes-change-map`,visions:`lanes-visions`,ingest:`lanes-ingest`,posthog:`lanes-posthog`,"team-review":`lanes-team-review`,reviews:`lanes-team-review`,benchmarks:`lanes-benchmarks`,factory:`lanes-factory`,"knowledge-graph":`lanes-knowledge-graph`,workflows:`lanes-workflows`,usage:`machine-usage`,privacy:`machine-privacy`,telemetry:`machine-privacy`,shortcuts:`browser-shortcuts`,animals:`browser-flying-animals`,"flying-animals":`browser-flying-animals`,unattended:`lanes-unattended`}),QY=Object.freeze({"browser-appearance":Object.freeze({"flying-animals":`browser-flying-animals`})}),$Y=Object.freeze([{id:`browser-appearance`,level:`browser`,title:`Appearance and alerts`,description:`Preferences stored only in this browser.`,settings:[{id:`theme`,path:`pref:themeId`,title:`Theme`,description:`Color scheme for the dashboard.`,control:`select`,optionsFrom:`themes`,keywords:[`color`,`palette`],defaultValue:`phyrexian`},{id:`compact-status`,path:`pref:compactStatusLabels`,title:`Hide status words in sidebar`,description:`Hide status words in the sidebar and on the phone Board while keeping the colored status mark and the phone Plan ready badge. Saved per browser, so turn it on in each one.`,control:`toggle`,keywords:[`sidebar`,`status`,`compact`],defaultValue:!1},{id:`session-usage-chips`,path:`pref:sessionUsageChips`,title:`Show usage on session cards`,description:`Shows each card's transcript token count and CLI-reported cost when available, otherwise a calculated API list-price estimate.`,control:`toggle`,keywords:[`usage`,`cost`,`tokens`,`card`,`price`],defaultValue:!1},{id:`alert-sounds-enabled`,path:`pref:soundEnabled`,title:`Alert sounds`,description:`Play sounds when a session needs attention and when a merge celebration plays. The same switch as the note button in the desktop header.`,control:`toggle`,keywords:[`audio`,`mute`,`sound`,`notification`],defaultValue:!0},{id:`alert-sound`,path:`pref:soundId`,title:`Alert sound`,description:`Sound played when a session needs attention. Your own .ogg, .mp3, .wav, .m4a or .webm files dropped into the sounds folder of the Glimmervoid home (~/.glimmervoid/sounds/, or $GLIMMERVOID_HOME/sounds/) are listed after the built-in sounds. Glimmervoid never creates that folder, so make it yourself; new files show up the next time Settings opens.`,control:`select`,optionsFrom:`sounds`,keywords:[`audio`,`notification`,`custom`],defaultValue:`chime`},{id:`desktop-notifications`,path:`pref:notificationsEnabled`,title:`Desktop notifications`,description:`Raise a browser notification when a session needs attention while this dashboard is in the background.`,control:`toggle`,keywords:[`browser`,`attention`],defaultValue:!0}]},{id:`browser-flying-animals`,level:`browser`,title:`Flying animals`,description:`Choose your flying animals. Changes apply immediately in this browser.`,settings:[{id:`flying-animals`,path:`pref:flyingAnimalsEnabled`,title:`Flying animals`,description:`Show animated animals flying across the dashboard.`,control:`toggle`,keywords:[`animation`,`motion`],defaultValue:!1},{id:`animals-min-gap`,path:`pref:flyingAnimalsMinGapSeconds`,title:`Time between flights: minimum (seconds)`,description:`Shortest pause between flights.`,control:`number`,advanced:!0,commitOnChange:!0,integer:!1,step:.1,range:`FLYING_ANIMALS_GAP_RANGE`,maximumSettingId:`animals-max-gap`,keywords:[`animals`,`frequency`],defaultValue:GE.flyingAnimalsMinGapSeconds},{id:`animals-max-gap`,path:`pref:flyingAnimalsMaxGapSeconds`,title:`Time between flights: maximum (seconds)`,description:`Longest pause between flights.`,control:`number`,advanced:!0,commitOnChange:!0,integer:!1,step:.1,range:`FLYING_ANIMALS_GAP_RANGE`,keywords:[`animals`,`frequency`],defaultValue:GE.flyingAnimalsMaxGapSeconds},{id:`animals-min-duration`,path:`pref:flyingAnimalsMinDurationSeconds`,title:`Flight duration: minimum (seconds)`,description:`Shortest flight, for faster animals.`,control:`number`,advanced:!0,commitOnChange:!0,integer:!1,step:.1,range:`FLYING_ANIMALS_DURATION_RANGE`,maximumSettingId:`animals-max-duration`,keywords:[`animals`,`speed`],defaultValue:GE.flyingAnimalsMinDurationSeconds},{id:`animals-max-duration`,path:`pref:flyingAnimalsMaxDurationSeconds`,title:`Flight duration: maximum (seconds)`,description:`Longest flight, for slower animals.`,control:`number`,advanced:!0,commitOnChange:!0,integer:!1,step:.1,range:`FLYING_ANIMALS_DURATION_RANGE`,keywords:[`animals`,`speed`],defaultValue:GE.flyingAnimalsMaxDurationSeconds},{id:`animals-scale`,path:`pref:flyingAnimalsScale`,title:`Size multiplier`,description:`Scale applied on top of the viewport size.`,control:`number`,advanced:!0,commitOnChange:!0,integer:!1,step:.1,range:`FLYING_ANIMALS_SCALE_RANGE`,keywords:[`animals`,`size`],defaultValue:GE.flyingAnimalsScale},{id:`animals-on-phone`,path:`pref:flyingAnimalsOnPhone`,title:`Show on phone layout`,description:`Allow flights on the phone layout.`,control:`toggle`,advanced:!0,keywords:[`animals`,`mobile`],defaultValue:GE.flyingAnimalsOnPhone}]},{id:`browser-shortcuts`,level:`browser`,title:`Shortcuts and about`,description:`Keyboard reference and build information.`,settings:[]},{id:`machine-general`,level:`machine`,title:`General`,description:`Machine-wide session startup and diagnostics.`,settings:[{id:`auto-resume`,path:`autoResume`,title:`Auto-resume sessions on startup`,description:`Resume conversations that were live when Glimmervoid last shut down or crashed.`,control:`toggle`,keywords:[`startup`,`conversation`],defaultValue:!0},{id:`debug-mode`,path:`debugMode`,title:`Debug mode`,description:`Show session-card diagnostics for state, transitions and detection signals.`,control:`toggle`,keywords:[`diagnostics`,`state`],defaultValue:!1},{id:`calm-layout`,path:`calmLayout`,title:`Calm layout (experimental)`,description:`Replace the Focus rail with a view that prioritizes sessions needing attention and also shows ready and working indicators. Applies to every browser on this machine.`,control:`toggle`,keywords:[`experimental`,`attention`,`priority`],defaultValue:!1}],unattendedLinks:[{settingId:`skip-permissions-by-default`,title:`Skip permission prompts by default`},{settingId:`rtk-compression`,title:`rtk output compression`}]},{id:`machine-updates`,level:`machine`,title:`Updates`,description:`See which Glimmervoid version is running, which one is newest, and update in one step.`,settings:[{id:`update-summary`,path:`status:update-summary`,title:`Status`,description:`Whether this install is up to date, and what an update would move it to.`,control:`readonly`,keywords:[`version`,`available`,`current`],status:`update-summary`},{id:`update-actions`,path:`status:update-actions`,title:`Actions`,description:`Update and restart stages the newest build, then restarts to run it. Update without restart stages it for a later restart.`,control:`readonly`,keywords:[`check`,`restart`],status:`update-actions`},{id:`update-installed`,path:`status:update-installed`,title:`Running version`,description:`The version loaded when the server started, alongside the commit, branch and state of the current disk checkout.`,control:`readonly`,keywords:[`version`,`commit`,`installed`],status:`update-installed`},{id:`update-latest`,path:`status:update-latest`,title:`Latest version`,description:`The newest target found on the selected update channel.`,control:`readonly`,keywords:[`release`,`commit`],status:`update-latest`},{id:`update-last-checked`,path:`status:update-last-checked`,title:`Last checked`,description:`The most recent update check, or why automatic checks are off.`,control:`readonly`,keywords:[`time`,`failure`],status:`update-last-checked`},{id:`update-channel`,path:`updateChannel`,title:`Channel`,description:`Track tagged releases or the upstream of the checked-out branch.`,control:`select`,options:XY(UY),keywords:[`release`,`branch`],defaultValue:`release`},{id:`check-updates`,path:`checkForUpdates`,title:`Check for updates automatically`,description:`Check for a newer Glimmervoid at launch, while a dashboard is connected, and when this page opens.`,control:`toggle`,keywords:[`release`,`github`],defaultValue:!0}]},{id:`machine-terminal`,level:`machine`,title:`Terminal`,description:`Terminal behavior shared by dashboard clients.`,settings:[{id:`replay-buffer`,path:`replayBufferKB`,title:`Replay buffer (KB)`,description:`PTY output retained for clients that reconnect or join late.`,control:`number`,range:`REPLAY_BUFFER_KB_RANGE`,keywords:[`history`,`backfill`],defaultValue:512},{id:`cursor-blink`,path:`cursorBlink`,title:`Cursor blink`,description:`Blink the cursor in every terminal.`,control:`toggle`,keywords:[`caret`,`terminal`],defaultValue:!1}]},{id:`machine-detection-sessions`,level:`machine`,title:`Detection and sessions`,description:`Config-file-only detection, timing, worktree and process settings.`,settings:[{id:`file-detect-background-agents`,path:`detectBackgroundAgents`,title:`Detect background agents`,description:`Hold completion while tracked background work is active. Changes apply to newly created sessions; recreate existing sessions to apply them.`,control:`readonly`,keywords:[`subagents`,`completion`],fileOnly:!0},{id:`file-record-signals`,path:`recordSignals`,title:`Record structural signals`,description:`Keep forensic status and hook recordings for newly created sessions. Full capture (capture.enabled) records these signals even when this is off. Recreate existing sessions to change recording.`,control:`readonly`,keywords:[`recordings`,`diagnostics`],fileOnly:!0},{id:`file-trace-enabled`,path:`trace.enabled`,title:`Capture session traces`,description:`Keep normalized Claude transcript traces for session debugging. Requires a server restart.`,control:`readonly`,keywords:[`transcripts`,`diagnostics`],fileOnly:!0},{id:`file-detect-scheduled-wakeups`,path:`detectScheduledWakeups`,title:`Detect scheduled wakeups`,description:`Surface advisory wakeup timing for scheduled sessions. Requires a server restart to update the configuration, and newly created sessions use the change.`,control:`readonly`,keywords:[`schedule`,`sleep`],fileOnly:!0},{id:`file-worktree-auto-rebase`,path:`worktreeAutoRebase`,title:`Worktree auto-rebase`,description:`Rebase eligible session worktrees when the integration branch moves. Changes apply to newly created sessions; recreate existing sessions to apply them.`,control:`readonly`,keywords:[`git`,`branch`],fileOnly:!0},{id:`file-worktree-rerere`,path:`worktreeRerere`,title:`Worktree rerere`,description:`Reuse recorded Git conflict resolutions. Requires a server restart.`,control:`readonly`,keywords:[`git`,`conflicts`],fileOnly:!0},{id:`file-integration-branch`,path:`integrationBranch`,title:`Integration branch`,description:`Base branch for session worktrees. Empty = each repo's default branch. Reload affects newly created sessions and does not retarget existing sessions.`,control:`readonly`,keywords:[`git`,`merge`],fileOnly:!0},{id:`file-worktree-root`,path:`worktreeRoot`,title:`Worktree root`,description:`Directory that contains session worktrees. Changes apply to newly created sessions and do not relocate existing worktrees; recreate existing sessions to change where they create worktrees.`,control:`readonly`,keywords:[`git`,`directory`],fileOnly:!0},{id:`file-worktree-share`,path:`worktreeShare`,title:`Shared worktree paths`,description:`Local paths copied or linked during worktree preparation. Changes apply to newly created sessions; recreate existing sessions to use a new share list.`,control:`readonly`,keywords:[`files`,`context`],fileOnly:!0},{id:`file-port`,path:`port`,title:`Local port`,description:`Port used by the local dashboard listener. Requires a server restart.`,control:`readonly`,keywords:[`server`,`listener`],fileOnly:!0},{id:`file-auto-recover-seconds`,path:`autoRecoverSeconds`,title:`Auto-recovery delay`,description:`Delay before an interrupted state can recover.`,control:`readonly`,keywords:[`timer`,`recovery`],fileOnly:!0},{id:`file-input-grace-seconds`,path:`inputGraceSeconds`,title:`Input grace period`,description:`Grace window around operator input.`,control:`readonly`,keywords:[`timer`,`prompt`],fileOnly:!0},{id:`file-prompt-detection-ms`,path:`promptDetectionMs`,title:`Prompt detection delay`,description:`Timing threshold used by prompt detection.`,control:`readonly`,keywords:[`timer`,`detection`],fileOnly:!0},{id:`file-notify-debounce-ms`,path:`notifyDebounceMs`,title:`Notification debounce`,description:`Delay used to coalesce notification state changes.`,control:`readonly`,keywords:[`timer`,`alerts`],fileOnly:!0},{id:`file-phone-escalation-ms`,path:`phoneEscalationMs`,title:`Phone escalation delay`,description:`Delay before off-dashboard escalation.`,control:`readonly`,keywords:[`timer`,`telegram`],fileOnly:!0},{id:`file-post-turn-checks`,path:`postTurnChecks`,title:`Post-turn checks`,description:`Deterministic checks run after eligible turns. The global mode is a default; project and individual rule modes can select fixes even when the global mode is report.`,control:`readonly`,keywords:[`quality`,`fixes`],fileOnly:!0},{id:`file-branch-gc-enabled`,path:`branchGc.enabled`,title:`Branch cleanup`,description:`Enable cleanup of eligible session branches.`,control:`readonly`,keywords:[`git`,`cleanup`],fileOnly:!0},{id:`file-branch-gc-worktrees`,path:`branchGc.worktrees`,title:`Local worktree cleanup`,description:`Enable cleanup of eligible local worktrees.`,control:`readonly`,keywords:[`git`,`worktree`,`cleanup`],fileOnly:!0},{id:`file-branch-gc-prefixes`,path:`branchGc.prefixes`,title:`Branch cleanup prefixes`,description:`Branch prefixes that filter both remote branch cleanup and local worktree cleanup.`,control:`readonly`,keywords:[`git`,`branch`],fileOnly:!0},{id:`file-branch-gc-dry-run`,path:`branchGc.dryRun`,title:`Branch cleanup dry run`,description:`Report planned cleanup without deleting remote branches.`,control:`readonly`,keywords:[`git`,`safety`],fileOnly:!0},{id:`file-branch-gc-stale-days`,path:`branchGc.staleDays`,title:`Branch stale days`,description:`Age threshold for orphan branch cleanup when unmerged deletion is on.`,control:`readonly`,keywords:[`git`,`retention`],fileOnly:!0},{id:`file-branch-gc-interval-ms`,path:`branchGc.intervalMs`,title:`Branch cleanup interval`,description:`Delay between branch cleanup passes.`,control:`readonly`,keywords:[`git`,`schedule`],fileOnly:!0},{id:`file-custom-agents`,path:`customAgents`,title:`Custom agents`,description:`Extra agent CLIs a session can be spawned with.`,control:`readonly`,keywords:[`adapters`,`cli`],fileOnly:!0,status:`custom-agents`}]},{id:`machine-repositories`,level:`machine`,title:`Repositories`,description:`Project discovery roots for new sessions.`,settings:[{id:`repository-roots`,path:`repoRoots`,title:`Repository roots`,description:`Directories scanned for projects when adding sessions.`,control:`list`,keywords:[`folders`,`project discovery`],defaultValue:[]}]},{id:`machine-telegram`,level:`machine`,title:`Telegram`,description:`One bot shared by session, PR review and PostHog notifications.`,settings:[{id:`telegram-bot-token`,path:`telegram.botToken`,title:`Bot token`,description:`Credential used by the shared Telegram bot. When GLIMMERVOID_TELEGRAM_BOT_TOKEN supplies it, this field is read-only.`,control:`password`,keywords:[`credential`,`api`],defaultValue:``},{id:`telegram-chat-id`,path:`telegram.chatId`,title:`Chat id`,description:`Destination chat for enabled Telegram lanes.`,control:`text`,keywords:[`destination`,`channel`],defaultValue:``},{id:`telegram-session-notifications`,path:`telegramNotifications`,title:`Send session notifications`,description:`Send session completion, input and failure alerts when no dashboard is open. Unacknowledged alerts also escalate after the phone escalation delay while a dashboard remains open.`,control:`toggle`,keywords:[`phone`,`off dashboard`],defaultValue:!1}]},{id:`machine-usage`,level:`machine`,title:`Usage`,description:`Local transcript accounting and estimated-cost budgets.`,settings:[{id:`usage-enabled`,path:`usage.enabled`,title:`Track token usage`,description:`Read local CLI transcripts and roll them into the Usage view and session chips.`,control:`toggle`,keywords:[`tokens`,`cost`],defaultValue:!0,status:`usage-last-report`},{id:`usage-codex`,path:`usage.vendors.codex`,title:`Track Codex usage`,description:`Include local Codex CLI transcripts in usage reports.`,control:`toggle`,keywords:[`openai`,`vendor`],defaultValue:!0},{id:`usage-grok`,path:`usage.vendors.grok`,title:`Track Grok usage`,description:`Include local Grok CLI transcripts in usage reports.`,control:`toggle`,keywords:[`xai`,`vendor`],defaultValue:!0},{id:`usage-fetch-pricing`,path:`usage.fetchPricing`,title:`Fetch current model prices`,description:`Load public model prices when usage tracking starts, using a cached table for up to one day. Falls back to cached or bundled prices if the fetch fails; no daily refresh runs while tracking continues.`,control:`toggle`,keywords:[`rates`,`models`],defaultValue:!0},{id:`usage-scan-interval`,path:`usage.scanIntervalMinutes`,title:`Scan interval (minutes)`,description:`Periodic transcript polling interval. Session activity can also trigger scans between timer ticks.`,control:`number`,range:`USAGE_SCAN_INTERVAL_RANGE`,keywords:[`poll`,`refresh`],defaultValue:5},{id:`usage-retain-days`,path:`usage.retainDays`,title:`Retain transcript detail (days)`,description:`How long live transcript detail stays available. A monthly budget keeps detail from the start of the current month when that is longer.`,control:`number`,range:`USAGE_RETAIN_DAYS_RANGE`,keywords:[`history`,`retention`],defaultValue:90},{id:`usage-cost-mode`,path:`usage.costMode`,title:`Cost mode`,description:`Choose whether recorded costs, calculated costs or both can appear.`,control:`select`,options:XY(MY),keywords:[`pricing`,`estimate`],defaultValue:`auto`},{id:`usage-daily-budget`,path:`usage.budget.dailyUsd`,title:`Daily budget (USD)`,description:`Estimated daily spend alert threshold. Alerts at 50%, 75% and 100% do not stop spending. Zero or below disables the threshold.`,control:`number`,range:`USAGE_BUDGET_RANGE`,keywords:[`spend`,`alert`],defaultValue:null,integer:!1,nullable:!0,zeroIsNull:!0,step:.01},{id:`usage-monthly-budget`,path:`usage.budget.monthlyUsd`,title:`Monthly budget (USD)`,description:`Estimated monthly spend alert threshold. Alerts at 50%, 75% and 100% do not stop spending. Zero or below disables the threshold.`,control:`number`,range:`USAGE_BUDGET_RANGE`,keywords:[`spend`,`alert`],defaultValue:null,integer:!1,nullable:!0,zeroIsNull:!0,step:.01}]},{id:`machine-privacy`,level:`machine`,title:`Privacy`,description:`What Glimmervoid sends about itself.`,settings:[{id:`telemetry-enabled`,path:`telemetry.enabled`,title:`Send anonymous usage and error data`,description:`Version, platform, app starts, daily activity, session starts and ends with agent kind, exit kind and duration, errors as their type, error code and scrubbed stack frames, per session token counts, models and estimated costs from the usage scan, and factory outcomes as the kind of decision, how it came out, its duration and attempt number, under a random install id. Never error messages, paths, repository or branch names, prompts, objectives or terminal output. GLIMMERVOID_TELEMETRY=0, DO_NOT_TRACK=1 or CI=true turn it off regardless.`,control:`toggle`,keywords:[`telemetry`,`analytics`,`tracking`,`opt out`],defaultValue:!0}]},{id:`lanes-change-map`,level:`lanes`,title:`Change map`,description:`Optional model narration for deterministic change facts.`,settings:[{id:`change-map-narrator-enabled`,path:`changeMap.narrator.enabled`,title:`Enable narration`,description:`Add cited model claims to the change map.`,control:`toggle`,keywords:[`review`,`claims`],defaultValue:!1},{id:`change-map-narrator-engine`,path:`changeMap.narrator.engine`,title:`Narrator engine`,description:`CLI used to generate change map claims.`,control:`select`,options:XY(HY),keywords:[`claude`,`codex`],defaultValue:`claude`},{id:`change-map-narrator-model`,path:`changeMap.narrator.model`,title:`Narrator model`,description:`Blank uses the engine default: haiku for Claude, the configured Codex model for Codex.`,control:`text`,keywords:[`claude`,`codex`,`haiku`],defaultValue:``},{id:`change-map-narrator-timeout`,path:`changeMap.narrator.timeoutSeconds`,title:`Narrator timeout (seconds)`,description:`Maximum time allowed for one narration.`,control:`number`,range:`CHANGE_MAP_NARRATOR_TIMEOUT_RANGE`,keywords:[`deadline`,`narration`],defaultValue:90}]},{id:`lanes-visions`,level:`lanes`,title:`Visions`,description:`Editor-buffer findings and bounded model comments.`,settings:[{id:`visions-enabled`,path:`visions.enabled`,title:`Enable Visions`,description:`Set up supported editors detected on this machine, then show their buffer findings in the Visions view.`,control:`toggle`,keywords:[`editor`,`findings`,`lsp`],defaultValue:!1},{id:`visions-dispatch-enabled`,path:`visions.dispatch.enabled`,title:`Enable model comments`,description:`Start bounded review sessions for local editor buffers.`,control:`toggle`,keywords:[`review`,`dispatch`],defaultValue:!1},{id:`visions-quiet-delay`,path:`visions.dispatch.quietMs`,title:`Quiet delay (ms)`,description:`Editor quiet time before a scheduled review. Saves and blank-line boundaries can dispatch immediately, subject to the other review limits.`,control:`number`,range:`VISIONS_QUIET_MS_RANGE`,keywords:[`debounce`,`idle`],defaultValue:3e4},{id:`visions-cooldown`,path:`visions.dispatch.cooldownMs`,title:`Cooldown (ms)`,description:`Minimum delay between reviews of the same document. Initial orientation reviews bypass this delay.`,control:`number`,range:`VISIONS_COOLDOWN_MS_RANGE`,keywords:[`rate limit`,`delay`],defaultValue:3e5},{id:`visions-max-per-hour`,path:`visions.dispatch.maxPerHour`,title:`Max per hour`,description:`Maximum review sessions dispatched per hour.`,control:`number`,range:`VISIONS_MAX_PER_HOUR_RANGE`,keywords:[`rate limit`,`reviews`],defaultValue:6},{id:`visions-activity-max-per-hour`,path:`visions.dispatch.activityMaxPerHour`,title:`Activity max per hour`,description:`Maximum activity-driven reviews dispatched per hour, capped at the overall hourly limit minus one to reserve an edit-review slot.`,control:`number`,range:`VISIONS_ACTIVITY_MAX_PER_HOUR_RANGE`,status:`visions-activity-limit`,keywords:[`rate limit`,`events`],defaultValue:2},{id:`visions-dispatch-timeout`,path:`visions.dispatch.dispatchTimeoutSeconds`,title:`Dispatch timeout (seconds)`,description:`Maximum time allowed for one review session.`,control:`number`,range:`VISIONS_DISPATCH_TIMEOUT_RANGE`,keywords:[`deadline`,`review`],defaultValue:180},{id:`visions-intent-thread-ttl`,path:`visions.intent.threadTtlMs`,title:`Intent thread lifetime (ms)`,description:`How long an intent thread nobody advanced stays live before it retires.`,control:`number`,range:`VISIONS_INTENT_THREAD_TTL_MS_RANGE`,keywords:[`intent`,`decay`,`thread`],defaultValue:2592e5},{id:`visions-model`,path:`visions.dispatch.model`,title:`Model override`,description:`Leave blank to use the opus model alias.`,control:`text`,keywords:[`claude`,`override`],defaultValue:``},{id:`visions-projects`,path:`visions.projects`,title:`Projects`,description:`Clear every selection, including unavailable projects, to accept buffers from every configured project.`,control:`projects`,keywords:[`repositories`,`filter`],defaultValue:[]},{id:`visions-auto-fix`,path:`visions.autoFix`,title:`Apply tier 1 fixes`,description:`Allow Visions to edit eligible open Markdown buffers, including inactive buffers, without asking.`,control:`toggle`,keywords:[`automatic`,`edits`],danger:!0,warning:`Enabling this control lets Visions edit eligible buffers without a carbon unit present.`,defaultValue:!1}]},{id:`lanes-ingest`,level:`lanes`,title:`Ingest`,description:`Machine-context ingest behind Visions.`,settings:[{id:`ingest-enabled`,path:`ingest.enabled`,title:`Enable machine context ingest`,description:`Enable the local activity feed behind Visions. Turning Visions on enables ingest unless ingest.enabled is explicitly false.`,control:`toggle`,keywords:[`events`,`activity`],defaultValue:!1},{id:`ingest-terminal`,path:`ingest.sources.terminal.enabled`,title:`Terminal output source`,description:`Include terminal output in the ingest feed.`,control:`toggle`,keywords:[`pty`,`source`],defaultValue:!1},{id:`ingest-agent-logs`,path:`ingest.sources.agentLogs.enabled`,title:`Agent logs source`,description:`Include local agent logs in the ingest feed.`,control:`toggle`,keywords:[`transcript`,`source`],defaultValue:!1},{id:`ingest-git`,path:`ingest.sources.git.enabled`,title:`Git activity source`,description:`Include local Git activity in the ingest feed.`,control:`toggle`,keywords:[`commits`,`source`],defaultValue:!1},{id:`ingest-fs`,path:`ingest.sources.fs.enabled`,title:`File changes source`,description:`Include watched file changes in the ingest feed.`,control:`toggle`,keywords:[`filesystem`,`source`],defaultValue:!1},{id:`ingest-shell-history`,path:`ingest.sources.shellHistory.enabled`,title:`Shell history source`,description:`Include local shell history in the ingest feed.`,control:`toggle`,keywords:[`commands`,`source`],defaultValue:!1},{id:`ingest-editor`,path:`ingest.sources.editor.enabled`,title:`Editor events source`,description:`Include local editor events in the ingest feed.`,control:`toggle`,keywords:[`buffers`,`source`],defaultValue:!1}]},{id:`lanes-posthog`,level:`lanes`,title:`PostHog`,description:`Error monitoring, investigations and traffic-spike alerts.`,settings:[{id:`posthog-enabled`,path:`posthog.enabled`,title:`Enable PostHog monitoring`,description:`Poll PostHog error tracking and investigate issues that move.`,control:`toggle`,keywords:[`errors`,`monitoring`],defaultValue:!1},{id:`posthog-host`,path:`posthog.host`,title:`Host`,description:`PostHog cloud or self-hosted HTTP URL.`,control:`text`,keywords:[`url`,`server`],defaultValue:`https://us.posthog.com`},{id:`posthog-api-key`,path:`posthog.apiKey`,title:`Personal API key`,description:`Credential with read access to PostHog projects. When GLIMMERVOID_POSTHOG_API_KEY supplies it, this field is read-only.`,control:`password`,keywords:[`credential`,`token`],defaultValue:``},{id:`posthog-projects`,path:`posthog.projects`,title:`Projects`,description:`Use all, none for an empty selection, or a comma-separated list of positive integer PostHog project ids. Blank means all.`,control:`text`,keywords:[`project ids`,`filter`],defaultValue:`all`,valueKind:`posthog-projects`},{id:`posthog-interval`,path:`posthog.intervalMinutes`,title:`Poll interval (minutes)`,description:`Delay between PostHog polling passes.`,control:`number`,integer:!1,step:`any`,range:`POSTHOG_INTERVAL_RANGE`,keywords:[`refresh`,`schedule`],defaultValue:15},{id:`posthog-max-investigations`,path:`posthog.maxConcurrentInvestigations`,title:`Max concurrent investigations`,description:`Maximum investigation sessions running together.`,control:`number`,range:`POSTHOG_MAX_CONCURRENT_RANGE`,keywords:[`parallel`,`workers`],defaultValue:2},{id:`posthog-investigation-timeout`,path:`posthog.investigationTimeoutSeconds`,title:`Investigation timeout (seconds)`,description:`Maximum time allowed for one investigation.`,control:`number`,integer:!1,step:`any`,range:`POSTHOG_INVESTIGATION_TIMEOUT_RANGE`,keywords:[`deadline`,`session`],defaultValue:900},{id:`posthog-min-users`,path:`posthog.minUsersToInvestigate`,title:`Min users to investigate`,description:`Minimum affected users for a new issue investigation. Regressions, worsening issues and eligible error spikes bypass this minimum.`,control:`number`,range:`POSTHOG_MIN_USERS_RANGE`,keywords:[`threshold`,`affected`],defaultValue:1},{id:`posthog-escalation`,path:`posthog.userEscalationThreshold`,title:`Escalation threshold (users)`,description:`Affected-user count that escalates an issue.`,control:`number`,range:`POSTHOG_ESCALATION_RANGE`,keywords:[`threshold`,`severity`],defaultValue:25},{id:`posthog-fix-timeout`,path:`posthog.fixTimeoutSeconds`,title:`Fix timeout (seconds)`,description:`Maximum time allowed for one fix session.`,control:`number`,integer:!1,step:`any`,range:`POSTHOG_FIX_TIMEOUT_RANGE`,keywords:[`deadline`,`repair`],defaultValue:1800},{id:`posthog-traffic-enabled`,path:`posthog.trafficSpikeEnabled`,title:`Traffic spike alerts`,description:`Ping when recent unique users exceed a project baseline.`,control:`toggle`,keywords:[`analytics`,`alert`],defaultValue:!0},{id:`posthog-traffic-multiplier`,path:`posthog.trafficSpikeMultiplier`,title:`Spike multiplier`,description:`Baseline multiplier required to classify a traffic spike.`,control:`number`,integer:!1,step:`any`,range:`POSTHOG_TRAFFIC_MULTIPLIER_RANGE`,keywords:[`baseline`,`ratio`],defaultValue:3},{id:`posthog-traffic-min-users`,path:`posthog.trafficSpikeMinUsers`,title:`Min users to alert`,description:`Minimum recent unique users for an initial traffic-spike alert. Escalation and recovery alerts bypass this minimum.`,control:`number`,range:`POSTHOG_TRAFFIC_MIN_USERS_RANGE`,keywords:[`threshold`,`analytics`],defaultValue:10},{id:`posthog-traffic-cooldown`,path:`posthog.trafficSpikeCooldownMinutes`,title:`Spike cooldown (minutes)`,description:`Cooldown for new traffic spikes. Escalation and recovery alerts bypass it. Zero removes the time delay; repeated active-spike alerts are still suppressed.`,control:`number`,integer:!1,step:`any`,range:`POSTHOG_TRAFFIC_COOLDOWN_RANGE`,keywords:[`silence`,`delay`],defaultValue:360},{id:`posthog-traffic-baseline`,path:`posthog.trafficSpikeBaselineDays`,title:`Baseline window (days)`,description:`Historical window used to calculate normal hourly traffic.`,control:`number`,range:`POSTHOG_TRAFFIC_BASELINE_RANGE`,keywords:[`history`,`analytics`],defaultValue:7},{id:`posthog-auto-fix`,path:`posthog.autoFix`,title:`Attempt fixes for major issues`,description:`Allow an isolated agent to fix an issue, push a branch and open a pull request.`,control:`toggle`,keywords:[`automatic`,`pull request`],danger:!0,warning:`Enabling this control lets PostHog fixes commit, push and open pull requests automatically.`,defaultValue:!1}]},{id:`lanes-team-review`,level:`lanes`,title:`Team review`,description:`Draft reviews of teammates' pull requests for you to post from the Reviews tab.`,settings:[{id:`team-review-enabled`,path:`teamReview.enabled`,title:`Enable team review`,description:`Poll open pull requests from the team and draft a review of each one. Nothing is posted until you choose Approve or Comment.`,control:`toggle`,keywords:[`pull requests`,`github`],defaultValue:!1},{id:`github-teams`,path:`github.teams`,title:`GitHub teams`,description:`Teams to search for review requests and members, one org/slug per entry. Leave empty to use the organization and team below.`,control:`list`,keywords:[`github`,`teams`,`review requests`],defaultValue:[],listPlaceholder:`org/team-slug`,listEmptyText:`No GitHub teams configured.`},{id:`team-review-org`,path:`teamReview.org`,title:`GitHub organization`,description:`Organization login that owns the team, for example PostHog.`,control:`text`,keywords:[`github`,`owner`],defaultValue:``},{id:`team-review-team`,path:`teamReview.team`,title:`GitHub team`,description:`Team slug whose members and review requests are polled.`,control:`text`,keywords:[`github`,`slug`],defaultValue:``},{id:`team-review-re-review-after-hours`,path:`teamReview.reReviewAfterHours`,title:`Re-review after (hours)`,description:`When a reviewed PR has a new head, review it again after this many hours since its last review. Queue review runs it at any time.`,control:`number`,range:`POSTHOG_INTERVAL_RANGE`,keywords:[`review`,`delay`],defaultValue:24,integer:!1,step:.5},{id:`team-review-skip-idle-after-days`,path:`teamReview.skipIdleAfterDays`,title:`Skip PRs idle for (days)`,description:`Leave pull requests without GitHub activity for this long out of automatic review.`,control:`number`,range:`POSTHOG_INTERVAL_RANGE`,keywords:[`idle`,`activity`],defaultValue:14,integer:!1,step:.5},{id:`team-review-skill`,path:`teamReview.skill`,title:`Review skill`,description:`Name of a Claude Code skill installed for the review agent, for example your own PR review skill. Leave empty to let the agent review with whatever skills it has.`,control:`text`,keywords:[`skill`,`claude code`,`pr review`],defaultValue:``},{id:`team-review-auto-rebase-my-prs`,path:`teamReview.autoRebaseMyPrs`,title:`Keep my pull requests rebased`,description:`On each poll, rebase your open, non-draft pull requests that are behind their base branch. A pull request with conflicts or checks still running is left alone, and a failed rebase is not retried until you push again.`,control:`toggle`,keywords:[`rebase`,`update branch`,`behind`,`my prs`],danger:!0,warning:`Enabling this control rewrites your pull request branches on GitHub. Pull before you push from a local checkout of one.`,defaultValue:!1},{id:`team-review-keep-mergeable-enabled`,path:`teamReview.keepMergeableEnabled`,title:`Keep mergeable`,description:`Offer Keep mergeable on your pull requests: a sandboxed agent repairs conflicts and failing checks and pushes the repair. Off hides the control and starts no repair; the pull requests you chose stay chosen for when you turn it back on.`,control:`toggle`,keywords:[`repair`,`conflicts`,`my prs`],defaultValue:!0},{id:`team-review-keep-mergeable-timeout`,path:`teamReview.keepMergeableTimeoutMinutes`,title:`Keep mergeable deadline (minutes)`,description:`Longest a Keep mergeable repair session may run before it is stopped and nothing is pushed.`,control:`number`,range:`KEEP_MERGEABLE_TIMEOUT_MINUTES_RANGE`,keywords:[`timeout`,`repair`],defaultValue:30},{id:`team-review-merge-queue-enabled`,path:`teamReview.mergeQueueEnabled`,title:`Merge when ready`,description:`Offer Merge when ready on your pull requests: queued pull requests are rebased when behind and merged once ready, one per repository per poll. Off hides the control and merges nothing; the queue is kept for when you turn it back on.`,control:`toggle`,keywords:[`merge queue`,`auto merge`,`my prs`],defaultValue:!0}]},{id:`lanes-benchmarks`,level:`lanes`,title:`Benchmarks`,description:`Compare agent setups on frozen cases from the suites in the benchmarks folder of the Glimmervoid home.`,settings:[{id:`benchmarks-enabled`,path:`benchmarks.enabled`,title:`Enable benchmarks`,description:`Show the Bench tab. Nothing runs until you choose Mine or Run there.`,control:`toggle`,keywords:[`eval`,`arms`,`recall`,`compare`],defaultValue:!1}]},{id:`lanes-factory`,level:`lanes`,title:`Factory`,description:`Read Coherence reports from repositories whose integration branch holds a coherence.config.json and show their status in the Factory tab.`,settings:[{id:`factory-enabled`,path:`factory.enabled`,title:`Enable the factory`,description:`Enable Coherence status polling and show the Factory tab. Off by default.`,control:`toggle`,keywords:[`orchestrator`,`intents`,`queue`,`coherence`,`guardrails`],defaultValue:!1},{id:`factory-max-risk`,path:`factory.maxRisk`,title:`Worker risk ceiling`,description:`Highest risk admitted for a ticket.`,control:`select`,defaultValue:`medium`,options:[`low`,`medium`,`high`,`critical`].map(e=>({value:e,label:e})),keywords:[`risk`,`admission`]},{id:`factory-max-live-workers`,path:`factory.maxLiveWorkers`,title:`Live worker cap`,description:`Most live workers per factory project.`,control:`number`,range:`FACTORY_MAX_LIVE_WORKERS_RANGE`,defaultValue:2,keywords:[`workers`,`parallel`]},{id:`factory-checks`,path:`factory.checks`,title:`Worker checks`,description:`Commands glimmervoid runs before merging worker commits.`,control:`list`,defaultValue:[`npm run typecheck`,`npm run lint`,`npm test`],keywords:[`tests`,`checks`]},{id:`factory-protected-paths`,path:`factory.protectedPaths`,title:`Protected paths`,description:`Repo-relative files, directory prefixes ending in /, or **/NAME basenames workers cannot change.`,control:`list`,defaultValue:[`coherence.config.json`,`.coherence/`,`package.json`,`package-lock.json`,`**/AGENTS.md`,`**/CLAUDE.md`,`**/CLAUDE.local.md`,`.claude/`,`.github/`],keywords:[`fence`,`scope`]},{id:`factory-reviewer-model`,path:`factory.reviewerModel`,title:`Reviewer model`,description:`Claude model for independent worker review. Blank uses the CLI default.`,control:`text`,defaultValue:null,nullable:!0,keywords:[`claude`,`review`]},{id:`factory-daily-budget`,path:`factory.dailyBudgetUsd`,title:`Factory daily budget (USD)`,description:`Factory lane spend ceiling. Blank means no ceiling. Needs usage tracking: with it off, dispatch refuses.`,control:`number`,range:`NON_NEGATIVE_NUMBER_RANGE`,integer:!1,nullable:!0,step:.01,defaultValue:null,keywords:[`spend`,`budget`]},{id:`factory-verifier-model`,path:`factory.verifierModel`,title:`Verifier model`,description:`Claude model for independent intent verification. Blank uses the CLI default.`,control:`text`,nullable:!0,defaultValue:null,keywords:[`claude`,`verification`]},{id:`factory-mirror-harness-runs`,path:`factory.mirrorHarnessRuns`,title:`Mirror harness runs`,description:`Show the latest factory harness run as a read-only project in the Factory tab while it runs and for a day after. Needs factory.enabled on; leave it off on a harness instance.`,control:`toggle`,defaultValue:!1,keywords:[`harness`,`test`,`read-only`]}]},{id:`lanes-knowledge-graph`,level:`lanes`,title:`Knowledge graph (experimental)`,description:`A typed local graph of projects, tasks, notes, references and questions, driven from the glimmervoid kg command. Its SQLite database defaults to the Glimmervoid home; --db selects another path.`,settings:[{id:`knowledge-graph-enabled`,path:`knowledgeGraph.enabled`,title:`Enable the knowledge graph`,description:`Allow the glimmervoid kg command. It reads Coherence ledgers to report where your tasks and the agents' tickets disagree, without modifying those ledgers. Graph writes go to the selected SQLite database, which can be inside a repository when --db names that path. Off by default.`,control:`toggle`,keywords:[`experimental`,`kg`,`tasks`,`notes`,`references`,`coherence`],defaultValue:!1}]},{id:`lanes-workflows`,level:`lanes`,title:`Workflows`,description:`Rules that act on pull request events in the repositories you choose.`,settings:[{id:`workflows-enabled`,path:`workflows.enabled`,title:`Run workflows`,description:`Poll the repositories your enabled rules watch and run their actions. Off stops polling and every action, whatever each rule says.`,control:`toggle`,keywords:[`pull requests`,`automation`,`master switch`],defaultValue:!0},{id:`workflows-max-concurrent-sessions`,path:`workflows.maxConcurrentSessions`,title:`Concurrent agent sessions`,description:`Most workflow agent sessions running at once. Up to twenty later spawns wait for a free slot; additional spawns are dropped and logged.`,control:`number`,range:`WORKFLOWS_MAX_CONCURRENT_SESSIONS_RANGE`,keywords:[`parallel`,`spawn`],defaultValue:2},{id:`workflows-max-actions-per-poll`,path:`workflows.maxActionsPerPoll`,title:`Actions per poll`,description:`Most actions run in one poll. The rest are dropped and logged.`,control:`number`,range:`WORKFLOWS_MAX_ACTIONS_PER_POLL_RANGE`,keywords:[`cap`,`rate limit`],defaultValue:20},{id:`workflows-rules`,path:`workflows`,title:`Workflow rules`,description:`Each rule watches repositories for one pull request event (opened, checks-failed, review-requested, approved, commented or merged), narrows it by author, labels, base branch, your own pull requests or a review request to your team, and then notifies you, labels or comments on the pull request, or starts a sandboxed agent session that pushes nothing. Rules start disabled. Turn each rule on or off here; everything else about a rule is set in config.json.`,control:`readonly`,keywords:[`pull requests`,`automation`,`github`,`rules`],fileOnly:!0,status:`workflows`}]},{id:`machine-guardrails`,level:`machine`,title:`Session guardrails`,description:`Claude Code sessions on Linux and macOS write anywhere this account can, except credentials, Glimmervoid's own state and the blocked folders below. Changes apply to sessions started after the change.`,settings:[{id:`guardrails-unguarded-repos`,path:`guardrails.unguardedRepos`,title:`Unguarded repositories`,description:`Folders whose sessions run without guardrails. A session started in one of these folders, or below it, is not guarded. Applies to sessions created after the change.`,control:`list`,keywords:[`guardrails`,`opt out`,`dotfiles`],danger:!0,warning:`A session without guardrails can read credentials and write anywhere this account can.`,defaultValue:[]},{id:`guardrails-blocked-paths`,path:`guardrails.blockedPaths`,title:`Blocked folders`,description:`Extra folders and files a guarded session cannot write, on top of credentials and Glimmervoid's own state. A leading ~ means the home folder.`,control:`list`,keywords:[`guardrails`,`block`,`protect`],defaultValue:[]},{id:`guardrails-unreadable-paths`,path:`guardrails.unreadablePaths`,title:`Unreadable folders`,description:`Extra folders and files a guarded session cannot read, on top of the built-in credential list. A leading ~ means the home folder.`,control:`list`,keywords:[`guardrails`,`secrets`,`credentials`],defaultValue:[]}]},{id:`lanes-unattended`,level:`lanes`,title:`Unattended actions`,description:`Controls that let automated work change repositories or install executable tooling.`,settings:[{id:`skip-permissions-by-default`,path:`skipPermissionsByDefault`,title:`Skip permission prompts by default`,description:`Start sessions whose project sets no permission choice with the agent CLI permission bypass flag.`,control:`toggle`,keywords:[`permissions`,`yolo`,`dangerously`],danger:!0,warning:`Enabling this control lets agents edit files and run shell commands without asking, and restarts running sessions that inherit it.`,defaultValue:!1},{id:`sane-yolo`,path:`saneYolo`,title:`Sane YOLO`,description:`Block catastrophic commands in sessions that skip permission prompts when the cc-safety-net executable is available and trusted hooks are installed. Missing or untrusted hooks leave a session unprotected. Applies to sessions created after the change.`,control:`toggle`,keywords:[`permissions`,`yolo`,`safety`],defaultValue:!0},{id:`branch-gc-delete-unmerged`,path:`branchGc.deleteUnmerged`,title:`Delete unmerged branches`,description:`Also delete stale remote branches with no merge proof. Off keeps every unmerged branch.`,control:`toggle`,keywords:[`git`,`cleanup`,`orphan`],danger:!0,warning:`Enabling this control lets branch cleanup delete stale remote branches without merge proof.`,defaultValue:!1},{id:`post-turn-checks-mode`,path:`postTurnChecks.mode`,title:`Post-turn checks mode`,description:`Default mode for post-turn checks. Project and individual rule modes override it, so Report can still allow file fixes.`,control:`select`,options:XY(WY),keywords:[`quality`,`fixes`],defaultValue:`report`},{id:`rtk-compression`,path:`rtk`,title:`rtk output compression`,description:`Compress Bash output for newly spawned or restarted sessions.`,control:`toggle`,keywords:[`bash`,`tokens`],danger:!0,status:`rtk-install`,warning:`Enabling this control permits Glimmervoid to install the pinned rtk executable automatically.`,defaultValue:!1}]}]);function eX(e){return[e.repos.join(`, `),e.trigger,e.actions.map(e=>e.type).join(`, `)].join(` `)}function tX(e){if(e==null)return[`No rules. Add workflows.rules to config.json.`];let t=EY.safeParse(e);return t.success?t.data.rules.length===0?[`No rules. Add workflows.rules to config.json.`]:t.data.rules.map(e=>[e.name,e.enabled?`enabled`:`disabled`,eX(e)].join(` `)):[`The workflows block is invalid, so no rule runs: ${t.error.issues[0]?.message??`unknown problem`}`]}function nX(e){let t=EY.safeParse(e??{});return t.success?t.data.rules.map(e=>({id:e.id,name:e.name,isEnabled:e.enabled,summary:eX(e)})):[]}function rX(e){let t=e.workflows;return typeof t!=`object`||!t||Array.isArray(t)?e:{...e,workflows:Object.fromEntries(Object.entries(t).filter(([e])=>e!==`rules`))}}function iX({checked:e=[],stored:t=[],rendered:n=[]}={}){let r=new Set(n),i=[...e];for(let e of t)typeof e==`string`&&e.trim()&&(r.has(e)||i.includes(e)||i.push(e));return i}function aX(e,t){let n=new Set(e.map(e=>e.id)),r=[...new Set(t)].filter(e=>!n.has(e));return[...e,...r.map(e=>({id:e,name:`Unavailable project (${e})`}))]}function oX(e,t,n){return n?e.some(e=>e.toLowerCase()===t.toLowerCase()):e.includes(t)}var sX=new WeakMap,cX=`Configured`,lX=`•`.repeat(12);function uX(e,t){let n=t.secretSources;if(!n||typeof n!=`object`)return null;let r=n[e.path];return typeof r==`string`?r:null}function dX(e){let t=String(e??``).trim().toLowerCase();if(!t||t===`all`)return`all`;if(t===`none`)return[];let n=t.split(`,`).map(e=>e.trim());return n.every(e=>/^\d+$/.test(e)&&Number.isSafeInteger(Number(e))&&Number(e)>0)?n.map(Number):null}function fX(e){let t=Number(e[`visions.dispatch.maxPerHour`]),n=Number(e[`visions.dispatch.activityMaxPerHour`]);return!Number.isSafeInteger(t)||t<1||!Number.isSafeInteger(n)||n<0?``:`Effective activity limit: ${Math.min(n,t-1)} per hour. One slot is reserved for edit reviews.`}function pX(e){let t=e.rtkInstall;return t?.status===`installing`?`No rtk binary found. Glimmervoid is installing it into ~/.glimmervoid/bin now.`:e.rtkInstallSupported===!1?`No rtk binary found. Automatic installation is unavailable on this server platform; install a compatible binary manually.`:t?.status===`failed`?`No rtk binary found. The last install attempt failed: ${t.reason||`unknown reason`}. A save can retry after the ten-minute failure cooldown; saves during the cooldown skip installation.`:`No rtk binary found. Saving requests installation into ~/.glimmervoid/bin on supported server platforms, subject to installer eligibility.`}function mX(e){return e.control===`password`}function hX(e){return`${e.path}${cX}`}function gX(e){return Array.isArray(e)?e.map(gX):!e||typeof e!=`object`?e:Object.fromEntries(Object.entries(e).map(([e,t])=>[e,gX(t)]))}function _X(e,t){let n=e;for(let e of t.split(`.`)){if(typeof n!=`object`||!n)return;n=n[e]}return n}function vX(e,t){let n=t.split(`.`),r=e;for(let e of n.slice(0,-1)){if(!r||typeof r!=`object`)return;r=r[e]}r&&typeof r==`object`&&delete r[n.at(-1)]}function yX(e,t,n){let r=t.split(`.`),i=e;for(let e of r.slice(0,-1))(!i[e]||typeof i[e]!=`object`||Array.isArray(i[e]))&&(i[e]={}),i=i[e];i[r.at(-1)]=gX(n)}function bX(e){return e.flatMap(e=>e.settings||[])}function xX(e){return e.fileOnly||e.control===`readonly`}function SX(e){return String(e||``).toLowerCase().match(/[a-z0-9]+/g)||[]}var CX=3,wX=2,TX=1,EX=3;function DX(e,t){return e===t?CX:e.startsWith(t)?wX:t.length>=EX&&e.includes(t)?TX:0}function OX(e,t,n){let r=0;for(let n of t){let t=Math.max(0,...e.map(e=>DX(e,n)));if(t===0)return 0;r+=t}return r*n}function kX(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((e,n)=>kX(e,t[n]));if(!e||!t||typeof e!=`object`||typeof t!=`object`)return!1;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>Object.hasOwn(t,n)&&kX(e[n],t[n]))}function AX(e,t){return e.valueKind===`posthog-projects`?Array.isArray(t)?t.length===0?`none`:t.join(`, `):t??`all`:gX(t)}function jX(e,t){if(e.control===`number`){if(e.nullable&&(t==null||String(t).trim()===``))return null;let n=Number(t);return e.zeroIsNull&&n<=0?null:n}if(e.valueKind===`posthog-projects`)return dX(t);if(e.control===`text`||e.control===`password`){let n=String(t??``).trim();return e.nullable&&!n?null:n}return gX(t)}function MX(e){return sX.get(e)||null}function NX(e,t={}){let n={};for(let r of bX(e)){if(xX(r))continue;if(r.path.startsWith(`pref:`)){let e=r.path.slice(5),i=t.prefs?.[e]??t[r.path];n[r.path]=AX(r,i??r.defaultValue);continue}if(mX(r)){let e=_X(t,hX(r))===!0;n[r.path]=e?lX:``;continue}let e=_X(t,r.path);n[r.path]=AX(r,e??r.defaultValue)}return sX.set(n,gX(t)),n}function PX(e,t,n,r,i={}){let{rehydrateSectionIds:a=[]}=i,o=NX(e,t),s=NX(e,t);if(!n||!r)return{original:o,edited:s};let c=new Set(a);for(let t of e)if(!c.has(t.id)&&t.settings.some(e=>!e.path.startsWith(`pref:`)&&!kX(n[e.path],r[e.path])))for(let e of t.settings)o[e.path]=gX(n[e.path]),s[e.path]=gX(r[e.path]);return{original:o,edited:s}}function FX(e,t,n){let r=bX(e).filter(e=>xX(e)||e.path.startsWith(`pref:`)||uX(e,MX(t)||{})||mX(e)&&n[e.path]===lX?!1:!kX(t[e.path],n[e.path]));if(r.length===0)return{};let i=MX(t)||{},a=(Array.isArray(i.projectChoices)?i.projectChoices:[]).map(e=>e.id).filter(e=>typeof e==`string`),o={},s=new Set;for(let e of r){let[r]=e.path.split(`.`);if(!e.path.includes(`.`)){o[r]=jX(e,n[e.path]);continue}if(!s.has(r)){let e=i[r];o[r]=e&&typeof e==`object`&&!Array.isArray(e)?gX(e):{},s.add(r)}let c=jX(e,n[e.path]);if(e.control===`projects`){let n=t[e.path];c=iX({checked:Array.isArray(c)?c:[],stored:Array.isArray(n)?n:[],rendered:aX(a.map(e=>({id:e,name:e})),Array.isArray(n)?n:[]).map(e=>e.id)})}yX(o,e.path,c)}for(let t of bX(e))mX(t)&&vX(o,hX(t));return delete o.secretSources,o}function IX(e,t){let n=t.integer===!1?`number`:`whole number`;return e.exclusiveMin?`Must be a positive ${n}.`:e.max==null?`Must be a ${n} of at least ${e.min}.`:`Must be a ${n} between ${e.min} and ${e.max}.`}function LX(e,t,n){if(e.nullable&&(t==null||String(t).trim()===``))return null;let r=Number(t),i=n[e.range??``];return i?!Number.isFinite(r)||e.integer!==!1&&!Number.isSafeInteger(r)?IX(i,e):i.exclusiveMin&&r<=i.min?e.zeroIsNull&&r<=0?null:IX(i,e):!i.exclusiveMin&&r<i.min||i.max!=null&&r>i.max?IX(i,e):null:`Allowed range is unavailable.`}function RX(e){return dX(e)===null?`Must be "all", "none", or a comma-separated list of positive safe integer ids without empty entries.`:null}function zX(e,t,n={}){let r={};for(let i of bX(e)){if(xX(i))continue;let e=null;i.control===`number`&&(e=LX(i,t[i.path],n)),i.valueKind===`posthog-projects`&&(e=RX(t[i.path])),i.control===`select`&&!i.options.some(e=>e.value===t[i.path])&&(e=`Choose one of the available options.`),e&&(r[i.id]=e)}return BX(bX(e),t,r),r}function BX(e,t,n){for(let r of e){let i=e.find(e=>e.id===r.maximumSettingId);if(!i||n[r.id]||n[i.id])continue;let a=Number(t[r.path]),o=Number(t[i.path]);a>o&&(n[r.id]=`Minimum must not exceed the maximum (${o}).`,n[i.id]=`Maximum must not be below the minimum (${a}).`)}}function VX(e,t){return bX(e).find(e=>e.id===t.maximumSettingId||e.maximumSettingId===t.id)}function HX(e){let t={browser:[],machine:[],lanes:[],projects:[]};for(let n of e)t[n.level]||(t[n.level]=[]),t[n.level].push(n);return t}function UX(e,t){let n=SX(t);if(n.length===0)return[];let r=[];for(let t of e){let e=SX(t.title);for(let i of t.settings||[]){let a=OX(SX(i.title),n,1e3),o=OX(SX((i.keywords||[]).join(` `)),n,100),s=OX(e,n,10),c=OX(SX(i.description),n,1),l=a+o+s+c;l!==0&&r.push({section:t,setting:i,score:l})}}return r.sort((e,t)=>t.score-e.score||e.section.title.localeCompare(t.section.title)||e.setting.title.localeCompare(t.setting.title)).slice(0,30)}function WX(e,t,n={},r={}){let i=/^#settings\/([^/]+)(?:\/([^/]+))?$/.exec(String(e||``));if(!i)return null;let a,o;try{a=decodeURIComponent(i[1]),o=i[2]?decodeURIComponent(i[2]):null}catch{return null}let s=(o?r[a]?.[o]:void 0)||n[a]||a,c=t.find(e=>e.id===s);if(!c)return null;let l=o?(c.settings||[]).find(e=>e.id===o):null;return o&&!l?null:{sectionId:s,settingId:l?.id||null,hash:`#settings/${s}${l?`/${l.id}`:``}`}}function GX(e){let t=`lanes-unattended`,n=e.find(e=>e.id===t);if(!n)return[...e];let r=e.filter(e=>e.id!==t),i=r.findLastIndex(e=>e.level===`lanes`);return r.splice(i+1,0,n),r}function KX(e,t,n){return{id:`project-${e}-${t}`,projectId:e,...n}}function qX(e){return String(e||``).replace(/\s+\(\d+\)$/,``)}function JX(e){return String(e||``).replace(/[\\/]+$/,``).split(/[\\/]/).at(-1)||``}function YX(e){return JX(e?.path)||qX(e?.name)||e?.id}function XX(e=[]){return e.filter(e=>typeof e?.id==`string`&&e.id).map(e=>({id:`project-${e.id}`,level:`projects`,title:YX(e),description:`Settings scoped to this configured project.`,caption:(e.recordNames?.length??0)>1?`Cards: ${e.recordNames?.join(`, `)}`:``,project:e,settings:[KX(e.id,`agent`,{path:`project:${e.id}:agent`,title:`Agent`,description:`Agent configured for this project.`,control:`readonly`,keywords:[`cli`,`runtime`],value:e.agent||`Not available in the current dashboard payload`}),KX(e.id,`permission-mode`,{path:`project:${e.id}:permission-mode`,title:`Default permission mode`,description:`Permission mode used for newly spawned sessions.`,control:`readonly`,keywords:[`approval`,`sandbox`],value:e.permissionMode||`Not available in the current dashboard payload`}),KX(e.id,`codex-hook-trust`,{path:`projects.${e.id}.codexBypassHookTrust`,title:`Codex hook trust bypass`,description:`Configured only on this project record.`,control:`readonly`,keywords:[`hooks`,`codex`],fileOnly:!0})]}))}function ZX(e=[]){let t=new Set;return e.filter(e=>typeof e?.id!=`string`||!e.id?!1:!e.path||!t.has(e.path)&&(t.add(e.path),!0))}function QX(e=[],t=[]){let n=new Map(t.filter(e=>typeof e?.id==`string`&&e.id).map(e=>[e.id,e]));return e.map(e=>{let r=n.get(e?.id),i=e?.path||r?.path,a=t.filter(e=>i&&e?.path===i).map(e=>e?.name).filter(e=>typeof e==`string`&&e!==``);return{...r,...e,path:i,recordNames:[...new Set(a)]}})}function $X(e,t){return e.danger===!0&&!!e.warning&&t===!0}function eZ(e,t){return e.find(e=>e.id===t)||e[0]||null}var tZ={ready:{label:`Ready`,meaning:`Ready to merge, or nothing left for you to do.`},passed:{label:`Passed`,meaning:`Checks passing, approved, or nothing open.`},failed:{label:`Failed`,meaning:`Checks failing, an automated review failed, or an auto-rebase failed.`},conflict:{label:`Conflict`,meaning:`Merge conflicts with the base branch.`},"your-turn":{label:`Your turn`,meaning:`Waiting on you: a review to give or a thread to answer.`},"changes-requested":{label:`Changes`,meaning:`A reviewer requested changes.`},thread:{label:`Threads`,meaning:`Unresolved review threads or comments.`},behind:{label:`Behind`,meaning:`The branch is behind its base.`},stale:{label:`Out of date`,meaning:`New commits landed since the automated review.`},fork:{label:`Fork`,meaning:`Opened from a fork, so it is reviewed by hand.`},running:{label:`Running`,meaning:`Checks or an automated review in progress.`},reviewer:{label:`Reviewer`,meaning:`Waiting on a reviewer.`},queued:{label:`Queued`,meaning:`Waiting for an automated review slot.`},draft:{label:`Draft`,meaning:`Still a draft.`},merged:{label:`Merged`,meaning:`Merged.`},discarded:{label:`Discarded`,meaning:`Review discarded or dismissed.`},unknown:{label:`Unknown`,meaning:`GitHub has not computed this yet.`},none:{label:`None`,meaning:`Nothing applies, such as no checks or no review requested.`}},nZ={merged:`M5.45 5.154A4.25 4.25 0 0 0 9.25 7.5h1.378a2.251 2.251 0 1 1 0 1.5H9.25A5.734 5.734 0 0 1 5 7.123v3.505a2.25 2.25 0 1 1-1.5 0V5.372a2.25 2.25 0 1 1 1.95-.218ZM4.25 13.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Zm8.5-4.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5ZM5 3.25a.75.75 0 1 0 0 .005V3.25Z`,draft:`M3.25 1A2.25 2.25 0 0 1 4 5.372v5.256a2.251 2.251 0 1 1-1.5 0V5.372A2.251 2.251 0 0 1 3.25 1Zm9.5 14a2.25 2.25 0 1 1 0-4.5 2.25 2.25 0 0 1 0 4.5ZM2.5 3.25a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0ZM3.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm9.5 0a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5ZM14 7.5a1.25 1.25 0 1 1-2.5 0 1.25 1.25 0 0 1 2.5 0Zm0-4.25a1.25 1.25 0 1 1-2.5 0 1.25 1.25 0 0 1 2.5 0Z`,conflict:`M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z`,behind:`M13.03 8.22a.75.75 0 0 1 0 1.06l-4.25 4.25a.75.75 0 0 1-1.06 0L3.47 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018l2.97 2.97V3.75a.75.75 0 0 1 1.5 0v7.44l2.97-2.97a.75.75 0 0 1 1.06 0Z`,failed:`M2.343 13.657A8 8 0 1 1 13.658 2.343 8 8 0 0 1 2.343 13.657ZM6.03 4.97a.751.751 0 0 0-1.042.018.751.751 0 0 0-.018 1.042L6.94 8 4.97 9.97a.749.749 0 0 0 .326 1.275.749.749 0 0 0 .734-.215L8 9.06l1.97 1.97a.749.749 0 0 0 1.275-.326.749.749 0 0 0-.215-.734L9.06 8l1.97-1.97a.749.749 0 0 0-.326-1.275.749.749 0 0 0-.734.215L8 6.94Z`,running:`M8 4a4 4 0 1 1 0 8 4 4 0 0 1 0-8Z`,passed:`M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z`,ready:`M8 16A8 8 0 1 1 8 0a8 8 0 0 1 0 16Zm3.78-9.72a.751.751 0 0 0-.018-1.042.751.751 0 0 0-1.042-.018L6.75 9.19 5.28 7.72a.751.751 0 0 0-1.042.018.751.751 0 0 0-.018 1.042l2 2a.75.75 0 0 0 1.06 0Z`,"changes-requested":`M1 1.75C1 .784 1.784 0 2.75 0h7.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16H2.75A1.75 1.75 0 0 1 1 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h10.5a.25.25 0 0 0 .25-.25V4.664a.25.25 0 0 0-.073-.177l-2.914-2.914a.25.25 0 0 0-.177-.073ZM8 3.25a.75.75 0 0 1 .75.75v1.5h1.5a.75.75 0 0 1 0 1.5h-1.5v1.5a.75.75 0 0 1-1.5 0V7h-1.5a.75.75 0 0 1 0-1.5h1.5V4A.75.75 0 0 1 8 3.25Zm-3 8a.75.75 0 0 1 .75-.75h4.5a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1-.75-.75Z`,thread:`M1 2.75C1 1.784 1.784 1 2.75 1h10.5c.966 0 1.75.784 1.75 1.75v7.5A1.75 1.75 0 0 1 13.25 12H9.06l-2.573 2.573A1.458 1.458 0 0 1 4 13.543V12H2.75A1.75 1.75 0 0 1 1 10.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h4.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z`,reviewer:`M1.75 1h12.5c.966 0 1.75.784 1.75 1.75v8.5A1.75 1.75 0 0 1 14.25 13H8.061l-2.574 2.573A1.458 1.458 0 0 1 3 14.543V13H1.75A1.75 1.75 0 0 1 0 11.25v-8.5C0 1.784.784 1 1.75 1ZM1.5 2.75v8.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-8.5a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25Zm5.28 1.72a.75.75 0 0 1 0 1.06L5.31 7l1.47 1.47a.751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018l-2-2a.75.75 0 0 1 0-1.06l2-2a.75.75 0 0 1 1.06 0Zm2.44 0a.75.75 0 0 1 1.06 0l2 2a.75.75 0 0 1 0 1.06l-2 2a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L10.69 7 9.22 5.53a.75.75 0 0 1 0-1.06Z`,"your-turn":`M8 16a2 2 0 0 0 1.985-1.75c.017-.137-.097-.25-.235-.25h-3.5c-.138 0-.252.113-.235.25A2 2 0 0 0 8 16ZM3 5a5 5 0 0 1 10 0v2.947c0 .05.015.098.042.139l1.703 2.555A1.519 1.519 0 0 1 13.482 13H2.518a1.516 1.516 0 0 1-1.263-2.36l1.703-2.554A.255.255 0 0 0 3 7.947Zm5-3.5A3.5 3.5 0 0 0 4.5 5v2.947c0 .346-.102.683-.294.97l-1.703 2.556a.017.017 0 0 0-.003.01l.001.006c0 .002.002.004.004.006l.006.004.007.001h10.964l.007-.001.006-.004.004-.006.001-.007a.017.017 0 0 0-.003-.01l-1.703-2.554a1.745 1.745 0 0 1-.294-.97V5A3.5 3.5 0 0 0 8 1.5Z`,queued:`M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Zm7-3.25v2.992l2.028.812a.75.75 0 0 1-.557 1.392l-2.5-1A.751.751 0 0 1 7 8.25v-3.5a.75.75 0 0 1 1.5 0Z`,fork:`M5 5.372v.878c0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75v-.878a2.25 2.25 0 1 1 1.5 0v.878a2.25 2.25 0 0 1-2.25 2.25h-1.5v2.128a2.251 2.251 0 1 1-1.5 0V8.5h-1.5A2.25 2.25 0 0 1 3.5 6.25v-.878a2.25 2.25 0 1 1 1.5 0ZM5 3.25a.75.75 0 1 0-1.5 0 .75.75 0 0 0 1.5 0Zm6.75.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Zm-3 8.75a.75.75 0 1 0-1.5 0 .75.75 0 0 0 1.5 0Z`,discarded:`M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Zm9.78-2.22-5.5 5.5a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734l5.5-5.5a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042Z`,stale:`M1.705 8.005a.75.75 0 0 1 .834.656 5.5 5.5 0 0 0 9.592 2.97l-1.204-1.204a.25.25 0 0 1 .177-.427h3.646a.25.25 0 0 1 .25.25v3.646a.25.25 0 0 1-.427.177l-1.38-1.38A7.002 7.002 0 0 1 1.05 8.84a.75.75 0 0 1 .656-.834ZM8 2.5a5.487 5.487 0 0 0-4.131 1.869l1.204 1.204A.25.25 0 0 1 4.896 6H1.25A.25.25 0 0 1 1 5.75V2.104a.25.25 0 0 1 .427-.177l1.38 1.38A7.002 7.002 0 0 1 14.95 7.16a.75.75 0 0 1-1.49.178A5.5 5.5 0 0 0 8 2.5Z`,unknown:`M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.92 6.085h.001a.749.749 0 1 1-1.342-.67c.169-.339.436-.701.849-.977C6.845 4.16 7.369 4 8 4a2.756 2.756 0 0 1 1.637.525c.503.377.863.965.863 1.725 0 .448-.115.83-.329 1.15-.205.307-.47.513-.692.662-.109.072-.22.138-.313.195l-.006.004a6.24 6.24 0 0 0-.26.16.952.952 0 0 0-.276.245.75.75 0 0 1-1.248-.832c.184-.264.42-.489.692-.661.103-.067.207-.132.313-.195l.007-.004c.1-.061.182-.11.258-.161a.969.969 0 0 0 .277-.245C8.96 6.514 9 6.427 9 6.25a.612.612 0 0 0-.262-.525A1.27 1.27 0 0 0 8 5.5c-.369 0-.595.09-.74.187a1.01 1.01 0 0 0-.34.398ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z`,none:`M2 7.75A.75.75 0 0 1 2.75 7h10a.75.75 0 0 1 0 1.5h-10A.75.75 0 0 1 2 7.75Z`};function rZ(e,t){let n=QL(16,16);return n.classList.add(`pr-status-icon`),t&&(n.dataset.tone=t),n.append(ZL(`path`,{d:nZ[e],fill:`currentColor`})),n}var iZ=(e,t,n=!1)=>({state:e,awaitingBackgroundTasks:n,label:n?`Monitoring`:Gs[e],meaning:t}),aZ=Object.freeze([iZ(F.DORMANT,`Not started yet.`),iZ(F.INITIALIZING,`Setting up the worktree and launching the agent.`),iZ(F.STARTING,`The agent is booting.`),iZ(F.RUNNING,`The agent is mid-turn.`),iZ(F.RUNNING,`The turn ended but background tasks or sub-agents are still running.`,!0),iZ(F.WAITING,`Waiting on a permission prompt or your answer.`),iZ(F.IDLE,`Ready for the next prompt.`),iZ(F.COMPLETE,`Finished a turn you have not looked at yet.`),iZ(F.DONE,`The agent process ended.`),iZ(F.FAILED,`The agent failed to start or crashed.`)]);function oZ(e,t){let n=V(`section`,`status-legend`),r=V(`dl`,`status-legend-rows`);return r.append(...t),n.append(V(`h2`,`status-legend-title`,e),r),n}function sZ(e,t){let n=V(`div`,`status-legend-row`);return n.append(e,V(`dd`,`status-legend-meaning`,t)),n}function cZ(){return oZ(`Status colors`,aZ.map(e=>{let t=V(`dt`,`status-legend-badge`),n=V(`span`,`status-legend-glyph`),r=V(`span`,`status-legend-name`);n.setAttribute(`aria-hidden`,`true`),t.append(n,r);let i=sZ(t,e.meaning);return fU(i,{glyph:n,label:r},e.state,e.awaitingBackgroundTasks),i}))}function lZ(){return oZ(`Pull request icons`,Object.keys(tZ).map(e=>{let t=tZ[e],n=V(`dt`,`status-legend-badge`);return n.append(rZ(e),V(`span`,`status-legend-name`,t.label)),sZ(n,t.meaning)}))}var uZ=2e4,Z=null,dZ=null,fZ=null,pZ=null,mZ=null,hZ=null,gZ=null,_Z=`all`,vZ=!1,yZ=null,bZ=AM,xZ=kM,SZ=OM,CZ=!1,wZ=null,TZ=`day`,EZ=new Set,DZ=Ek({getAck:lO,setAck:uO,signature:()=>Aae(Z,fZ),isLooking:()=>!$d(pZ)}),OZ=null,kZ=null,AZ=null,jZ=null,MZ=null,NZ=null,PZ=null,FZ=null,IZ=iF(()=>pZ),LZ=(e,t)=>Xd(`usage`,e,t);function RZ(e,t,n,r){let i=V(`div`,`usage-tile`);r&&r!==`ok`&&(i.dataset.tone=r);let a=V(`span`,`usage-tile-value`,t);i.append(a,V(`span`,`usage-tile-label`,e));let o=n?V(`span`,`usage-tile-sub`,n):null;return o&&i.append(o),{tile:i,valueEl:a,subEl:o}}function zZ(e){let t=Number(e);return Number.isFinite(t)?Math.min(Math.max(t,0),100):0}function BZ(e,t,n){let r=V(`div`,`usage-meter`);r.dataset.tone=String(t),r.setAttribute(`role`,`progressbar`),r.setAttribute(`aria-valuemin`,`0`),r.setAttribute(`aria-valuemax`,`100`),r.setAttribute(`aria-label`,n);let i=V(`span`,`usage-meter-fill`);return r.append(i),VZ(r,e),r}function VZ(e,t){if(!e)return;let n=zZ(t);e.setAttribute(`aria-valuenow`,String(Math.round(n)));let r=e.querySelector(`.usage-meter-fill`);r&&(r.style.width=`${n}%`)}function HZ(e,t,n,r){let i=V(`div`,`usage-table-scroll`);i.dataset.usageTable=r;let a=V(`table`,`usage-table`),o=V(`thead`),s=V(`tr`);for(let i of e){let e=V(`th`,i.numeric?`usage-num`:null);if(e.scope=`col`,!i.key){e.textContent=i.label,s.append(e);continue}let a=i.key;e.setAttribute(`aria-sort`,Wae(t,a));let o=V(`button`,`usage-sort`,i.label);o.type=`button`,o.dataset.sortKey=a,o.addEventListener(`click`,()=>{wZ={kind:`sort`,table:r,key:a},n(a)}),e.append(o),s.append(e)}o.append(s);let c=V(`tbody`);return a.append(o,c),i.append(a),{wrap:i,body:c}}function UZ(e,t){for(let n of t){let t=V(`td`,n.numeric?`usage-num`:n.className||null,n.node?null:n.text);n.node&&t.append(n.node),n.title&&(t.title=n.title),n.span&&(t.colSpan=n.span),e.append(t)}}function WZ(e){let t=V(`div`,`usage-share`);if(!Number.isFinite(e))return t.append(V(`span`,`usage-share-text`,Pj(e))),t;let n=V(`span`,`usage-share-bar`),r=V(`span`,`usage-share-fill`);return r.style.width=`${zZ(e)}%`,n.append(r),t.append(n,V(`span`,`usage-share-text`,Pj(e))),t}function GZ(){if(!OZ?.isConnected)return;let e=Number(Z?.ts);OZ.textContent=Number.isFinite(e)&&e>0?`Report ${nF(e)}`:``}function KZ(){if(!kZ?.isConnected)return;let e=Number(dZ?.ts);kZ.textContent=Number.isFinite(e)&&e>0?`Sessions ${nF(e)}`:``}function qZ(){let e=Hj(Z?.activeBlock);e&&(jZ?.isConnected&&(jZ.textContent=`${e.pct}%`),MZ?.isConnected&&(MZ.textContent=`${Vj(e.remainingMinutes)} left`),NZ?.isConnected&&VZ(NZ,e.pct))}function JZ(e){let t=Ej.find(t=>t.value===e);return t?t.days:null}function YZ(){let e=V(`div`,`usage-controls`),t=V(`label`,`usage-control`);t.append(V(`span`,`usage-control-label`,`Range`));let n=V(`select`,`usage-select`);for(let e of Ej){let t=V(`option`,null,e.label);t.value=e.value,n.append(t)}n.value=_Z,n.addEventListener(`change`,()=>{_Z=n.value,MQ()}),t.append(n);let r=V(`button`,`usage-refresh`,`Refresh`);r.type=`button`,r.title=`Re-read every transcript from the start`,r.addEventListener(`click`,()=>MQ({force:!0}));let i=V(`span`,`usage-refresh-status`,``);return PZ=r,FZ=i,OQ(),e.append(t,r,i),e}function XZ(){let e=LZ(`Usage`,Pie(Z?.daily||[]));e.append(YZ()),OZ=V(`p`,`usage-meta`,``),e.append(OZ),GZ(),IZ.onTick(GZ);let t=Bae(Z);t&&e.append(V(`p`,`usage-warning`,t));let n=Lae(Z?.pricing?.missing);return n&&e.append(V(`p`,`usage-warning`,n)),e}function ZZ(){if(!Oae(fZ))return null;let e=pM(Z?.totals),t=LZ(`Plan limits`,e?`${gM(`official`)}, ${e}`:gM(`official`)),n=Pae(fZ?.ts);if(n){let e=V(`p`,`usage-meta`,n);e.dataset.tone=`warn`,t.append(e)}let r=V(`div`,`usage-plan`);for(let e of mM){let t=hM(fZ,e.key);t&&r.append(QZ(e,t))}return t.append(r),AZ=V(`p`,`usage-meta`,``),t.append(AZ),$Z(),IZ.onTick($Z),t}function QZ(e,t){let n=V(`div`,`usage-plan-window`),r=V(`div`,`usage-plan-head`);r.append(V(`span`,`usage-plan-label`,e.label)),r.append(V(`span`,`usage-plan-used`,jae(t)));let i=V(`span`,`usage-plan-reset`,``);r.append(i),n.append(r),Number.isFinite(t.pct)&&n.append(BZ(t.pct,Uj(t.pct),`${e.label} plan limit used`));let a=()=>{i.isConnected&&(i.textContent=Mae(t.resetsAtMs))};return a(),IZ.onTick(a),n}function $Z(){if(!AZ?.isConnected)return;let e=vM(fZ?.ts);AZ.textContent=e?`Plan ${e}`:``}function eQ(){let e=Xie(Z,fZ),t=tQ();if(e.length===0&&!t)return null;let n=LZ(`Glimmervoid overhead`,e.length>0?Gie:null);if(e.length>0){let t=V(`div`,`usage-tiles`);for(let n of e){let e=[Zie(n),Mj(n.costUSD)].filter(Boolean).join(`, `);t.append(RZ(`${n.label}, share of Claude use`,Pj(n.sharePct),e).tile)}n.append(t);for(let t of e){let e=Qie(t);e&&n.append(V(`p`,`usage-meta`,`${t.label}: ${e}`))}}return t&&(n.append(V(`p`,`usage-meta`,`Selected range by lane. ${Wie}`)),n.append(t)),n}function tQ(){if(!Kie(Z))return null;let e=Yj(Z),t=e.reduce((e,t)=>e+(typeof t.costUSD==`number`&&Number.isFinite(t.costUSD)?t.costUSD:0),0),{wrap:n,body:r}=HZ([{label:`Lane`},{label:`Cost`,numeric:!0},{label:`Tokens`,numeric:!0},{label:`Sessions`,numeric:!0},{label:`Share`,numeric:!0}],null,()=>{},`lane`);for(let n of e){let e=V(`tr`,`usage-row`);n.lane===`other`&&(e.dataset.lane=`other`),UZ(e,[{text:Jj(n.lane),className:`usage-lane-cell`},{text:Mj(n.costUSD),numeric:!0},{text:Nj(n.tokens),numeric:!0},{text:Qj(n.sessions),numeric:!0},{node:WZ(Lj(n.costUSD,t)),className:`usage-share-cell`}]),r.append(e)}return n}function nQ(){let e=Z?.activeBlock,t=Z?.blockHours,n=typeof t==`number`&&Number.isFinite(t)?t:5,r=pM(Z?.totals),i=LZ(`Current block`,r?`${n}h window, ${r}`:`${n}h window`);if(!e){i.append(V(`p`,`usage-empty`,`No active block.`));let e=rQ();return e&&i.append(e),i}let a=_M(Z,fZ),o=V(`div`,`usage-tiles`);o.append(RZ(`block tokens`,Nj(e.tokens??0),Mj(e.costUSD??0),a).tile);for(let t of Rie(e.burn))o.append(RZ(t.label,t.value,t.sub,a).tile);let s=Hj(e);if(s){let e=RZ(`elapsed`,`${s.pct}%`,`${Vj(s.remainingMinutes)} left`);jZ=e.valueEl,MZ=e.subEl,o.append(e.tile)}i.append(o),s&&(NZ=BZ(s.pct,`ok`,`Elapsed share of the current block window`),i.append(NZ),IZ.onTick(qZ));let c=zie(e.projection);if(c){let e=V(`p`,`usage-projection`,c);e.dataset.tone=a,i.append(e)}let l=rQ();l&&i.append(l);let u=Bie(Z?.tokenLimit);if(!u)return i;let d=Gj(Z?.tokenLimit),f=_M(Z);i.append(BZ(d,f,`Share of the largest completed block seen, estimated`));let p=V(`p`,`usage-meta`,u);p.dataset.tone=f,i.append(p),i.append(V(`p`,`usage-provenance`,gM(`estimated`)));let m=Vie(e.projection,Z?.tokenLimit);if(m){let e=V(`p`,`usage-meta`,m);e.dataset.tone=f,i.append(e)}return i}function rQ(){let e=Z?.anomaly;if(!Cae(e))return null;let t=V(`p`,`usage-meta`,xae(e));return t.dataset.tone=Sae(e),t}function iQ(){let e=Xae(Z?.blocks);if(e.length===0)return null;let t=pM(Z?.totals),n=LZ(`Recent blocks`,t?`newest first, ${t}`:`newest first`),r=V(`div`,`usage-blocks`),i=e.reduce((e,t)=>Math.max(e,t.tokens),0);for(let t of e){let e=V(`div`,`usage-block`);t.isActive&&(e.dataset.active=`true`),e.append(V(`span`,`usage-block-label`,Lie(t.startTs)));let n=V(`span`,`usage-block-bar`),a=V(`span`,`usage-block-fill`);a.style.width=`${zZ(Lj(t.tokens,i)??0)}%`,n.append(a),e.append(n),e.append(V(`span`,`usage-block-value`,`${Nj(t.tokens)} ${Mj(t.costUSD)}`)),r.append(e)}return n.append(r),n}function aQ(){let e=Z?.totals||{},t=Yae(Z?.daily,zj(Z)),n=LZ(`Totals`,[Aie,Z?.tz?`TZ ${Z.tz}`:``].filter(Boolean).join(` `)),r=_M(Z,fZ),i=V(`div`,`usage-tiles`);i.append(RZ(`today`,Nj(t?.tokens??0),Mj(t?.costUSD??0),r).tile),i.append(RZ(`range total`,Nj(e.tokens??0),Mj(e.costUSD??0)).tile);let a=$ie(Z);a&&i.append(RZ(a.label,a.value,a.sub).tile),n.append(i);let o=oQ(e);o&&n.append(o);let s=fM(e)?Tae(e):[];if(s.length>0){let e=V(`div`,`usage-tiles usage-vendor-tiles`);for(let t of s)e.append(RZ(t.label,Nj(t.tokens),Mj(t.costUSD)).tile);n.append(e)}return kZ=V(`p`,`usage-meta`,``),n.append(kZ),KZ(),IZ.onTick(KZ),n}function oQ(e){let t=Uie(e);if(t.length===0)return null;let n=V(`div`,`usage-compo`),r=V(`div`,`usage-compo-bar`);r.setAttribute(`aria-hidden`,`true`);for(let e of t){if(e.pct<=0)continue;let t=V(`span`,`usage-compo-fill`);t.dataset.part=e.key,t.style.width=`${e.pct}%`,t.title=e.title,r.append(t)}let i=V(`div`,`usage-compo-legend`);for(let e of t){let t=V(`span`,`usage-compo-item`),n=V(`span`,`usage-compo-swatch`);n.dataset.part=e.key,t.append(n,V(`span`,`usage-compo-label`,e.label),V(`span`,`usage-compo-value`,e.value)),i.append(t)}return n.append(r,i),n}function sQ(){let e=Z?.savings;if(!eae(e))return null;let t=LZ(`Savings`,``),n=V(`div`,`usage-tiles`),r=tae(e);r&&n.append(RZ(`rtk compression`,r.value,r.sub).tile);let i=nae(e);return i&&n.append(RZ(`Prompt cache`,i.value,i.sub).tile),t.append(n),t}function cQ(){let e=tM(Z);if(e.length===0)return null;let t=LZ(`Budgets`,`your own ceilings`),n=V(`div`,`usage-budgets`),r=bW(`machine-usage`,`usage-daily-budget`,`Budget settings`);n.appendChild(r);for(let t of e){let e=V(`div`,`usage-budget`),r=V(`div`,`usage-budget-head`);r.append(V(`span`,`usage-budget-label`,nM(t.scope))),r.append(V(`span`,`usage-budget-value`,rae(t))),r.append(V(`span`,`usage-budget-pct`,Pj(rM(t)))),e.append(r),e.append(BZ(rM(t),t.tone,iae(t))),n.append(e)}return t.append(n),t}function lQ(){let e=Z?.daily||[],t=TZ,n=Jae(dae(e,t),bZ),r=iM.find(e=>e.value===t)?.label||`Day`,i=LZ(`Over time`,[mae(e)].filter(Boolean).join(`, `));if(i.append(uQ()),n.length===0)return i.append(V(`p`,`usage-empty`,`No usage.`)),i;let a=fQ(e);a&&i.append(a);let{wrap:o,body:s}=HZ([{label:r,key:`day`},{label:`Tokens`,numeric:!0,key:`tokens`},{label:`Cost`,numeric:!0,key:`costUSD`},{label:`Models`}],bZ,e=>{bZ=DM(bZ,e),xQ()},`day`);for(let e of n){let n=String(e.day??``),r=V(`tr`,`usage-row`);e.source===`history`&&(r.dataset.source=`history`);let i=jM(e.models),a=`${t}:${n}`,o=pQ(a,i.length);UZ(r,[{node:dQ(e,t),title:n},{text:Nj(e.tokens),numeric:!0},{text:Mj(e.costUSD),numeric:!0},{node:o,className:`usage-toggle-cell`}]),s.append(r),i.length!==0&&EZ.has(a)&&s.append(mQ(i))}return i.append(o),i}function uQ(){let e=V(`div`,`usage-period`);e.setAttribute(`role`,`group`),e.setAttribute(`aria-label`,`Period`);for(let t of iM){let n=V(`button`,`usage-period-button`,t.label);n.type=`button`,n.dataset.periodView=t.value,n.setAttribute(`aria-pressed`,t.value===TZ?`true`:`false`),n.addEventListener(`click`,()=>{TZ!==t.value&&(TZ=t.value,wZ={kind:`period`,view:t.value},xQ())}),e.append(n)}return e}function dQ(e,t){let n=V(`span`,`usage-period-cell`);return n.append(V(`span`,null,pae(e.day,t))),e.source===`history`&&n.append(V(`span`,`usage-history-tag`,`history`)),n}function fQ(e){let{cells:t,max:n}=_ae(e,{today:zj(Z)});if(t.length===0||n<=0)return null;let r=V(`div`,`usage-heatmap-scroll`),i=V(`div`,`usage-heatmap`);i.setAttribute(`role`,`img`),i.setAttribute(`aria-label`,`Daily usage for the trailing ${Math.max(...t.map(e=>e.week))+1} weeks`);let a=V(`div`,`usage-heatmap-days`);for(let e of hae)a.append(V(`span`,`usage-heatmap-day`,e));for(let e of t){let t=V(`span`,`usage-heatmap-cell`);t.dataset.tone=String(e.tone),e.noData&&(t.dataset.noData=`true`),e.source===`history`&&(t.dataset.source=`history`),t.style.gridColumn=String(e.week+1),t.style.gridRow=String(e.weekday+1),t.title=vae(e),i.append(t)}return r.append(a,i),r}function pQ(e,t){if(t===0)return null;let n=V(`button`,`usage-toggle`,`Models`);return n.type=`button`,n.dataset.usageDay=e,n.setAttribute(`aria-expanded`,EZ.has(e)?`true`:`false`),n.addEventListener(`click`,()=>{wZ={kind:`day`,day:e},EZ.has(e)?(EZ.delete(e),xQ()):(EZ.add(e),xQ())}),n}function mQ(e){let t=V(`tr`,`usage-row-breakdown`),n=V(`td`,`usage-models`);n.colSpan=4;for(let t of e){let e=V(`span`,`usage-model-chip`);e.append(V(`span`,`usage-model-name`,CM(t)),V(`span`,`usage-model-value`,`${Nj(t.tokens)} ${Mj(t.costUSD)}`)),n.append(e)}return t.append(n),t}function hQ(e,t){let n=V(`span`,`usage-model-name-wrap`),r=wae(e,t);return r&&n.append(V(`span`,`usage-vendor-tag`,r)),n.append(V(`span`,null,CM(e))),n}function gQ(){let e=jM(Z?.models,xZ),t=Z?.totals||{},n=Fj(t),r=LZ(`By model`,Ij(n));if(e.length===0)return r.append(V(`p`,`usage-empty`,`No models.`)),r;let{wrap:i,body:a}=HZ([{label:`Model`,key:`model`},{label:`Tokens`,numeric:!0,key:`tokens`},{label:`Cost`,numeric:!0,key:`costUSD`},{label:`Share`,numeric:!0},{label:`Input`,numeric:!0,key:`input`},{label:`Output`,numeric:!0,key:`output`},{label:`Cache write`,numeric:!0,key:`cacheCreate`},{label:`Cache read`,numeric:!0,key:`cacheRead`}],xZ,e=>{xZ=DM(xZ,e),xQ()},`model`);for(let r of e){let e=V(`tr`,`usage-row`);UZ(e,[{node:hQ(r,t),className:`usage-model-cell`,title:CM(r)},{text:Nj(r.tokens),numeric:!0},{text:Mj(r.costUSD),numeric:!0},{node:WZ(Lj(r[n],t[n])),className:`usage-share-cell`},{text:Nj(r.input),numeric:!0},{text:Nj(r.output),numeric:!0},{text:Nj(r.cacheCreate),numeric:!0},{text:Nj(r.cacheRead),numeric:!0}]),a.append(e)}return r.append(i),r}function _Q(){let e=Gae(Z?.sessions,SZ),t=Kae(e,CZ),n=Z?.totals||{},r=Fj(n),i=LZ(`By session`,Ij(r));if(e.length===0)return i.append(V(`p`,`usage-empty`,`No sessions.`)),i;let{wrap:a,body:o}=HZ([{label:`Session`,key:`label`},{label:`Tokens`,numeric:!0,key:`tokens`},{label:`Cost`,numeric:!0,key:`costUSD`},{label:`Share`,numeric:!0},{label:`Last activity`,numeric:!0,key:`lastTs`}],SZ,e=>{SZ=DM(SZ,e),xQ()},`session`);for(let e of t.rows){let t=V(`tr`,`usage-row`);xM(e)&&(t.dataset.managed=`true`);let i=SM(e),a=V(`span`,`usage-ago`,``);UZ(t,[{text:i,className:`usage-session-cell`,title:e.project?String(e.project):i},{text:Nj(e.tokens),numeric:!0},{text:Mj(e.costUSD),numeric:!0},{node:WZ(Lj(e[r],n[r])),className:`usage-share-cell`},{node:a,numeric:!0}]),IZ.track(a,Number(e.lastTs),nF),o.append(t)}return i.append(a),e.length>10&&i.append(vQ(t.hiddenCount)),i}function vQ(e){let t=V(`div`,`usage-overflow`),n=qae(e);n&&t.append(V(`p`,`usage-meta`,n));let r=V(`button`,`usage-toggle`,`All sessions`);return r.type=`button`,r.dataset.usageSessionsToggle=`true`,r.setAttribute(`aria-expanded`,CZ?`true`:`false`),r.addEventListener(`click`,()=>{wZ={kind:`sessions-toggle`},CZ=!CZ,xQ()}),t.append(r),t}function yQ(){let e=LZ(`Not available`,``);return e.append(V(`p`,`usage-empty`,yM(Z))),e.append(V(`p`,`usage-empty`,jie)),e}function bQ(){OZ=null,kZ=null,AZ=null,jZ=null,MZ=null,NZ=null,PZ=null,FZ=null}function xQ({force:e=!1}={}){if(!pZ||!e&&$d(pZ))return;let t=pZ.parentElement,n=t?t.scrollTop:0;IZ.reset(),bQ(),pZ.textContent=``,wQ(),t&&(t.scrollTop=n),SQ()}function SQ(){let e=wZ;if(wZ=null,!e)return;let t=CQ(e);if(!t||!pZ)return;let n=pZ.querySelector(t);n instanceof HTMLElement&&n.focus()}function CQ(e){return e.kind===`day`?`.usage-toggle[data-usage-day="${CSS.escape(e.day)}"]`:e.kind===`period`?`.usage-period-button[data-period-view="${CSS.escape(e.view)}"]`:e.kind===`sessions-toggle`?`.usage-toggle[data-usage-sessions-toggle="true"]`:e.kind===`sort`?`[data-usage-table="${CSS.escape(e.table)}"] .usage-sort[data-sort-key="${CSS.escape(e.key)}"]`:null}function wQ(){if(!pZ)return;pZ.append(XZ());let e=ZZ();if(bM(Z)){e&&pZ.append(e),pZ.append(yQ());return}if(!Z){e&&pZ.append(e),pZ.append(V(`p`,`usage-empty`,`Waiting for scan.`));return}let t=[e,cQ()].filter(e=>e!==null);pZ.append(TQ(`usage-band-now`,nQ(),t,{sideFirst:!0}));let n=[sQ()].filter(e=>e!==null);pZ.append(TQ(`usage-band-spend`,aQ(),n));let r=[iQ()].filter(e=>e!==null);pZ.append(TQ(`usage-band-trend`,lQ(),r));let i=eQ();i&&pZ.append(i),pZ.append(gQ(),_Q())}function TQ(e,t,n,{sideFirst:r=!1}={}){if(n.length===0)return t;let i=V(`div`,`usage-band ${e}`),a=V(`div`,`usage-band-col`);for(let e of n)a.append(e);return r?(i.append(a,t),i):(i.append(t,a),i)}function EQ(){mZ&&mZ(DZ.refresh())}function DQ(){DZ.acknowledge(),EQ()}function OQ(){PZ&&(PZ.disabled=vZ),FZ&&(FZ.textContent=vZ?`Refreshing`:``)}function kQ(e){vZ=e,OQ(),yZ&&=(clearTimeout(yZ),null),e&&(yZ=setTimeout(()=>{yZ=null,vZ=!1,OQ()},uZ))}function AQ(e){mZ=e,EQ()}function jQ(e){hZ=e}function MQ({force:e=!1}={}){if(!hZ)return;gZ=Md(`usage`);let t={type:`request-usage-report`,requestId:gZ};e&&(t.force=!0);let n=JZ(_Z);n!==null&&(t.days=n),kQ(!0),hZ(t)}function NQ(e){if(pZ)return pZ;let t=V(`div`,`usage-content`);return e.appendChild(t),pZ=t,IZ.ensure(),xQ({force:!0}),t}function PQ(){xQ({force:!0})}function FQ(e){dZ=e,Z&&!bM(Z)&&kZ?.isConnected?KZ():xQ()}function IQ(e){fZ=e,xQ(),EQ()}function LQ(e){Vae(e,gZ)&&(kQ(!1),Z=e,xQ(),EQ())}function RQ(){let e=Z?.pricing||(dZ?{source:dZ.pricingSource}:null),t=Iae(e?.fetchedAt),n=[Fae(e,t!==null&&t>0?nF(t):``)],r=yM(Z);r&&n.push(r);let i=zae(Z?.scan);return i&&n.push(i),n}var zQ=null,BQ=new Set;function VQ(){zQ?.setAttribute(`aria-pressed`,String(!CD()))}function HQ(e){wD(e),VQ();for(let t of BQ)t(e)}function UQ(e){BQ.add(e)}function WQ(e){zQ=e,VQ(),e.addEventListener(`click`,()=>HQ(!CD()))}var GQ=Object.freeze({fetch:`Fetch`,stage:`Stage`,install:`Install dependencies`,"link-deps":`Link dependencies`,build:`Build`}),KQ=Object.freeze({"branch-count-unavailable":`The last check could not compare the checked-out branch with its upstream.`,"branch-diverged":`The checked-out branch has diverged from its upstream.`,"fetch-failed":`The last update check could not fetch the upstream branch.`,"main-channel-requires-clone":`The main channel requires a clone install.`,"no-branch":`The last update check found no checked-out branch.`,"no-upstream":`The checked-out branch has no upstream.`,"release-already-checked-out":`The checkout already contains the latest release. Restart to run it.`,"release-check-failed":`The last release check failed.`,"remote-tip-unavailable":`The last update check could not resolve the upstream branch tip.`,"update-check-failed":`The last update check failed.`}),qQ=Object.freeze([`unsupported-flavor`,`unsupported-platform`]),JQ=`Not connected to the server. Reconnecting.`,YQ=Object.freeze({requested:!1,failure:null});function XQ(e,t){return t===`request-sent`?{requested:!0,failure:null}:t===`request-unsent`?{requested:!1,failure:JQ}:t===`progress-frame`?YQ:t===`error-frame`?e.requested?YQ:e:e.failure===null?e:{requested:e.requested,failure:null}}function ZQ(e,t){return t?.state?t.state:e?.journalSummary?.state}function QQ(e){return{enabled:!1,reason:e}}function $Q(){return{enabled:!0,reason:null}}function e$({status:e,journal:t,request:n=YQ}){let r=ZQ(e,t)===`running`||n.requested,i=r?QQ(`Wait for update staging to finish.`):$Q();if(n.failure)return{update:QQ(n.failure),restart:i};if(r)return{update:QQ(`Wait for the current update to finish.`),restart:i};if(!e)return{update:QQ(`Update status unavailable. Check for updates.`),restart:i};let a=e.applyRefusal;return a?{update:QQ(a.message),restart:i}:{update:$Q(),restart:i}}function t$(e){let t=e?.applyRefusal;return t===void 0?`command`:t===null?`link`:qQ.includes(t.reason)?`command`:`link`}function n$(e){let t=Ck(e,``);return t?`: ${t}`:``}function r$(e){return e.state===`staged`?`Update staged. Restart to hand it off${n$(e.reason)}.`:e.state===`succeeded`?`Update succeeded at restart${n$(e.reason)}.`:e.state===`failed`?`Update failed${n$(e.reason)}.`:e.state===`discarded`?`Update discarded${n$(e.reason)}.`:e.state===`interrupted`?`Update interrupted${n$(e.reason)}.`:null}function i$(e){return GQ[e]??e}function a$(e){let t=e.steps.find(t=>t.id===e.activeStep);if(t&&t.outputTail.length>0)return{stepId:t.id,lines:t.outputTail};let n=e.steps.findLast(e=>e.outputTail.length>0);return n?{stepId:n.id,lines:n.outputTail}:{stepId:null,lines:[]}}function o$(e){if(!e||e.state===`idle`)return null;let t=a$(e),n=t.stepId!==null&&t.stepId!==e.activeStep?t.stepId:null;return{state:e.state,terminalLine:r$(e),steps:e.steps.map(e=>({id:e.id,label:i$(e.id),status:e.status})),outputTail:t.lines,outputStepId:t.stepId,outputStepLabel:n===null?null:i$(n)}}var s$=6e5;function c$(e){return e.channel!==`main`||!Number.isInteger(e.behindCount)?``:`${e.behindCount} ${e.behindCount===1?`commit`:`commits`} behind`}function l$(e,t){let n=ZQ(e,t),r=_A(t?.toVersion,t?.toSha)||_A(e?.latest,e?.latestSha)||`the update`;if(n===`running`)return{tone:`running`,headline:`Updating to ${r}. Glimmervoid keeps running until the restart.`};if(n===`staged`)return{tone:`staged`,headline:`${r} is staged. Restart to finish updating.`};if(!e)return{tone:`unknown`,headline:`No update check has run yet.`};let i=_A(e.current,e.currentSha)||`an unknown version`;if(e.updateAvailable){let t=_A(e.latest,e.latestSha)||`a newer build`,n=c$(e);return{tone:`available`,headline:`Update available: ${i} to ${t}${n?` (${n})`:``}.`}}return Ck(e.reason,``)?{tone:`unknown`,headline:`Running ${i}. The last check did not finish.`}:{tone:`current`,headline:`Up to date. Running ${i}.`}}function u$(e){if(!e)return`Update status unavailable.`;let t=_A(e.current,null)||`Unknown version`,n=ol(e.currentSha,{validate:!0}),r=Ck(e.installedBranch,``);return[t,[n?`commit ${n}`:``,r?`on ${r}`:``].filter(Boolean).join(` `),e.isTreeClean===!0?`clean checkout`:e.isTreeClean===!1?`uncommitted local changes`:``].filter(Boolean).join(`, `)}function d$(e){return e?{label:_A(e.latest,e.latestSha)||`Latest target unknown`,behind:c$(e),releaseUrl:Ck(e.releaseUrl,``)}:{label:`Update status unavailable.`,behind:``,releaseUrl:``}}function f$({status:e,checkForUpdates:t,now:n,lastAutoCheckAt:r}){if(t===!1||r!==null&&n-r<s$)return!1;let i=typeof e?.lastCheckAt==`number`?e.lastCheckAt:null;return i===null||n-i>=s$}function p$({status:e,checkForUpdates:t,relativeTime:n}){if(t===!1)return`Update checks are off.`;if(!e)return`No update check has run.`;let r=Ck(e.reason,``);return r?KQ[r]??`The last update check failed: ${r}.`:e.flavor===`unknown`?`The install flavor is unknown.`:n}var m$=UE,h$=Object.freeze({sounds:()=>jb(),themes:$b});function g$(e){if(!e.optionsFrom)return e;let t=h$[e.optionsFrom]?.()??[];return{...e,options:t.map(e=>({value:e.id,label:e.label}))}}function _$(){return Object.freeze($Y.map(e=>({...e,settings:e.settings.map(g$)})))}var v$=_$(),y$=GX(v$),b$=Object.freeze({browser:`This browser`,machine:`Machine`,lanes:`Lanes`,projects:`Projects`}),x$=!1,S$=null,C$=null,w$=null,T$=null,E$=null,D$=null,O$=null,k$=null,A$=null,j$=null,M$=null,Q=y$[0],N$={},P$=[],F$=[],I$=new Map,L$=null,R$=null,z$=``,B$=``,V$=null,H$=null,U$=null,W$=null,G$=YQ,K$=()=>{},q$=e=>{e([])},J$=null,Y$=!1,X$=!1,Z$=null,Q$=new Set,$$=new Map;function e1(){return{themeId:ND(),flyingAnimalsEnabled:FD(),...TO(),soundEnabled:CD(),soundId:Mb(TD()),notificationsEnabled:DD(),compactStatusLabels:kD(),sessionUsageChips:jD()}}function t1(e){let t={...e,prefs:e1()};L$=NX(y$,t),R$=NX(y$,t)}function n1(e){return e.control===`readonly`?e.value:R$?.[e.path]??e.defaultValue}function goe(e){return e.settings.some(e=>!e.path.startsWith(`pref:`)&&JSON.stringify(L$?.[e.path])!==JSON.stringify(R$?.[e.path]))}function r1(e,t=null){return`#settings/${encodeURIComponent(e)}${t?`/${encodeURIComponent(t)}`:``}`}function i1(e,t=null){history.replaceState(history.state,``,r1(e,t))}function a1(e){requestAnimationFrame(()=>{let t=document.getElementById(e),n=t?.closest(`.settings-view-advanced-panel`);n&&(x$=!0,n.hidden=!1,M$?.querySelector(`.settings-view-advanced-toggle`)?.setAttribute(`aria-expanded`,`true`));let r=t?.closest(`.settings-view-setting`);r&&(r.scrollIntoView({block:`center`}),r.classList.remove(`settings-view-setting-flash`),requestAnimationFrame(()=>r.classList.add(`settings-view-setting-flash`)))})}function o1(){let e=XX(F$);y$=GX([...v$,...e]),Q=eZ(y$,Q?.id)??Q}function s1(e){let t=Array.isArray(e)?e:[];for(let e of t)typeof e?.id==`string`&&e.id&&I$.set(e.id,{...I$.get(e.id),...e});F$=QX(ZX(P$),[...I$.values()])}function c1(e){for(let t of Tre(db)){let n=V(`div`,`shortcut-group`);n.appendChild(V(`div`,`shortcut-group-title`,t.title));let r=V(`dl`,`shortcut-rows`);for(let e of t.items){let t=V(`dt`,`shortcut-keys`);e.combos.forEach((e,n)=>{n>0&&t.appendChild(V(`span`,`shortcut-sep`,`/`)),mb(t,e)}),r.append(t,V(`dd`,`shortcut-label`,e.label))}n.appendChild(r),e.appendChild(n)}}function l1(e){let t=V(`div`,`settings-about`),n=V(`span`,`settings-about-version`,`GLIMMERVOID `);n.appendChild(V(`span`,`settings-about-v`,`v0.35.0`));let r=V(`span`,`settings-about-links`),i=V(`a`,`settings-about-link`,`GitHub`);i.href=`https://github.com/${aY}`,i.target=`_blank`,i.rel=`noopener`;let a=V(`a`,`settings-about-link`,`Changelog`);a.href=`https://github.com/${aY}/blob/main/CHANGELOG.md`,a.target=`_blank`,a.rel=`noopener`,r.append(i,a),t.append(n,r),e.appendChild(t)}function u1(e){R$&&R$[`pref:soundEnabled`]!==e&&(R$[`pref:soundEnabled`]=e,L$&&(L$[`pref:soundEnabled`]=e),n0())}function d1(){for(let[e,t]of Object.entries(TO()))L$&&(L$[`pref:${e}`]=t),R$&&(R$[`pref:${e}`]=t)}var f1={"pref:flyingAnimalsMinGapSeconds":e=>_O(Number(e)),"pref:flyingAnimalsMaxGapSeconds":e=>vO(Number(e)),"pref:flyingAnimalsMinDurationSeconds":e=>yO(Number(e)),"pref:flyingAnimalsMaxDurationSeconds":e=>bO(Number(e)),"pref:flyingAnimalsScale":e=>xO(Number(e)),"pref:flyingAnimalsOnPhone":e=>SO(e===!0)};function p1(e,t){if(e.path===`pref:compactStatusLabels`){AD(t===!0),Xb(t===!0);return}if(e.path===`pref:sessionUsageChips`){MD(t===!0),Zb(t===!0);return}if(e.path===`pref:themeId`){PD(t),Yb(t);return}if(e.path===`pref:flyingAnimalsEnabled`){ID(t),rY(t);return}let n=f1[e.path];if(n){let r=zX([Q],R$??{},m$);if(r[e.id])return;n(t);let i=VX([Q],e),a=i&&f1[i.path];i&&a&&!r[i.id]&&a(R$?.[i.path]),rY(FD())}else e.path===`pref:soundEnabled`?HQ(t===!0):e.path===`pref:soundId`?(ED(t),Ub(t)):e.path===`pref:notificationsEnabled`&&(OD(t),t&&IJ().then(n0))}function m1(){if(!M$||!R$)return;M$.querySelector(`.settings-view-footer`)?.remove();let e=G1(zX([Q],R$,m$));e&&M$.appendChild(e)}function h1(e,t,{rerender:n=!0}={}){R$&&(R$[e.path]=t,z$=``,e.path.startsWith(`pref:`)&&L$&&(L$[e.path]=t,p1(e,t)),n?n0():(m1(),C0()))}function g1(e,t){if(!t.exclusiveMin)return t.min;if(e.integer!==!1)return t.min+1}function _1(e){let t=V(`div`,`settings-view-toggle-wrap`),n=V(`label`,`settings-view-toggle`),r=V(`input`,`settings-view-checkbox`);return r.type=`checkbox`,r.checked=n1(e)===!0,e.id===`desktop-notifications`&&!PJ()&&(r.checked=!1,r.disabled=!0),r.setAttribute(`aria-labelledby`,e.id),r.addEventListener(`change`,()=>h1(e,r.checked)),n.append(r,V(`span`,`settings-view-toggle-state`,r.checked?`On`:`Off`)),t.appendChild(n),t}function v1(e){let t=V(`input`,`settings-view-input`);t.type=e.control??`text`,t.value=String(n1(e)??``),e.control===`password`&&(t.placeholder=`No credential stored`);let n=uX(e,N$);return n&&(t.disabled=!0,t.setAttribute(`aria-description`,`Supplied by ${n}`)),t.autocomplete=`off`,t.spellcheck=!1,t.setAttribute(`aria-labelledby`,e.id),t.addEventListener(`input`,()=>h1(e,t.value,{rerender:!1})),t}function y1(e){let t=V(`input`,`settings-view-input`),n=m$[e.range??``];t.type=`number`,t.value=String(n1(e)??``),t.step=String(e.step??1);let r=g1(e,n);return r!=null&&(t.min=String(r)),n.max!=null&&(t.max=String(n.max)),t.autocomplete=`off`,t.setAttribute(`aria-labelledby`,e.id),e.commitOnChange?(t.addEventListener(`change`,()=>h1(e,t.value.trim()===``?e.defaultValue:t.value)),t):(t.addEventListener(`input`,()=>h1(e,t.value,{rerender:!1})),t)}function b1(e){let t=V(`select`,`settings-view-input`);t.setAttribute(`aria-labelledby`,e.id);for(let n of e.options){let e=V(`option`,null,n.label);e.value=n.value,t.appendChild(e)}return t.value=String(n1(e)),t.addEventListener(`change`,()=>h1(e,t.value)),t}function x1(e){let t=V(`div`,`settings-view-list`),n=n1(e),r=Array.isArray(n)?n:[];r.length===0&&t.appendChild(V(`div`,`settings-empty`,e.listEmptyText??`No repository roots configured.`));for(let[n,i]of r.entries()){let a=V(`div`,`settings-root-item`),o=V(`span`,`settings-root-path`,i);o.title=i;let s=V(`button`,`btn-settings-remove`,`×`);s.type=`button`,s.title=`Remove`,s.setAttribute(`aria-label`,`Remove ${i}`),s.addEventListener(`click`,()=>{h1(e,r.filter((e,t)=>t!==n))}),a.append(o,s),t.appendChild(a)}let i=V(`div`,`settings-add-row`),a=V(`input`,`settings-view-input settings-root-input`);a.type=`text`,a.autocomplete=`off`,a.spellcheck=!1,a.placeholder=e.listPlaceholder??`Repository root path`;let o=V(`button`,`btn-dialog btn-dialog-confirm btn-settings-add`,`Add`);o.type=`button`;let s=()=>{let t=a.value.trim();t&&(oX(r,t,N$.repositoryRootCaseInsensitive===!0)||h1(e,[...r,t]))};return o.addEventListener(`click`,s),a.addEventListener(`keydown`,e=>{e.key===`Enter`&&(e.preventDefault(),s())}),i.append(a,o),t.appendChild(i),t}function S1(e){let t=V(`div`,`settings-view-projects`),n=n1(e),r=new Set(Array.isArray(n)?n:[]),i=Array.isArray(N$.projectChoices)?N$.projectChoices:[];i.length===0&&t.appendChild(V(`div`,`settings-empty`,`No configured projects are available.`));for(let n of aX(i,[...r])){let i=V(`label`,`settings-view-project-choice`),a=V(`input`,`settings-view-checkbox`);a.type=`checkbox`,a.checked=r.has(n.id),a.addEventListener(`change`,()=>{let t=new Set(r);a.checked&&t.add(n.id),a.checked||t.delete(n.id),h1(e,[...t])}),i.append(a,document.createTextNode(n.name)),t.appendChild(i)}return t}function C1(e){let t=V(`div`,`settings-view-file-only`);return t.append(V(`code`,`settings-view-key-path`,e.path)),t.append(V(`span`,`settings-view-file-caption`,`Configured in config.json`)),t}function w1(){let e=l$(U$,W$),t=V(`div`,`settings-readonly settings-update-readout settings-update-summary`,e.headline);return t.dataset.tone=e.tone,t}function T1(){return V(`div`,`settings-readonly settings-update-readout`,u$(U$))}function E1(){let e=d$(U$),t=V(`div`,`settings-readonly settings-update-readout`);if(t.appendChild(V(`span`,`settings-update-latest-label`,e.label)),e.behind&&t.appendChild(V(`span`,`settings-update-behind`,e.behind)),!e.releaseUrl)return t;let n=V(`a`,`settings-link`,`View release`);return n.href=e.releaseUrl,n.target=`_blank`,n.rel=`noopener noreferrer`,t.appendChild(n),t}function D1(){let e=typeof U$?.lastCheckAt==`number`?U$.lastCheckAt:null,t=V(`div`,`settings-readonly settings-update-readout`,p$({status:U$,checkForUpdates:N$.checkForUpdates,relativeTime:nF(e)}));return e&&(t.title=new Date(e).toLocaleString()),t}function O1(e,t,{decision:n={enabled:!0,reason:null},isPrimary:r=!1}={}){let i=V(`button`,`btn-dialog ${r?`btn-dialog-confirm`:`btn-dialog-cancel`} settings-update-button`,e);return i.type=`button`,i.disabled=!n.enabled,i.addEventListener(`click`,t),i}function k1(e){let t=V(`span`,`settings-update-action-status`,e??``);return t.setAttribute(`role`,`status`),t}function A1(e){let t=XQ(G$,e);t!==G$&&(G$=t,w0())}function j1({restartWhenStaged:e,confirmedSessionIds:t}){A1(B({type:`update-apply`,restartWhenStaged:e,confirmedSessionIds:t})?`request-sent`:`request-unsent`)}function M1(){J$=Date.now();let e=B({type:`update-check`});X$=e,Z$=e?null:JQ,w0()}function N1(){return X$?`Checking for updates.`:Z$}function P1(){U$?(Y$=!1,f$({status:U$,checkForUpdates:N$.checkForUpdates,now:Date.now(),lastAutoCheckAt:J$})&&M1()):Y$=!0}function F1(){let e=e$({status:U$,journal:W$,request:G$}),t=V(`div`,`settings-update-actions settings-update-readout`),n=V(`div`,`settings-update-buttons`);n.append(O1(`Update and restart`,()=>q$(e=>j1({restartWhenStaged:!0,confirmedSessionIds:e})),{decision:e.update,isPrimary:!0}),O1(`Update without restart`,()=>j1({restartWhenStaged:!1}),{decision:e.update}),O1(`Check for updates`,M1,{decision:{enabled:!X$,reason:null}}),O1(`Restart`,K$,{decision:e.restart})),t.append(n,k1(e.update.reason));let r=N1();return r&&t.append(k1(r)),t}function I1(e){return e.status===`update-summary`?w1():e.status===`update-installed`?T1():e.status===`update-latest`?E1():e.status===`update-last-checked`?D1():e.status===`update-actions`?F1():V(`div`,`settings-readonly`,String(e.value||`Not configured`))}function L1(e){return e.fileOnly?C1(e):e.control===`readonly`?I1(e):e.control===`toggle`?_1(e):e.control===`number`?y1(e):e.control===`select`?b1(e):e.control===`list`?x1(e):e.control===`projects`?S1(e):v1(e)}function R1(e){let t=uX(e,N$);return t?`Supplied by ${t}. Change the server environment and restart to replace this credential.`:e.status===`visions-activity-limit`?fX(R$||{}):e.id===`desktop-notifications`&&!PJ()?`Desktop notifications are unavailable for this page.`:e.id===`desktop-notifications`&&n1(e)&&FJ()===`denied`?`Blocked by the browser. Allow notifications for this site to enable them.`:e.status!==`rtk-install`||!n1(e)||N$.rtkAvailable?``:pX(N$)}function z1(e){if(e.status===`custom-agents`)return J1();if(e.status===`workflows`)return Q1();if(e.status===`usage-last-report`)return $1();if(e.status===`update-actions`)return B1();if(e.status?.startsWith(`update-`))return null;let t=R1(e);return t?V(`div`,`settings-view-warning settings-view-status-slot`,t):null}function B1(){let e=o$(W$);if(!e)return null;let t=V(`div`,`settings-update-progress settings-view-status-block settings-view-status-slot`);t.dataset.state=e.state,t.setAttribute(`role`,`status`),e.terminalLine&&t.appendChild(V(`div`,`settings-update-terminal`,e.terminalLine));let n=V(`ol`,`settings-update-steps`);for(let t of e.steps){let e=V(`li`,`settings-update-step`);e.dataset.status=t.status,e.append(V(`span`,`settings-update-step-state`,t.status),V(`span`,`settings-update-step-label`,t.label)),n.appendChild(e)}if(t.appendChild(n),e.outputTail.length===0)return t;let r=V(`pre`,`settings-update-output`,e.outputTail.join(`
|
|
246
|
+
`;function $W(e){let t=2166136261,n=3266489909;for(let r=0;r<e.length;r+=1){let i=e.charCodeAt(r);t=Math.imul(t^i,16777619)>>>0,n=Math.imul(n^i,2246822507)>>>0}return`${t.toString(36).padStart(7,`0`)}${n.toString(36).padStart(7,`0`)}`}function eG(e,t){return $W(JSON.stringify([e,...t]))}function tG(e,t){return eG(`finding`,[e,RW(t),String(t.code??``),String(t.message??``)])}function nG(e,t){return eG(`comment`,[e,sG(t),String(t.message??``)])}function rG(e){return eG(`fix`,[e.uri,vG(e),e.code,e.message,yG(e)])}function iG(e){return eG(`intent`,[e.key,e.text,e.active])}function aG(e,t,n,r=[],i=null){let a=[...n].map(([e,t])=>eG(`hand`,[e,t])).sort(),o=new Set;for(let r of[...e.keys(),...t.keys(),...n.keys()])o.add(eG(`document`,[r]));for(let[t,n]of e)for(let e of n)o.add(tG(t,e));for(let[e,n]of t)for(let t of n)o.add(nG(e,t));for(let e of r)o.add(rG(e));for(let e of PW(i,null,0))e.hasText&&o.add(iG(e));let s=[...o].sort();return{signature:[...a,...s].join(QW),handEntries:a,contentEntries:s}}function oG(e,t){let n=new Set(t.split(QW));return e.handEntries.some(e=>!n.has(e))?XW:e.contentEntries.some(e=>!n.has(e))?ZW:null}function sG(e){let t=Number(e?.line);return!Number.isFinite(t)||t<1?`L?`:`L${Math.floor(t)}`}function cG(e){return Array.isArray(e?.diagnostics)?e.diagnostics:[]}function lG(e,t){let n=new Map(e),r=typeof t?.uri==`string`?t.uri:``;if(!r)return n;let i=cG(t);return i.length===0?(n.delete(r),n):(n.set(r,i),n)}function uG(e){return Array.isArray(e?.comments)?e.comments:[]}function dG(e,t){let n=new Map(e),r=typeof t?.uri==`string`?t.uri:``;if(!r)return n;let i=uG(t);return i.length===0?(n.delete(r),n):(n.set(r,i),n)}function fG(e){let t=new Map,n=Array.isArray(e?.documents)?e.documents:[];for(let e of n){let n=typeof e?.uri==`string`?e.uri:``,r=Array.isArray(e?.diagnostics)?e.diagnostics:[];n&&r.length!==0&&t.set(n,r)}return t}function pG(e){let t=new Map,n=Array.isArray(e?.documents)?e.documents:[];for(let e of n){let n=typeof e?.uri==`string`?e.uri:``,r=Array.isArray(e?.comments)?e.comments:[];n&&r.length!==0&&t.set(n,r)}return t}function mG(e,t=new Map,n=new Map){let r=[],i=new Set([...e.keys(),...t.keys(),...n.keys()]);for(let a of i){let i=e.get(a),o=t.get(a),s=n.get(a)||null,c=Array.isArray(i)?i:[],l=Array.isArray(o)?o:[];(c.length!==0||l.length!==0||s)&&r.push({uri:a,name:VW(a)||a,hand:s,findings:[...c].sort((e,t)=>BW(e)-BW(t)||zW(e)-zW(t)),comments:[...l].sort((e,t)=>(Number(e?.line)||0)-(Number(t?.line)||0))})}return r.sort((e,t)=>hG(e.name,t.name)||hG(e.uri,t.uri)),r}function hG(e,t){return e<t?-1:+(e>t)}var gG=`No fixes yet. Silent fixes appear here once the lane applies or is refused one.`;function _G(e){let t=HW(e);return t===1?`1 fix`:`${t} fixes`}function vG(e){let t=Number(e?.line);return!Number.isFinite(t)||t<0?`L?`:`L${Math.floor(t)+1}`}function yG(e){return e?.applied===!0?`applied`:`refused`}function bG(e,{uri:t=``,ts:n=0}={}){if(!e||typeof e!=`object`)return null;let r=e,i=typeof r.message==`string`?r.message.trim():``;if(!i)return null;let a=Number(r.line),o=Number(r.ts??n);return{uri:typeof r.uri==`string`&&r.uri?r.uri:t,code:typeof r.code==`string`?r.code:``,line:Number.isFinite(a)&&a>0?Math.floor(a):0,message:i,applied:r.applied===!0,ts:Number.isFinite(o)&&o>0?o:0}}function xG(e){let t=typeof e?.uri==`string`?e.uri:``,n=Number(e?.ts);return bG(e?.fix,{uri:t,ts:Number.isFinite(n)?n:0})}function SG(e,t,{max:n=20}={}){let r=xG(t);return r?[r,...e].slice(0,Math.max(0,Math.floor(n))):[...e]}function CG(e,{max:t=20}={}){let n=Array.isArray(e?.fixes)?e.fixes:[],r=[];for(let e of n){let t=bG(e);t&&r.push(t)}return r.slice(0,Math.max(0,Math.floor(t)))}var wG=`No activity yet. The ingest lane reports what your sessions and tools are doing.`,TG={terminal:`terminal`,agentLogs:`agent`,git:`git`,fs:`files`,shellHistory:`shell`,editor:`editor`};function EG(e){let t=typeof e==`string`?e:``;return TG[t]||t||`source`}function DG(e,t=Date.now()){let n=Number(e);return!Number.isFinite(n)||n<=0?``:Gf(Number(t)-n,Vf)}function OG(e){if(!e||typeof e!=`object`)return null;let t=e,n=Number(t.seq);if(!Number.isFinite(n))return null;let r=typeof t.summary==`string`?t.summary.trim():``;if(!r)return null;let i=Number(t.ts),a=t.scope&&typeof t.scope==`object`?t.scope:{};return{seq:Math.floor(n),source:typeof t.source==`string`?t.source:``,kind:typeof t.kind==`string`?t.kind:``,ts:Number.isFinite(i)&&i>0?i:0,summary:r,root:typeof a.root==`string`&&a.root?a.root:null,sessionId:typeof a.sessionId==`string`&&a.sessionId?a.sessionId:null}}function kG(e){let t=Array.isArray(e?.events)?e.events:[],n=[];for(let e of t){let t=OG(e);t&&n.push(t)}return n}function AG(e){let t=Number(e?.overflow);return!Number.isFinite(t)||t<=0?0:Math.floor(t)}function jG(e){let t=HW(e);return t<=0?``:t===1?`1 more event not shown`:`${t} more events not shown`}function MG(e,t){return[...e].sort((e,t)=>t.seq-e.seq).slice(0,Math.max(0,Math.floor(t)))}function NG(e,t,{max:n=100}={}){let r=kG(t);if(r.length===0)return MG(e,n);let i=new Map;for(let t of e)i.set(t.seq,t);for(let e of r)i.set(e.seq,e);return MG([...i.values()],n)}function PG(e,{max:t=100}={}){return MG(kG(e),t)}function FG(e){let t=HW(e);return t===1?`1 event`:`${t} events`}function IG(e){if(!e?.root)return`machine`;let t=e.root.replace(/[\\/]+$/,``),n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return n===-1?t:t.slice(n+1)}var LG=new Map,RG=new Map,zG=new Map,BG=EW(),VG=new Map,HG=null,UG=null,WG=null,GG=null,KG=null,qG=[],JG=0,YG=null,XG=[],ZG=null,QG=aG(LG,RG,zG,XG,BG),$G=dO(),eK=Ek({getAck:()=>$G,setAck:e=>{$G=e,fO(e)},signature:()=>QG.signature,isLooking:()=>!$d(HG)});function tK(){let e=V(`section`,`visions-intent`);e.append(V(`h2`,`visions-intent-title`,`Intent`));let t=V(`div`,`visions-intent-list`);return e.append(t),WG={list:t},e}function nK(e){let t=V(`div`,`visions-intent-item`),n=V(`div`,`visions-intent-head`);n.append(V(`span`,`visions-intent-scope`,e.label),V(`span`,`visions-intent-meta`,e.meta));let r=V(`p`,`visions-intent-text`,e.text);return r.classList.toggle(`visions-intent-none`,!e.hasText),t.classList.toggle(`visions-intent-active`,e.active===!0),t.append(n,r),t}function rK(){WG&&WG.list.replaceChildren(...PW(BG,VG).map(nK))}function iK(e){VG=e instanceof Map?e:new Map,rK()}function aK(e){let t=V(`section`,`visions-doc`),n=V(`div`,`visions-doc-head`),r=V(`h2`,`visions-doc-name`);if(r.textContent=e.name,r.title=e.uri,n.append(r,V(`span`,`visions-doc-count`,GW(e))),t.append(n),e.hand&&t.append(oK(e.hand)),e.findings.length>0){let n=V(`div`,`visions-findings`);for(let t of e.findings)n.append(cK(t));t.append(n)}if(e.comments.length>0){let n=V(`div`,`visions-comments`);for(let t of e.comments)n.append(sK(t));t.append(n)}return t}function oK(e){let t=V(`div`,`visions-hand`);return t.textContent=KW(e),t}function sK(e){let t=V(`div`,`visions-comment`),n=V(`div`,`visions-comment-head`);n.append(V(`span`,`visions-comment-chip`,`visions`)),n.append(V(`span`,`visions-comment-line`,sG(e))),t.append(n);let r=V(`p`,`visions-comment-message`);return r.textContent=e?.message==null?``:String(e.message),t.append(r),t}function cK(e){let t=V(`div`,`visions-finding`);t.append(V(`span`,`visions-finding-line`,RW(e)));let n=e?.code==null?``:String(e.code);n&&t.append(V(`span`,`visions-finding-code`,n));let r=V(`span`,`visions-finding-message`);return r.textContent=e?.message==null?``:String(e.message),t.append(r),t}function lK({force:e=!1}={}){if(!UG||!e&&$d(HG))return;UG.textContent=``;let t=mG(LG,RG,zG);if(t.length===0){let e=V(`p`,`visions-empty`,SW);if(KG===!1){let t=bW(`lanes-visions`,`visions-enabled`,`Enable Visions`);e.append(document.createTextNode(` `),t)}UG.append(e)}else for(let e of t)UG.append(aK(e))}function uK(e){KG=e?.visions?.enabled===!0,lK()}function dK(){let e=V(`section`,`visions-activity`),t=V(`div`,`visions-activity-head`);t.append(V(`h2`,`visions-activity-title`,`Activity`));let n=V(`span`,`visions-activity-count`);t.append(n),e.append(t);let r=V(`div`,`visions-activity-list`);e.append(r);let i=V(`p`,`visions-activity-overflow`);return e.append(i),YG={count:n,list:r,overflow:i},e}function fK(e,t){let n=V(`div`,`visions-activity-row`);n.append(V(`span`,`visions-activity-source`,EG(e.source))),n.append(V(`span`,`visions-activity-age`,DG(e.ts,t))),n.append(V(`span`,`visions-activity-scope`,IG(e)));let r=V(`span`,`visions-activity-summary`);return r.textContent=e.summary,n.append(r),n}function pK({force:e=!1}={}){if(!YG||!e&&$d(HG))return;let{count:t,list:n,overflow:r}=YG;if(t.textContent=FG(qG.length),n.textContent=``,qG.length===0){n.append(V(`p`,`visions-empty`,wG)),r.textContent=``;return}let i=Date.now();for(let e of qG)n.append(fK(e,i));r.textContent=jG(JG)}function mK(){let e=V(`section`,`visions-fixes`),t=V(`div`,`visions-fixes-head`);t.append(V(`h2`,`visions-fixes-title`,`Fixes`));let n=V(`span`,`visions-fixes-count`);t.append(n),e.append(t);let r=V(`div`,`visions-fixes-list`);return e.append(r),ZG={count:n,list:r},e}function hK(e){let t=V(`div`,`visions-fix-row`);t.dataset.applied=e.applied?`yes`:`no`;let n=V(`span`,`visions-fix-file`);n.textContent=VW(e.uri)||e.uri,n.title=e.uri,t.append(n),t.append(V(`span`,`visions-fix-line`,vG(e))),t.append(V(`span`,`visions-fix-outcome`,yG(e))),t.append(V(`span`,`visions-fix-code`,e.code||``));let r=V(`span`,`visions-fix-message`);return r.textContent=e.message,t.append(r),t}function gK({force:e=!1}={}){if(!ZG||!e&&$d(HG))return;let{count:t,list:n}=ZG;if(t.textContent=_G(XG.length),n.textContent=``,XG.length===0)n.append(V(`p`,`visions-empty`,gG));else for(let e of XG)n.append(hK(e))}function _K(){QG=aG(LG,RG,zG,XG,BG),QG.signature!==``&&eK.refresh(),GG&&GG(oG(QG,$G))}function vK(e){GG=e,_K()}function yK(e){if(HG)return HG;let t=V(`div`,`visions-content`);t.append(tK());let n=V(`div`,`visions-feed`);return t.append(n),t.append(mK()),t.append(dK()),e.appendChild(t),HG=t,UG=n,rK(),lK({force:!0}),gK({force:!0}),pK({force:!0}),t}function bK(){rK(),lK({force:!0}),gK({force:!0}),pK({force:!0})}function xK(){QG.signature!==``&&eK.acknowledge(),_K()}function SK(e){XG=SG(XG,e),gK(),_K()}function CK(e){LG=lG(LG,e),lK(),_K()}function wK(e){RG=dG(RG,e),lK(),_K()}function TK(e){zG=JW(zG,e),lK(),_K()}function EK(e){BG=jW(BG,e),rK(),_K()}function DK(e){qG=NG(qG,e),JG=AG(e),pK(),_K()}function OK(e){qG=PG(e),JG=0,pK(),_K()}function kK(e){LG=fG(e),RG=pG(e),zG=YW(e),BG=kW(e),XG=CG(e),rK(),lK(),gK(),_K()}var AK=is(D(),qo());j({glimmervoidId:D().min(1),event:D().min(1),token:D().nullable().optional(),payload:AK}),j({id:D().min(1),name:D().min(1),event:D().min(1),matcher:D().optional(),type:N([`command`,`http`]),command:D().optional(),url:D().optional(),timeout:O().int().positive().optional(),enabled:k(),projects:A(D()).optional()}).passthrough();var jK=`Claude Code hooks injected into every session Glimmervoid spawns.`,MK=`Loading hooks`,NK=`No hooks yet. A hook runs a command, or calls a URL, when a Claude Code event fires in a Glimmervoid session. Start from one of these, or add your own.`,PK=`Start from`,FK=`Filter by name, event or command`,IK=`Nothing matches that filter.`,LK=`Preview`,RK=`The entry this becomes in the per-session settings file.`,zK=`Duplicate`,BK=`Discard changes`,VK=`Close the editor and lose the unsaved changes?`,HK=`Esc cancels. Ctrl+Enter saves.`,UK=`A change reaches a session at its next start or restart. Claude Code sessions only; Codex and Grok sessions do not read this file.`,WK=`Glimmervoid's own hooks`,GK=`Always present, read-only. Status detection depends on them.`,KK=`Your hooks`,qK=`New hook`,JK=`Edit hook`,YK=`Saved to config.json.`,XK=`All projects`,ZK=`This event takes no matcher.`,QK=`Blank uses Claude Code's default for the event.`,$K=Object.freeze([{value:`command`,label:`Command`,hint:`Run a shell command. It receives the event JSON on stdin.`},{value:`http`,label:`HTTP`,hint:`POST the event JSON to a URL.`}]),eq=Object.freeze([{id:`lint`,label:`Lint after edits`,summary:`PostToolUse on Edit|Write`,draft:{name:`Lint after edits`,event:`PostToolUse`,matcher:`Edit|Write`,type:`command`,command:`npx biome check --write "$(jq -r .tool_input.file_path)"`}},{id:`notify`,label:`Notify on Stop`,summary:`Stop, command`,draft:{name:`Notify on Stop`,event:`Stop`,matcher:``,type:`command`,command:`command -v notify-send >/dev/null 2>&1 && notify-send "Claude finished a turn" || { command -v osascript >/dev/null 2>&1 && osascript -e 'display notification "Claude finished a turn" with title "Claude Code"'; }`}},{id:`guard`,label:`Guard destructive Bash`,summary:`PreToolUse on Bash, exit 2 blocks`,draft:{name:`Guard destructive Bash`,event:`PreToolUse`,matcher:`Bash`,type:`command`,command:`jq -r .tool_input.command | grep -Eq "rm -rf|git push --force" && exit 2 || exit 0`}},{id:`log`,label:`Log every prompt`,summary:`UserPromptSubmit, appends JSON`,draft:{name:`Log every prompt`,event:`UserPromptSubmit`,matcher:``,type:`command`,command:`cat >> ~/.claude/prompts.jsonl`}}]),tq=Object.freeze({hooks:[],builtin:[],events:[]});function nq(e){return!e||typeof e.error==`string`}function rq(e){return!e||typeof e.error!=`string`?``:e.error}function iq(e,t){let n=e?.[t];return Array.isArray(n)?n:tq[t]}var aq=e=>iq(e,`hooks`),oq=e=>iq(e,`builtin`),sq=e=>iq(e,`events`);function cq(e){let t=e?.limits?.maxTimeoutSec;return typeof t==`number`&&Number.isInteger(t)&&t>0?t:600}function lq(e,t){if(!e||typeof e!=`object`)return!1;let n=e.requestId;return typeof n!=`string`||!t||n===t}function uq(e){let t=aq(e),n=t.filter(e=>e.enabled!==!1).length;return[{label:`yours`,value:String(t.length),tone:null},{label:`enabled`,value:String(n),tone:t.length>0&&n===0?`warn`:null},{label:`built in`,value:String(oq(e).length),tone:null}]}function dq(e,t){let n=new Map(t.map((e,t)=>[e.name,t])),r=e=>n.get(e.event)??t.length;return[...e].sort((e,t)=>{let n=r(e)-r(t);return n===0?String(e.name).localeCompare(String(t.name)):n})}function fq(e,t){let n=String(t||``).trim().toLowerCase();return n?e.filter(e=>[e.name,e.event,e.matcher,e.command,e.url].some(e=>typeof e==`string`&&e.toLowerCase().includes(n))):e}function pq(e){return e.length>=4}function mq(e){let t=[];for(let n of e){let e=t[t.length-1];e&&e.event===n.event?e.hooks.push(n):t.push({event:n.event,hooks:[n]})}return t}function hq(e){let t=e.type===`http`?{type:`http`,url:e.url||``}:{type:`command`,command:e.command||``};Number.isInteger(e.timeout)&&Number(e.timeout)>0&&(t.timeout=e.timeout);let n=e.matcher?{matcher:e.matcher,hooks:[t]}:{hooks:[t]};return JSON.stringify({hooks:{[e.event]:[n]}},null,2)}function gq(e){return`${e} copy`}function _q(e,t){return e.find(e=>e.name===t)||null}function vq(e,t){let n=_q(e,t);return n?n.matcher?`Matches ${n.matcher}. Blank matches every ${n.name}.`:ZK:``}function yq(e){return e.type===`http`?e.url||``:e.command||``}function bq(e){let t=$K.find(t=>t.value===e);return t?t.label:String(e||``)}function xq(e){return!Number.isInteger(e.timeout)||Number(e.timeout)<=0?``:`${e.timeout}s timeout`}function Sq(e,t){let n=Array.isArray(e.projects)?e.projects:[];return n.length===0?XK:n.map(e=>{let n=t.find(t=>t.id===e);return n?n.name:e}).join(`, `)}function Cq(e){return e.matcher?`${e.event} / ${e.matcher}`:e.event}function wq(e){return Cq(e)}function Tq(e,t){let n=Array.isArray(e.projects)?e.projects:[],r=new Set(t.map(e=>e.id));return n.filter(e=>!r.has(e))}function Eq(e){let t=e[0];return{id:null,name:``,event:t?t.name:``,matcher:``,type:`command`,command:``,url:``,timeout:``,enabled:!0,projects:[]}}function Dq(e){return{id:e.id??null,name:e.name||``,event:e.event||``,matcher:e.matcher||``,type:e.type===`http`?`http`:`command`,command:e.command||``,url:e.url||``,timeout:Number.isInteger(e.timeout)?String(e.timeout):``,enabled:e.enabled!==!1,projects:Array.isArray(e.projects)?[...e.projects]:[]}}function Oq(e,t,n=600){if(!e.name.trim())return`Give the hook a name.`;let r=_q(t,e.event);if(!r)return`Pick an event.`;if(e.matcher.trim()&&!r.matcher)return`${r.name} takes no matcher.`;if(e.type===`http`&&r.http===!1)return`${r.name} does not support HTTP hooks.`;if(e.type===`command`&&!e.command.trim())return`Enter the command to run.`;if(e.type===`http`&&!/^https?:\/\/\S+$/i.test(e.url.trim()))return`Enter a URL starting with http:// or https://.`;if(e.timeout.trim()!==``){let t=Number(e.timeout);if(!Number.isInteger(t)||t<1||t>n)return`Timeout must be a whole number of seconds from 1 to ${n}.`}return null}function kq(e){let t={name:e.name.trim(),event:e.event,type:e.type,enabled:e.enabled!==!1};return e.id&&(t.id=e.id),e.matcher.trim()&&(t.matcher=e.matcher.trim()),e.type===`command`&&(t.command=e.command.trim()),e.type===`http`&&(t.url=e.url.trim()),e.timeout.trim()!==``&&(t.timeout=Number(e.timeout)),e.projects.length>0&&(t.projects=[...e.projects]),t}function Aq(e,t){let n={...Eq(t),...e.draft};return _q(t,n.event)||(n.event=Eq(t).event),n}function jq(e,t){return JSON.stringify(kq(e))!==JSON.stringify(t)}function Mq(e){return{...e,enabled:e.enabled===!1}}function Nq(e){return`Delete the hook "${e.name}"? Sessions already running keep it until they restart.`}var Pq=null,Fq=null,Iq=null,Lq=null,Rq=null,zq=null,Bq=null,Vq=null,Hq=!1,Uq=null,Wq=``,Gq=new Set,Kq=new Set,qq=!1,Jq=(e,t)=>Xd(`hooks`,e,t);function Yq(e,t,n){let r=V(`p`,e,t);return n&&(r.dataset.tone=n),r}function Xq(e,t,n,r){let i=V(`button`,e,t);return i.type=`button`,r&&i.setAttribute(`aria-label`,r),i.addEventListener(`click`,n),i}function Zq(e){if(!Iq)return null;let t=Md(`hooks`);return Iq({requestId:t,...e}),t}function Qq(e,t,n){let r=V(`label`,`hooks-field`);return r.append(V(`span`,`hooks-field-label`,e),t),n&&r.append(V(`span`,`hooks-field-hint`,n)),r}function $q(e,t,n){let r=V(`input`,`settings-view-input`);return r.type=`text`,r.value=e,r.autocomplete=`off`,r.spellcheck=!1,t&&(r.placeholder=t),r.addEventListener(`input`,()=>n(r.value)),r}function eJ(e,t){let n=V(`textarea`,`settings-view-input hooks-command`);return n.rows=3,n.value=e,n.spellcheck=!1,n.addEventListener(`input`,()=>t(n.value)),n}function tJ(e,t,n){let r=V(`select`,`settings-view-input hooks-select`);for(let n of t){let t=V(`option`,null,n.name);t.value=n.name,t.title=n.description,n.name===e.event&&(t.selected=!0),r.append(t)}return r.addEventListener(`change`,()=>n(r.value)),r}function nJ(e,t){let n=V(`div`,`hooks-type-row`);n.setAttribute(`role`,`radiogroup`);for(let r of $K){let i=V(`label`,`settings-view-toggle hooks-choice`),a=V(`input`,`settings-view-checkbox`);a.type=`radio`,a.name=`hooks-type`,a.value=r.value,a.checked=e.type===r.value,a.title=r.hint,a.addEventListener(`change`,()=>{a.checked&&t(r.value)}),i.append(a,V(`span`,null,r.label)),n.append(i)}return n}function rJ(e,t){let n=V(`div`,`hooks-projects`);if(t.length===0)return n.append(V(`span`,`hooks-field-hint`,XK)),n;let r=V(`label`,`settings-view-project-choice hooks-choice`),i=V(`input`,`settings-view-checkbox`);i.type=`checkbox`,i.checked=e.projects.length===0,r.append(i,V(`span`,null,XK)),n.append(r);let a=[];for(let r of t){let t=V(`label`,`settings-view-project-choice hooks-choice`),o=V(`input`,`settings-view-checkbox`);o.type=`checkbox`,o.value=r.id,o.checked=e.projects.includes(r.id),o.addEventListener(`change`,()=>{e.projects=a.filter(e=>e.checked).map(e=>e.value),i.checked=e.projects.length===0}),a.push(o),t.append(o,V(`span`,null,r.name)),r.agent!==`claude-code`&&(t.append(V(`span`,`hooks-choice-note`,r.agent)),t.title=`Not a Claude Code project: this hook will not reach its sessions.`),n.append(t)}return i.addEventListener(`change`,()=>{if(!i.checked)i.checked=e.projects.length===0;else{for(let e of a)e.checked=!1;e.projects=[]}}),n}function iJ(e){let t=V(`div`,`hooks-templates`);t.append(V(`span`,`hooks-templates-label`,PK));for(let n of eq){let r=Xq(`hooks-chip`,n.label,()=>sJ(null,Aq(n,e)));r.title=n.summary,t.append(r)}return t}function aJ(e){Vq&&(Vq.textContent=e||``,Vq.hidden=!e)}function oJ(e){let t=sq(Pq),n=Qd(Pq),r=Jq(e.id?JK:qK,YK);r.classList.add(`hooks-editor`);let i=V(`form`,`hooks-form`);i.addEventListener(`submit`,e=>{e.preventDefault(),uJ()}),i.addEventListener(`keydown`,e=>{e.key===`Escape`?(e.preventDefault(),lJ()):e.key===`Enter`&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),uJ())}),e.id||i.append(iJ(t));let a=V(`span`,`hooks-field-hint`,vq(t,e.event)),o=$q(e.matcher,``,t=>{e.matcher=t}),s=Qq(`Command`,eJ(e.command,t=>{e.command=t}),`Runs through the shell with the event JSON on stdin. Exit 2 blocks the action where the event allows it.`),c=Qq(`URL`,$q(e.url,`http://127.0.0.1:8080/hook`,t=>{e.url=t}),`Claude Code POSTs the event JSON to it.`),l=()=>{s.hidden=e.type!==`command`,c.hidden=e.type!==`http`};l();let u=Qq(`Matcher`,o,null);u.append(a);let d=()=>{let n=t.find(t=>t.name===e.event);a.textContent=vq(t,e.event),o.disabled=!!n&&!n.matcher,o.disabled&&(o.value=``,e.matcher=``)};d();let f=V(`input`,`settings-view-input hooks-timeout`);f.type=`number`,f.inputMode=`numeric`,f.min=`1`,f.max=String(cq(Pq)),f.value=e.timeout,f.addEventListener(`input`,()=>{e.timeout=f.value});let p=V(`label`,`settings-view-toggle hooks-choice`),m=V(`input`,`settings-view-checkbox`);m.type=`checkbox`,m.checked=e.enabled,m.addEventListener(`change`,()=>{e.enabled=m.checked}),p.append(m,V(`span`,null,`Enabled`)),i.append(Qq(`Name`,$q(e.name,`Lint after edits`,t=>{e.name=t}),null),Qq(`Event`,tJ(e,t,t=>{e.event=t,d()}),null),u,Qq(`Type`,nJ(e,t=>{e.type=t,l()}),null),s,c,Qq(`Timeout (seconds)`,f,QK),Qq(`Projects`,rJ(e,n),null),Qq(``,p,null)),Vq=V(`p`,`hooks-editor-error`),Vq.setAttribute(`role`,`alert`),Vq.hidden=!0;let h=V(`div`,`hooks-editor-footer`),g=V(`span`,`hooks-editor-shortcut`,HK),_=Xq(`btn-dialog btn-dialog-cancel`,`Cancel`,lJ),v=V(`button`,`btn-dialog btn-dialog-confirm`,e.id?`Save changes`:`Add hook`);return v.type=`submit`,h.append(Vq,g,_,v),i.append(h),r.append(i),r}function sJ(e,t=null){Rq=t||(e?Dq(e):Eq(sq(Pq))),zq=kq(e?Dq(e):Eq(sq(Pq))),Bq=oJ(Rq),xJ({force:!0}),Bq.scrollIntoView({block:`nearest`});let n=Bq.querySelector(`input[type=text]`);n instanceof HTMLInputElement&&n.focus()}function cJ(){Rq=null,zq=null,Bq=null,Vq=null,Hq=!1,Uq=null,qq=!0,xJ({force:!0})}function lJ(){!Rq||!zq||!jq(Rq,zq)?cJ():kf({title:BK,message:VK,confirmLabel:`Discard`,danger:!0,onConfirm:cJ})}function uJ(){if(!Rq||Hq)return;let e=Oq(Rq,sq(Pq),cq(Pq));e?aJ(e):(Hq=!0,aJ(``),Uq=Zq({type:`save-hook`,hook:kq(Rq)}),Uq||(Hq=!1))}function dJ(e){let t=V(`details`,`hooks-preview`);t.open=Gq.has(e.id),t.addEventListener(`toggle`,()=>{t.open?Gq.add(e.id):Gq.delete(e.id)});let n=V(`summary`,`hooks-preview-summary`,LK);n.title=RK;let r=V(`pre`,`hooks-preview-code`,hq(e));return t.append(n,r),t}function fJ(e,{grouped:t=!1}={}){let n=Qd(Pq),r=V(`article`,`hooks-row`);r.setAttribute(`aria-label`,e.name),e.enabled===!1&&(r.dataset.state=`off`);let i=V(`div`,`hooks-row-main`),a=V(`div`,`hooks-row-head`);a.append(V(`span`,`hooks-row-name`,e.name));let o=t?e.matcher||``:Cq(e);o&&a.append(V(`span`,`hooks-row-event`,o));let s=V(`code`,`hooks-row-target`,yq(e));s.title=yq(e);let c=V(`p`,`hooks-row-meta`,[bq(e.type),xq(e),Sq(e,n)].filter(Boolean).join(` / `));i.append(a,s,c);let l=Tq(e,n);l.length>0&&i.append(Yq(`hooks-row-meta`,`Scoped to a project no longer in config: ${l.join(`, `)}`,`warn`)),i.append(dJ(e));let u=V(`div`,`hooks-row-actions`),d=V(`label`,`settings-view-toggle hooks-choice`),f=V(`input`,`settings-view-checkbox`);f.type=`checkbox`,f.checked=e.enabled!==!1,f.disabled=Kq.has(e.id),f.setAttribute(`aria-label`,`${e.name} enabled`),f.addEventListener(`change`,()=>{Kq.add(e.id),f.disabled=!0,Zq({type:`save-hook`,hook:Mq(e)})}),d.append(f,V(`span`,null,`On`));let p=Xq(`hooks-btn`,`Edit`,()=>sJ(e),`Edit ${e.name}`),m=Xq(`hooks-btn`,zK,()=>{let t=Dq({...e,name:gq(e.name)});t.id=null,sJ(null,t)},`Duplicate ${e.name}`),h=Xq(`hooks-btn hooks-btn-danger`,`Delete`,()=>{kf({title:`Delete hook`,message:Nq(e),confirmLabel:`Delete`,danger:!0,onConfirm:()=>{Kq.add(e.id),Zq({type:`delete-hook`,id:e.id}),xJ({force:!0})}})},`Delete ${e.name}`);return h.disabled=Kq.has(e.id),u.append(d,p,m,h),r.append(i,u),r}function pJ(e){let t=V(`article`,`hooks-row hooks-row-builtin`),n=V(`div`,`hooks-row-main`);return n.append(V(`span`,`hooks-row-event`,wq(e)),V(`p`,`hooks-row-meta`,e.purpose)),t.append(n),t}function mJ(){let e=Jq(`Hooks`,jK),t=V(`div`,`hooks-stats`);for(let e of uq(Pq))t.append(Zd(`hooks`,e.label,e.value,e.tone));return e.append(t,Yq(`hooks-meta`,UK)),e}function hJ(){let e=V(`input`,`settings-view-input hooks-filter`);return e.type=`search`,e.value=Wq,e.placeholder=FK,e.setAttribute(`aria-label`,FK),e.addEventListener(`input`,()=>{Wq=e.value;let t=Fq?.querySelector(`.hooks-list-yours`);t&&t.replaceWith(_J())}),e}function gJ(){let e=V(`div`,`hooks-empty-state`);return e.append(Yq(`hooks-empty`,NK),iJ(sq(Pq))),e}function _J(){let e=V(`div`,`hooks-list-yours`),t=aq(Pq);if(t.length===0)return e.append(gJ()),e;let n=fq(dq(t,sq(Pq)),Wq);if(n.length===0)return e.append(Yq(`hooks-empty`,IK)),e;for(let t of mq(n)){let n=V(`div`,`hooks-group`);n.append(V(`h3`,`hooks-group-title`,t.event));let r=V(`div`,`hooks-list`);for(let e of t.hooks)r.append(fJ(e,{grouped:!0}));n.append(r),e.append(n)}return e}function vJ(){let e=Jq(KK,null),t=Xq(`hooks-btn hooks-btn-add`,`+ New hook`,()=>sJ(null));t.disabled=!!Rq;let n=e.querySelector(`.hooks-section-head`);return n&&n.append(t),pq(aq(Pq))&&e.append(hJ()),e.append(_J()),e}function yJ(){let e=V(`details`,`hooks-builtin`),t=V(`summary`,`hooks-builtin-summary`);t.append(V(`span`,`hooks-section-title`,`${WK} (${oq(Pq).length})`),V(`span`,`hooks-section-hint`,GK));let n=V(`div`,`hooks-list`);for(let e of oq(Pq))n.append(pJ(e));return e.append(t,n),e}function bJ(){let e=V(`div`,`hooks-content`);return Pq?nq(Pq)?(e.append(Yq(`hooks-warning`,rq(Pq))),e):(e.append(mJ()),Bq&&e.append(Bq),e.append(vJ(),yJ()),e):(e.append(Yq(`hooks-empty`,MK)),e)}function xJ({force:e=!1}={}){if(!Fq||!e&&$d(Fq)||(Fq.replaceChildren(bJ()),!qq))return;qq=!1;let t=Fq.querySelector(`.hooks-btn-add`);t instanceof HTMLButtonElement&&t.focus()}function SJ(e){Iq=e}function CJ(){Iq&&(Lq=Md(`hooks-report`),Iq({type:`request-hooks-report`,requestId:Lq}))}function wJ(e){Fq||(Fq=V(`div`,`hooks-panel`),e.append(Fq),xJ({force:!0}))}function TJ(){xJ({force:!0})}function EJ(e){lq(e,Lq)&&(Pq=e,Kq.clear(),Hq=!1,xJ())}function DJ(e){let t=Uq!==null&&e.requestId===Uq;if(t&&(Uq=null,Hq=!1),e.ok){t&&cJ(),CJ();return}let n=typeof e.error==`string`&&e.error?e.error:`Could not save the hook`;t?aJ(n):(rS(n,{persist:!0}),CJ())}function OJ(e){e.ok||rS(typeof e.error==`string`&&e.error?e.error:`Could not delete the hook`,{persist:!0}),CJ()}function kJ(e,t,n){return{body:String(n||`Session needs attention`),tag:`glimmervoid-${e||``}-${t||``}`,renotify:!0,silent:!0}}var AJ=4e3;function jJ(e,t){return`glimmervoid-notify-claim-${e||``}-${t||``}`}function MJ(e,t,n,r=AJ){try{let i=e.getItem(t);if(i){let e=Number(i);if(Number.isFinite(e)&&n-e<r)return!1}return e.setItem(t,String(n)),!0}catch{return!0}}function NJ(){return typeof Notification>`u`?null:Notification}function PJ(){return NJ()!==null}function FJ(){let e=NJ();return e?e.permission:`unavailable`}async function IJ(){let e=NJ();if(!e)return`denied`;if(e.permission!=="default")return e.permission;try{return await e.requestPermission()}catch{return e.permission}}function LJ(){let e=NJ();e&&DD()&&e.permission==="default"&&IJ()}function RJ({session:e,category:t,message:n,kind:r,ignoreFocus:i=!1}={}){let a=NJ();if(a&&DD()&&a.permission===`granted`&&(i||typeof document>`u`||typeof document.hasFocus!=`function`||!document.hasFocus())&&MJ(window.localStorage,jJ(e,t),Date.now()))try{let i=new a(`Glimmervoid`,kJ(e,t,n));i.onclick=()=>{window.focus(),r===`plan`&&typeof e==`string`&&(window.location.hash=JL(e)),i.close()}}catch{}}function zJ(e){return e.filter(e=>!e.hasOwnPhoneScreen).map(e=>{let t=e.label.trim();return{id:e.view,label:t,glyph:e.glyph||t.charAt(0).toUpperCase(),el:e.el}})}var BJ=[{name:`glimmervoid`,state:F.RUNNING,awaitingBackgroundTasks:!1},{name:`glimmervoid (2)`,state:F.RUNNING,awaitingBackgroundTasks:!0},{name:`api`,state:F.WAITING,awaitingBackgroundTasks:!1},{name:`docs-site`,state:F.IDLE,awaitingBackgroundTasks:!1}];function VJ(){let e=V(`div`,`compact-status-preview`);e.setAttribute(`role`,`img`),e.setAttribute(`aria-label`,`Example sidebar sessions showing how status appears with this setting`);for(let t of BJ){let{pill:n,refs:r}=dU(`div`,`focus-pill compact-status-preview-pill`);r.name.textContent=t.name,fU(n,r,t.state,t.awaitingBackgroundTasks),e.append(n)}return e}var HJ=null,UJ=null,WJ=null,GJ=null,KJ=-1,qJ=null,JJ=1;function YJ(){if(!HJ||qJ===null)return;let e=oD({viewportWidthPx:document.documentElement.clientWidth,viewportHeightPx:document.documentElement.clientHeight,verticalProgress:qJ});Vd(HJ,sD(e,JJ))}function XJ(){GJ!==null&&(clearTimeout(GJ),GJ=null)}function ZJ(e=FD()){return QE({isEnabled:e,hasReducedMotion:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,isPhone:vf(),options:wO()})}function QJ(e,t){if(!HJ||!UJ||!WJ||ZJ())return;let n=wO();XJ();let r=ZE(n,KJ,Math.random,t);if(HJ.onanimationend=null,HJ.style.animation=`none`,!r){GJ=setTimeout(()=>QJ(!1),1e3);return}qJ=r.verticalProgress,JJ=n.flyingAnimalsScale,YJ();let i=WE[r.animalIndex];UJ.className=`nyan-sprite ${i.sprite}`,WJ.className=`nyan-trail ${i.trail}`,KJ=r.animalIndex,HJ.offsetWidth,HJ.style.animation=`nyan-fly ${r.durationSeconds}s linear`,e&&(HJ.style.animationDelay=`-${r.firstDelaySeconds}s`),HJ.onanimationend=e=>{HJ&&e.target===HJ&&(HJ.onanimationend=null,HJ.style.animation=`none`,GJ=setTimeout(()=>QJ(!1),r.gapMs))}}function $J(){HJ||ZJ()||(HJ=document.createElement(`div`),HJ.className=`nyan-flight`,HJ.setAttribute(`aria-hidden`,`true`),WJ=document.createElement(`div`),UJ=document.createElement(`div`),HJ.append(WJ,UJ),document.body.appendChild(HJ),window.addEventListener(`resize`,YJ),window.addEventListener(`orientationchange`,YJ),QJ(!0))}function eY(e){$J(),QJ(!1,e)}function tY(){XJ(),window.removeEventListener(`resize`,YJ),window.removeEventListener(`orientationchange`,YJ),HJ?.remove(),HJ=null,UJ=null,WJ=null,KJ=-1,qJ=null}var nY=!1;function rY(e){let t=document.documentElement;if(nY||(nY=!0,yf(()=>rY(FD())),window.matchMedia(`(prefers-reduced-motion: reduce)`).addEventListener(`change`,()=>rY(FD()))),e){if(t.dataset.flyingAnimals=`true`,ZJ(e)){tY();return}$J()}else delete t.dataset.flyingAnimals,tY()}function iY(){let e=V(`div`),t=V(`p`,`flying-animals-status`);t.id=`flying-animals-gallery-status`,t.setAttribute(`role`,`status`);let n=V(`div`,`flying-animals-gallery`);n.setAttribute(`aria-label`,`Animal gallery`);let r=[],i=()=>{let e=ZJ(),n=YE(wO().flyingAnimalsExcludedSprites);t.textContent=[e,n?``:`No animals are included, so automatic flights are paused.`].filter(Boolean).join(` `);for(let t of r)t.disabled=e!==null},a=wO();for(let e of WE){let o=V(`article`,`flying-animal-tile`),s=OO(e),c=V(`label`,`flying-animal-include`),l=V(`input`,`settings-view-checkbox`);l.type=`checkbox`,l.checked=!a.flyingAnimalsExcludedSprites.includes(e.sprite),l.setAttribute(`aria-label`,`Include ${e.name}`),l.addEventListener(`change`,()=>{let t=new Set(wO().flyingAnimalsExcludedSprites);l.checked&&t.delete(e.sprite),l.checked||t.add(e.sprite),CO([...t]),rY(FD()),i()}),c.append(l,document.createTextNode(`Include`));let u=V(`button`,`btn-dialog btn-dialog-cancel`,`Fly now`);u.type=`button`,u.setAttribute(`aria-describedby`,t.id),u.addEventListener(`click`,()=>eY(e.sprite)),r.push(u),o.append(s,V(`h2`,`flying-animal-name`,e.name),c,u),n.append(o)}return i(),e.append(t,n),e}var aY=`johncwaters/glimmervoid`,oY=Object.freeze([`opened`,`checks-failed`,`review-requested`,`approved`,`commented`,`merged`]),sY=Object.freeze([`notify`,`spawn`,`label`,`comment`]),cY=2e4,lY=65536,uY=50,dY=/^[a-z0-9][a-z0-9-]{0,63}$/,fY=/[\x00-\x1f\x7f,]|^-/,pY=(e,t)=>{let n=`${e} must be an integer between ${t.min} and ${t.max}`;return O({error:n}).int({error:n}).min(t.min,{error:n}).max(t.max,{error:n})},mY=k({error:`workflows.enabled must be a boolean`}),hY=pY(`workflows.maxConcurrentSessions`,VE),gY=pY(`workflows.maxActionsPerPoll`,HE),_Y=(e,t)=>A(t,{error:`${e} must be an array`}).min(1,{error:`${e} must list at least one entry when present`}),vY=D({error:`a workflow label name must be a string`}).trim().min(1,{error:`a workflow label name must not be empty`}).max(uY,{error:`a workflow label name must be at most ${uY} characters`}).refine(e=>!fY.test(e),{error:`a workflow label name must not start with a dash or hold a comma or control character`}),yY=D({error:`a workflow comment body must be a string`}).min(1,{error:`a workflow comment body must not be empty`}).max(lY,{error:`a workflow comment body must be at most ${lY} characters`}).refine(e=>e.trim().length>0,{error:`a workflow comment body must not be blank`}),bY=N(oY,{error:`workflows.rules[].trigger must be one of ${oY.join(`, `)}`}),xY=ns(`type`,[M({type:P(`notify`)}),M({type:P(`spawn`),promptTemplate:D({error:`a spawn action needs a promptTemplate string`}).min(1,{error:`a spawn action promptTemplate must not be empty`}).max(cY,{error:`a spawn action promptTemplate must be at most ${cY} characters`}).refine(e=>e.trim().length>0,{error:`a spawn action promptTemplate must not be blank`})}),M({type:P(`label`),name:vY}),M({type:P(`comment`),body:yY})],{error:`workflows.rules[].actions[].type must be one of ${sY.join(`, `)}`}),SY=M({mine:k({error:`workflows.rules[].filters.mine must be a boolean`}).optional(),teamReviewRequested:k({error:`workflows.rules[].filters.teamReviewRequested must be a boolean`}).optional(),authors:_Y(`workflows.rules[].filters.authors`,D({error:`workflows.rules[].filters.authors must hold GitHub logins`}).regex(Ds,{error:`workflows.rules[].filters.authors must hold GitHub logins`})).optional(),labels:_Y(`workflows.rules[].filters.labels`,vY).optional(),baseBranches:_Y(`workflows.rules[].filters.baseBranches`,D({error:`workflows.rules[].filters.baseBranches must hold branch names`}).min(1,{error:`workflows.rules[].filters.baseBranches must hold branch names`})).optional()},{error:`workflows.rules[].filters must be an object`}),CY=D({error:`workflows.rules[].id must be a string`}).regex(dY,{error:`workflows.rules[].id must be 1 to 64 lowercase letters, digits and dashes, starting with a letter or digit`}),wY=k({error:`workflows.rules[].enabled must be a boolean`}),TY=M({id:CY,name:D({error:`workflows.rules[].name must be a string`}).trim().min(1,{error:`workflows.rules[].name must not be empty`}).max(80,{error:`workflows.rules[].name must be at most 80 characters`}),enabled:wY.default(!1),repos:_Y(`workflows.rules[].repos`,Ul),filters:SY.default({}),trigger:bY,actions:_Y(`workflows.rules[].actions`,xY)},{error:`workflows.rules[] must be an object`}),EY=M({enabled:mY.default(!0),maxConcurrentSessions:hY.default(2),maxActionsPerPoll:gY.default(20),rules:A(TY,{error:`workflows.rules must be an array`}).default([])},{error:`workflows must be an object`}).superRefine((e,t)=>{let n=new Set;for(let[r,i]of e.rules.entries())n.has(i.id)?t.addIssue({code:`custom`,path:[`rules`,r,`id`],message:`workflows.rules[${r}].id "${i.id}" is declared more than once`}):n.add(i.id)}),DY=M({id:CY,enabled:wY},{error:`a dashboard update of workflows.rules[] carries only id and enabled`});M({enabled:mY.optional(),maxConcurrentSessions:hY.optional(),maxActionsPerPoll:gY.optional(),rules:A(DY,{error:`workflows.rules must be an array`}).optional()},{error:`a dashboard update of workflows carries only enabled, maxConcurrentSessions, maxActionsPerPoll and rule toggles`});var OY=O().int().nonnegative(),kY=N([`SUCCESS`,`FAILURE`,`PENDING`,`ERROR`,`EXPECTED`]).nullable();fu.extend({author:j({login:D()}).nullable(),labels:j({nodes:A(j({name:D()}))}),comments:j({totalCount:OY})});var AY=M({polledAtMs:OY,prs:A(M({repo:Ul,number:O().int().positive(),title:D(),url:wo(),author:D().nullable(),state:N([`OPEN`,`MERGED`,`CLOSED`]),createdAt:D(),mergedAt:D().nullable(),isDraft:k(),isCrossRepository:k(),baseRefName:D(),headRefName:D().min(1),headRefOid:I,labels:A(D()),commentCount:OY,reviewRequests:A(D()),checksState:kY,reviewDecision:N([`APPROVED`,`CHANGES_REQUESTED`,`REVIEW_REQUIRED`]).nullable()}))});M({repos:is(D().regex(/^[a-z0-9][a-z0-9._-]*\/[a-z0-9][a-z0-9._-]*$/),AY)});var jY={maxConcurrentInvestigations:Math.ceil,minUsersToInvestigate:Math.ceil,userEscalationThreshold:Math.ceil,trafficSpikeMinUsers:Math.ceil,trafficSpikeBaselineDays:Math.floor};[...Object.entries(jY).map(([e,t])=>({path:[`posthog`,e],min:1,round:t}))];var MY=Object.freeze([`auto`,`calculate`,`display`]),NY=Object.freeze([`codex`,`grok`]),PY=Object.freeze([`dailyUsd`,`monthlyUsd`]),FY=e=>k({error:`${e} must be a boolean`}).optional(),IY=(e,t=!1)=>{let n=D({error:`${e} must be a string`});return(t?n.transform(e=>e.trim()):n).optional()},LY=e=>e.label?e.label:e.max==null?e.exclusiveMin?`greater than ${e.min}`:`at least ${e.min}`:`between ${e.min} and ${e.max}`,RY=(e,t=cE)=>O({error:`${e} must be ${LY(t)}`}).finite().refine(e=>!t.exclusiveMin||e>t.min,{message:`${e} must be ${LY(t)}`}).refine(e=>t.exclusiveMin||e>=t.min,{message:`${e} must be ${LY(t)}`}).refine(e=>t.max==null||e<=t.max,{message:`${e} must be ${LY(t)}`}).optional(),zY=(e,t)=>RY(e,t).unwrap().int({error:`${e} must be a whole number ${LY(t)}`}).optional(),BY=(e,t)=>O({error:`${e} must be an integer between ${t.min} and ${t.max}`}).int({error:`${e} must be an integer between ${t.min} and ${t.max}`}).min(t.min,{error:`${e} must be an integer between ${t.min} and ${t.max}`}).max(t.max,{error:`${e} must be an integer between ${t.min} and ${t.max}`}).optional(),VY=(e,t)=>j(t,{error:`${e} must be an object`}).nullable().optional(),HY=Object.freeze([`claude`,`codex`]),UY=Object.freeze([`release`,`main`]),WY=Object.freeze([`report`,`fix`]);VY(`changeMap`,{narrator:VY(`changeMap.narrator`,{enabled:FY(`changeMap.narrator.enabled`),engine:N(HY,{error:`changeMap.narrator.engine must be one of ${HY.join(`, `)}`}).optional(),model:IY(`changeMap.narrator.model`,!0),timeoutSeconds:BY(`changeMap.narrator.timeoutSeconds`,zE)})}),j({refiner:j({enabled:FY(`taskTitle.refiner.enabled`),model:IY(`taskTitle.refiner.model`,!0),minIntervalSeconds:RY(`taskTitle.refiner.minIntervalSeconds`,{min:0}),timeoutSeconds:RY(`taskTitle.refiner.timeoutSeconds`,{min:0,exclusiveMin:!0,max:2147483647/1e3})},{error:`taskTitle.refiner must be an object`}).nullable().optional()},{error:`taskTitle must be an object`}).nullable().optional();var GY={enabled:FY(`branchGc.enabled`),worktrees:FY(`branchGc.worktrees`),prefixes:A(D({error:`branchGc.prefixes must be an array of strings`}).min(1,{error:`branchGc.prefixes entries must be non-empty strings`}),{error:`branchGc.prefixes must be an array of strings`}).optional(),dryRun:FY(`branchGc.dryRun`),staleDays:RY(`branchGc.staleDays`,mE),deleteUnmerged:FY(`branchGc.deleteUnmerged`),intervalMs:RY(`branchGc.intervalMs`,hE)},KY=j(GY,{error:`branchGc must be an object`});VY(`branchGc`,GY),KY.omit({prefixes:!0,dryRun:!0,worktrees:!0}).nullable().optional(),Object.freeze([`enabled`,`deleteUnmerged`]),Object.freeze([`staleDays`,`intervalMs`]),VY(`postTurnChecks`,{mode:N(WY,{error:`postTurnChecks.mode must be one of report, fix`}).optional()}),VY(`visions`,{enabled:FY(`visions.enabled`),autoFix:FY(`visions.autoFix`),projects:A(D({error:`visions.projects must be an array of strings`}),{error:`visions.projects must be an array of strings`}).optional(),dispatch:VY(`visions.dispatch`,{enabled:FY(`visions.dispatch.enabled`),model:IY(`visions.dispatch.model`,!0),quietMs:zY(`visions.dispatch.quietMs`,gE),cooldownMs:zY(`visions.dispatch.cooldownMs`,_E),maxPerHour:zY(`visions.dispatch.maxPerHour`,vE),activityMaxPerHour:zY(`visions.dispatch.activityMaxPerHour`,yE),dispatchTimeoutSeconds:zY(`visions.dispatch.dispatchTimeoutSeconds`,bE)}),intent:VY(`visions.intent`,{threadTtlMs:zY(`visions.intent.threadTtlMs`,xE)})}),j({teams:A(D({error:`github.teams must be an array of org/slug strings`}).refine(e=>As(e)!==null,{message:`github.teams entries must be org/slug with valid GitHub segments`}),{error:`github.teams must be an array of org/slug strings`}).optional()},{error:`github must be an object`}).nullable().optional(),VY(`teamReview`,{enabled:FY(`teamReview.enabled`),autoRebaseMyPrs:FY(`teamReview.autoRebaseMyPrs`),keepMergeableEnabled:FY(`teamReview.keepMergeableEnabled`),mergeQueueEnabled:FY(`teamReview.mergeQueueEnabled`),keepMergeableTimeoutMinutes:BY(`teamReview.keepMergeableTimeoutMinutes`,BE),org:IY(`teamReview.org`,!0),team:IY(`teamReview.team`,!0),skill:IY(`teamReview.skill`,!0),reReviewAfterHours:RY(`teamReview.reReviewAfterHours`),skipIdleAfterDays:RY(`teamReview.skipIdleAfterDays`)}),VY(`benchmarks`,{enabled:FY(`benchmarks.enabled`)}),j({enabled:FY(`factory.enabled`),maxRisk:mc.optional(),maxLiveWorkers:O().int().min(sE.min).optional(),checks:A(D().trim().min(1)).optional(),protectedPaths:A(D().trim().min(1)).optional(),reviewerModel:D().trim().min(1).nullable().optional(),dailyBudgetUsd:O().finite().nonnegative().nullable().optional(),verifierModel:D().trim().min(1).nullable().optional(),mirrorHarnessRuns:FY(`factory.mirrorHarnessRuns`)}).nullable().optional(),VY(`knowledgeGraph`,{enabled:FY(`knowledgeGraph.enabled`)});var qY={intervalMinutes:SE,maxConcurrentInvestigations:CE,investigationTimeoutSeconds:wE,fixTimeoutSeconds:kE,minUsersToInvestigate:TE,userEscalationThreshold:EE,recurrenceWindowDays:DE,transientRecurrenceLimit:OE,trafficSpikeMultiplier:AE,trafficSpikeMinUsers:jE,trafficSpikeCooldownMinutes:ME,trafficSpikeBaselineDays:NE};VY(`posthog`,{enabled:FY(`posthog.enabled`),recurrenceDedupe:FY(`posthog.recurrenceDedupe`),trafficSpikeEnabled:FY(`posthog.trafficSpikeEnabled`),autoFix:FY(`posthog.autoFix`),host:IY(`posthog.host`,!0).refine(e=>e==null||!e||/^https?:\/\//i.test(e),{message:`posthog.host must be an http(s) URL`}),apiKey:IY(`posthog.apiKey`,!0),repoPath:IY(`posthog.repoPath`,!0),projects:es([P(`all`),A(O({error:`posthog.projects must be "all" or an array of positive integer project ids`}).int({error:`posthog.projects must be "all" or an array of positive integer project ids`}).positive({error:`posthog.projects must be "all" or an array of positive integer project ids`}),{error:`posthog.projects must be "all" or an array of positive integer project ids`})],{error:`posthog.projects must be "all" or an array of positive integer project ids`}).optional(),projectMap:is(D(),qo(),{error:`posthog.projectMap must be an object`}).optional(),...Object.fromEntries(Object.entries(qY).map(([e,t])=>[e,Object.hasOwn(jY,e)?zY(`posthog.${e}`,t):RY(`posthog.${e}`,t)]))}),`${MY.join(`, `)}`,Object.fromEntries(NY.map(e=>[e,FY(`usage.vendors.${e}`)])),Object.fromEntries(PY.map(e=>[e,O({error:`usage.budget.${e} must be a positive number or null`}).positive({error:`usage.budget.${e} must be a positive number or null`}).nullable().optional()])),VY(`telegram`,{botToken:IY(`telegram.botToken`,!0),chatId:IY(`telegram.chatId`,!0)}),j({enabled:FY(`ingest.enabled`)},{error:`ingest must be an object`}).passthrough().optional(),j({enabled:FY(`trace.enabled`)},{error:`trace must be an object`}).optional(),j({enabled:FY(`planReview.enabled`)},{error:`planReview must be an object`}).optional();var JY=e=>A(D({error:`${e} must be an array of paths`}).trim().min(1,{error:`${e} must be an array of paths`}),{error:`${e} must be an array of paths`}).optional();j({unguardedRepos:JY(`guardrails.unguardedRepos`),blockedPaths:JY(`guardrails.blockedPaths`),unreadablePaths:JY(`guardrails.unreadablePaths`)},{error:`guardrails must be an object`}).passthrough().optional();var YY={enabled:FY(`telemetry.enabled`)};j(YY,{error:`telemetry must be an object`}).strict().optional(),j(YY,{error:`telemetry must be an object`}).passthrough().optional();function XY(e){return e.map(e=>({value:e,label:e[0].toUpperCase()+e.slice(1)}))}var ZY=Object.freeze({general:`machine-general`,updates:`machine-updates`,terminal:`machine-terminal`,repos:`machine-repositories`,repositories:`machine-repositories`,advanced:`machine-detection-sessions`,detection:`machine-detection-sessions`,telegram:`machine-telegram`,notifications:`machine-telegram`,"change-map":`lanes-change-map`,visions:`lanes-visions`,ingest:`lanes-ingest`,posthog:`lanes-posthog`,"team-review":`lanes-team-review`,reviews:`lanes-team-review`,benchmarks:`lanes-benchmarks`,factory:`lanes-factory`,"knowledge-graph":`lanes-knowledge-graph`,workflows:`lanes-workflows`,usage:`machine-usage`,privacy:`machine-privacy`,telemetry:`machine-privacy`,shortcuts:`browser-shortcuts`,animals:`browser-flying-animals`,"flying-animals":`browser-flying-animals`,unattended:`lanes-unattended`}),QY=Object.freeze({"browser-appearance":Object.freeze({"flying-animals":`browser-flying-animals`})}),$Y=Object.freeze([{id:`browser-appearance`,level:`browser`,title:`Appearance and alerts`,description:`Preferences stored only in this browser.`,settings:[{id:`theme`,path:`pref:themeId`,title:`Theme`,description:`Color scheme for the dashboard.`,control:`select`,optionsFrom:`themes`,keywords:[`color`,`palette`],defaultValue:`phyrexian`},{id:`compact-status`,path:`pref:compactStatusLabels`,title:`Hide status words in sidebar`,description:`Hide status words in the sidebar and on the phone Board while keeping the colored status mark and the phone Plan ready badge. Saved per browser, so turn it on in each one.`,control:`toggle`,keywords:[`sidebar`,`status`,`compact`],defaultValue:!1},{id:`session-usage-chips`,path:`pref:sessionUsageChips`,title:`Show usage on session cards`,description:`Shows each card's transcript token count and CLI-reported cost when available, otherwise a calculated API list-price estimate.`,control:`toggle`,keywords:[`usage`,`cost`,`tokens`,`card`,`price`],defaultValue:!1},{id:`alert-sounds-enabled`,path:`pref:soundEnabled`,title:`Alert sounds`,description:`Play sounds when a session needs attention and when a merge celebration plays. The same switch as the note button in the desktop header.`,control:`toggle`,keywords:[`audio`,`mute`,`sound`,`notification`],defaultValue:!0},{id:`alert-sound`,path:`pref:soundId`,title:`Alert sound`,description:`Sound played when a session needs attention. Your own .ogg, .mp3, .wav, .m4a or .webm files dropped into the sounds folder of the Glimmervoid home (~/.glimmervoid/sounds/, or $GLIMMERVOID_HOME/sounds/) are listed after the built-in sounds. Glimmervoid never creates that folder, so make it yourself; new files show up the next time Settings opens.`,control:`select`,optionsFrom:`sounds`,keywords:[`audio`,`notification`,`custom`],defaultValue:`chime`},{id:`desktop-notifications`,path:`pref:notificationsEnabled`,title:`Desktop notifications`,description:`Raise a browser notification when a session needs attention while this dashboard is in the background.`,control:`toggle`,keywords:[`browser`,`attention`],defaultValue:!0}]},{id:`browser-flying-animals`,level:`browser`,title:`Flying animals`,description:`Choose your flying animals. Changes apply immediately in this browser.`,settings:[{id:`flying-animals`,path:`pref:flyingAnimalsEnabled`,title:`Flying animals`,description:`Show animated animals flying across the dashboard.`,control:`toggle`,keywords:[`animation`,`motion`],defaultValue:!1},{id:`animals-min-gap`,path:`pref:flyingAnimalsMinGapSeconds`,title:`Time between flights: minimum (seconds)`,description:`Shortest pause between flights.`,control:`number`,advanced:!0,commitOnChange:!0,integer:!1,step:.1,range:`FLYING_ANIMALS_GAP_RANGE`,maximumSettingId:`animals-max-gap`,keywords:[`animals`,`frequency`],defaultValue:GE.flyingAnimalsMinGapSeconds},{id:`animals-max-gap`,path:`pref:flyingAnimalsMaxGapSeconds`,title:`Time between flights: maximum (seconds)`,description:`Longest pause between flights.`,control:`number`,advanced:!0,commitOnChange:!0,integer:!1,step:.1,range:`FLYING_ANIMALS_GAP_RANGE`,keywords:[`animals`,`frequency`],defaultValue:GE.flyingAnimalsMaxGapSeconds},{id:`animals-min-duration`,path:`pref:flyingAnimalsMinDurationSeconds`,title:`Flight duration: minimum (seconds)`,description:`Shortest flight, for faster animals.`,control:`number`,advanced:!0,commitOnChange:!0,integer:!1,step:.1,range:`FLYING_ANIMALS_DURATION_RANGE`,maximumSettingId:`animals-max-duration`,keywords:[`animals`,`speed`],defaultValue:GE.flyingAnimalsMinDurationSeconds},{id:`animals-max-duration`,path:`pref:flyingAnimalsMaxDurationSeconds`,title:`Flight duration: maximum (seconds)`,description:`Longest flight, for slower animals.`,control:`number`,advanced:!0,commitOnChange:!0,integer:!1,step:.1,range:`FLYING_ANIMALS_DURATION_RANGE`,keywords:[`animals`,`speed`],defaultValue:GE.flyingAnimalsMaxDurationSeconds},{id:`animals-scale`,path:`pref:flyingAnimalsScale`,title:`Size multiplier`,description:`Scale applied on top of the viewport size.`,control:`number`,advanced:!0,commitOnChange:!0,integer:!1,step:.1,range:`FLYING_ANIMALS_SCALE_RANGE`,keywords:[`animals`,`size`],defaultValue:GE.flyingAnimalsScale},{id:`animals-on-phone`,path:`pref:flyingAnimalsOnPhone`,title:`Show on phone layout`,description:`Allow flights on the phone layout.`,control:`toggle`,advanced:!0,keywords:[`animals`,`mobile`],defaultValue:GE.flyingAnimalsOnPhone}]},{id:`browser-shortcuts`,level:`browser`,title:`Shortcuts and about`,description:`Keyboard reference and build information.`,settings:[]},{id:`machine-general`,level:`machine`,title:`General`,description:`Machine-wide session startup and diagnostics.`,settings:[{id:`auto-resume`,path:`autoResume`,title:`Auto-resume sessions on startup`,description:`Resume conversations that were live when Glimmervoid last shut down or crashed.`,control:`toggle`,keywords:[`startup`,`conversation`],defaultValue:!0},{id:`debug-mode`,path:`debugMode`,title:`Debug mode`,description:`Show session-card diagnostics for state, transitions and detection signals.`,control:`toggle`,keywords:[`diagnostics`,`state`],defaultValue:!1},{id:`calm-layout`,path:`calmLayout`,title:`Calm layout (experimental)`,description:`Replace the Focus rail with a view that prioritizes sessions needing attention and also shows ready and working indicators. Applies to every browser on this machine.`,control:`toggle`,keywords:[`experimental`,`attention`,`priority`],defaultValue:!1}],unattendedLinks:[{settingId:`skip-permissions-by-default`,title:`Skip permission prompts by default`},{settingId:`rtk-compression`,title:`rtk output compression`}]},{id:`machine-updates`,level:`machine`,title:`Updates`,description:`See which Glimmervoid version is running, which one is newest, and update in one step.`,settings:[{id:`update-summary`,path:`status:update-summary`,title:`Status`,description:`Whether this install is up to date, and what an update would move it to.`,control:`readonly`,keywords:[`version`,`available`,`current`],status:`update-summary`},{id:`update-actions`,path:`status:update-actions`,title:`Actions`,description:`Update and restart stages the newest build, then restarts to run it. Update without restart stages it for a later restart.`,control:`readonly`,keywords:[`check`,`restart`],status:`update-actions`},{id:`update-installed`,path:`status:update-installed`,title:`Running version`,description:`The version loaded when the server started, alongside the commit, branch and state of the current disk checkout.`,control:`readonly`,keywords:[`version`,`commit`,`installed`],status:`update-installed`},{id:`update-latest`,path:`status:update-latest`,title:`Latest version`,description:`The newest target found on the selected update channel.`,control:`readonly`,keywords:[`release`,`commit`],status:`update-latest`},{id:`update-last-checked`,path:`status:update-last-checked`,title:`Last checked`,description:`The most recent update check, or why automatic checks are off.`,control:`readonly`,keywords:[`time`,`failure`],status:`update-last-checked`},{id:`update-channel`,path:`updateChannel`,title:`Channel`,description:`Track tagged releases or the upstream of the checked-out branch.`,control:`select`,options:XY(UY),keywords:[`release`,`branch`],defaultValue:`release`},{id:`check-updates`,path:`checkForUpdates`,title:`Check for updates automatically`,description:`Check for a newer Glimmervoid at launch, while a dashboard is connected, and when this page opens.`,control:`toggle`,keywords:[`release`,`github`],defaultValue:!0}]},{id:`machine-terminal`,level:`machine`,title:`Terminal`,description:`Terminal behavior shared by dashboard clients.`,settings:[{id:`replay-buffer`,path:`replayBufferKB`,title:`Replay buffer (KB)`,description:`PTY output retained for clients that reconnect or join late.`,control:`number`,range:`REPLAY_BUFFER_KB_RANGE`,keywords:[`history`,`backfill`],defaultValue:512},{id:`cursor-blink`,path:`cursorBlink`,title:`Cursor blink`,description:`Blink the cursor in every terminal.`,control:`toggle`,keywords:[`caret`,`terminal`],defaultValue:!1}]},{id:`machine-detection-sessions`,level:`machine`,title:`Detection and sessions`,description:`Config-file-only detection, timing, worktree and process settings.`,settings:[{id:`file-detect-background-agents`,path:`detectBackgroundAgents`,title:`Detect background agents`,description:`Hold completion while tracked background work is active. Changes apply to newly created sessions; recreate existing sessions to apply them.`,control:`readonly`,keywords:[`subagents`,`completion`],fileOnly:!0},{id:`file-record-signals`,path:`recordSignals`,title:`Record structural signals`,description:`Keep forensic status and hook recordings for newly created sessions. Full capture (capture.enabled) records these signals even when this is off. Recreate existing sessions to change recording.`,control:`readonly`,keywords:[`recordings`,`diagnostics`],fileOnly:!0},{id:`file-trace-enabled`,path:`trace.enabled`,title:`Capture session traces`,description:`Keep normalized Claude transcript traces for session debugging. Requires a server restart.`,control:`readonly`,keywords:[`transcripts`,`diagnostics`],fileOnly:!0},{id:`file-detect-scheduled-wakeups`,path:`detectScheduledWakeups`,title:`Detect scheduled wakeups`,description:`Surface advisory wakeup timing for scheduled sessions. Requires a server restart to update the configuration, and newly created sessions use the change.`,control:`readonly`,keywords:[`schedule`,`sleep`],fileOnly:!0},{id:`file-worktree-auto-rebase`,path:`worktreeAutoRebase`,title:`Worktree auto-rebase`,description:`Rebase eligible session worktrees when the integration branch moves. Changes apply to newly created sessions; recreate existing sessions to apply them.`,control:`readonly`,keywords:[`git`,`branch`],fileOnly:!0},{id:`file-worktree-rerere`,path:`worktreeRerere`,title:`Worktree rerere`,description:`Reuse recorded Git conflict resolutions. Requires a server restart.`,control:`readonly`,keywords:[`git`,`conflicts`],fileOnly:!0},{id:`file-integration-branch`,path:`integrationBranch`,title:`Integration branch`,description:`Base branch for session worktrees. Empty = each repo's default branch. Reload affects newly created sessions and does not retarget existing sessions.`,control:`readonly`,keywords:[`git`,`merge`],fileOnly:!0},{id:`file-worktree-root`,path:`worktreeRoot`,title:`Worktree root`,description:`Directory that contains session worktrees. Changes apply to newly created sessions and do not relocate existing worktrees; recreate existing sessions to change where they create worktrees.`,control:`readonly`,keywords:[`git`,`directory`],fileOnly:!0},{id:`file-worktree-share`,path:`worktreeShare`,title:`Shared worktree paths`,description:`Local paths copied or linked during worktree preparation. Changes apply to newly created sessions; recreate existing sessions to use a new share list.`,control:`readonly`,keywords:[`files`,`context`],fileOnly:!0},{id:`file-port`,path:`port`,title:`Local port`,description:`Port used by the local dashboard listener. Requires a server restart.`,control:`readonly`,keywords:[`server`,`listener`],fileOnly:!0},{id:`file-auto-recover-seconds`,path:`autoRecoverSeconds`,title:`Auto-recovery delay`,description:`Delay before an interrupted state can recover.`,control:`readonly`,keywords:[`timer`,`recovery`],fileOnly:!0},{id:`file-input-grace-seconds`,path:`inputGraceSeconds`,title:`Input grace period`,description:`Grace window around operator input.`,control:`readonly`,keywords:[`timer`,`prompt`],fileOnly:!0},{id:`file-prompt-detection-ms`,path:`promptDetectionMs`,title:`Prompt detection delay`,description:`Timing threshold used by prompt detection.`,control:`readonly`,keywords:[`timer`,`detection`],fileOnly:!0},{id:`file-notify-debounce-ms`,path:`notifyDebounceMs`,title:`Notification debounce`,description:`Delay used to coalesce notification state changes.`,control:`readonly`,keywords:[`timer`,`alerts`],fileOnly:!0},{id:`file-phone-escalation-ms`,path:`phoneEscalationMs`,title:`Phone escalation delay`,description:`Delay before off-dashboard escalation.`,control:`readonly`,keywords:[`timer`,`telegram`],fileOnly:!0},{id:`file-post-turn-checks`,path:`postTurnChecks`,title:`Post-turn checks`,description:`Deterministic checks run after eligible turns. The global mode is a default; project and individual rule modes can select fixes even when the global mode is report.`,control:`readonly`,keywords:[`quality`,`fixes`],fileOnly:!0},{id:`file-branch-gc-enabled`,path:`branchGc.enabled`,title:`Branch cleanup`,description:`Enable cleanup of eligible session branches.`,control:`readonly`,keywords:[`git`,`cleanup`],fileOnly:!0},{id:`file-branch-gc-worktrees`,path:`branchGc.worktrees`,title:`Local worktree cleanup`,description:`Enable cleanup of eligible local worktrees.`,control:`readonly`,keywords:[`git`,`worktree`,`cleanup`],fileOnly:!0},{id:`file-branch-gc-prefixes`,path:`branchGc.prefixes`,title:`Branch cleanup prefixes`,description:`Branch prefixes that filter both remote branch cleanup and local worktree cleanup.`,control:`readonly`,keywords:[`git`,`branch`],fileOnly:!0},{id:`file-branch-gc-dry-run`,path:`branchGc.dryRun`,title:`Branch cleanup dry run`,description:`Report planned cleanup without deleting remote branches.`,control:`readonly`,keywords:[`git`,`safety`],fileOnly:!0},{id:`file-branch-gc-stale-days`,path:`branchGc.staleDays`,title:`Branch stale days`,description:`Age threshold for orphan branch cleanup when unmerged deletion is on.`,control:`readonly`,keywords:[`git`,`retention`],fileOnly:!0},{id:`file-branch-gc-interval-ms`,path:`branchGc.intervalMs`,title:`Branch cleanup interval`,description:`Delay between branch cleanup passes.`,control:`readonly`,keywords:[`git`,`schedule`],fileOnly:!0},{id:`file-custom-agents`,path:`customAgents`,title:`Custom agents`,description:`Extra agent CLIs a session can be spawned with.`,control:`readonly`,keywords:[`adapters`,`cli`],fileOnly:!0,status:`custom-agents`}]},{id:`machine-repositories`,level:`machine`,title:`Repositories`,description:`Project discovery roots for new sessions.`,settings:[{id:`repository-roots`,path:`repoRoots`,title:`Repository roots`,description:`Directories scanned for projects when adding sessions.`,control:`list`,keywords:[`folders`,`project discovery`],defaultValue:[]}]},{id:`machine-telegram`,level:`machine`,title:`Telegram`,description:`One bot shared by session, PR review and PostHog notifications.`,settings:[{id:`telegram-bot-token`,path:`telegram.botToken`,title:`Bot token`,description:`Credential used by the shared Telegram bot. When GLIMMERVOID_TELEGRAM_BOT_TOKEN supplies it, this field is read-only.`,control:`password`,keywords:[`credential`,`api`],defaultValue:``},{id:`telegram-chat-id`,path:`telegram.chatId`,title:`Chat id`,description:`Destination chat for enabled Telegram lanes.`,control:`text`,keywords:[`destination`,`channel`],defaultValue:``},{id:`telegram-session-notifications`,path:`telegramNotifications`,title:`Send session notifications`,description:`Send session completion, input and failure alerts when no dashboard is open. Unacknowledged alerts also escalate after the phone escalation delay while a dashboard remains open.`,control:`toggle`,keywords:[`phone`,`off dashboard`],defaultValue:!1}]},{id:`machine-usage`,level:`machine`,title:`Usage`,description:`Local transcript accounting and estimated-cost budgets.`,settings:[{id:`usage-enabled`,path:`usage.enabled`,title:`Track token usage`,description:`Read local CLI transcripts and roll them into the Usage view and session chips.`,control:`toggle`,keywords:[`tokens`,`cost`],defaultValue:!0,status:`usage-last-report`},{id:`usage-codex`,path:`usage.vendors.codex`,title:`Track Codex usage`,description:`Include local Codex CLI transcripts in usage reports.`,control:`toggle`,keywords:[`openai`,`vendor`],defaultValue:!0},{id:`usage-grok`,path:`usage.vendors.grok`,title:`Track Grok usage`,description:`Include local Grok CLI transcripts in usage reports.`,control:`toggle`,keywords:[`xai`,`vendor`],defaultValue:!0},{id:`usage-fetch-pricing`,path:`usage.fetchPricing`,title:`Fetch current model prices`,description:`Load public model prices when usage tracking starts, using a cached table for up to one day. Falls back to cached or bundled prices if the fetch fails; no daily refresh runs while tracking continues.`,control:`toggle`,keywords:[`rates`,`models`],defaultValue:!0},{id:`usage-scan-interval`,path:`usage.scanIntervalMinutes`,title:`Scan interval (minutes)`,description:`Periodic transcript polling interval. Session activity can also trigger scans between timer ticks.`,control:`number`,range:`USAGE_SCAN_INTERVAL_RANGE`,keywords:[`poll`,`refresh`],defaultValue:5},{id:`usage-retain-days`,path:`usage.retainDays`,title:`Retain transcript detail (days)`,description:`How long live transcript detail stays available. A monthly budget keeps detail from the start of the current month when that is longer.`,control:`number`,range:`USAGE_RETAIN_DAYS_RANGE`,keywords:[`history`,`retention`],defaultValue:90},{id:`usage-cost-mode`,path:`usage.costMode`,title:`Cost mode`,description:`Choose whether recorded costs, calculated costs or both can appear.`,control:`select`,options:XY(MY),keywords:[`pricing`,`estimate`],defaultValue:`auto`},{id:`usage-daily-budget`,path:`usage.budget.dailyUsd`,title:`Daily budget (USD)`,description:`Estimated daily spend alert threshold. Alerts at 50%, 75% and 100% do not stop spending. Zero or below disables the threshold.`,control:`number`,range:`USAGE_BUDGET_RANGE`,keywords:[`spend`,`alert`],defaultValue:null,integer:!1,nullable:!0,zeroIsNull:!0,step:.01},{id:`usage-monthly-budget`,path:`usage.budget.monthlyUsd`,title:`Monthly budget (USD)`,description:`Estimated monthly spend alert threshold. Alerts at 50%, 75% and 100% do not stop spending. Zero or below disables the threshold.`,control:`number`,range:`USAGE_BUDGET_RANGE`,keywords:[`spend`,`alert`],defaultValue:null,integer:!1,nullable:!0,zeroIsNull:!0,step:.01}]},{id:`machine-privacy`,level:`machine`,title:`Privacy`,description:`What Glimmervoid sends about itself.`,settings:[{id:`telemetry-enabled`,path:`telemetry.enabled`,title:`Send anonymous usage and error data`,description:`Version, platform, app starts, daily activity, session starts and ends with agent kind, exit kind and duration, errors as their type, error code and scrubbed stack frames, per session token counts, models and estimated costs from the usage scan, and factory outcomes as the kind of decision, how it came out, its duration and attempt number, under a random install id. Never error messages, paths, repository or branch names, prompts, objectives or terminal output. GLIMMERVOID_TELEMETRY=0, DO_NOT_TRACK=1 or CI=true turn it off regardless.`,control:`toggle`,keywords:[`telemetry`,`analytics`,`tracking`,`opt out`],defaultValue:!0}]},{id:`lanes-change-map`,level:`lanes`,title:`Change map`,description:`Optional model narration for deterministic change facts.`,settings:[{id:`change-map-narrator-enabled`,path:`changeMap.narrator.enabled`,title:`Enable narration`,description:`Add cited model claims to the change map.`,control:`toggle`,keywords:[`review`,`claims`],defaultValue:!1},{id:`change-map-narrator-engine`,path:`changeMap.narrator.engine`,title:`Narrator engine`,description:`CLI used to generate change map claims.`,control:`select`,options:XY(HY),keywords:[`claude`,`codex`],defaultValue:`claude`},{id:`change-map-narrator-model`,path:`changeMap.narrator.model`,title:`Narrator model`,description:`Blank uses the engine default: haiku for Claude, the configured Codex model for Codex.`,control:`text`,keywords:[`claude`,`codex`,`haiku`],defaultValue:``},{id:`change-map-narrator-timeout`,path:`changeMap.narrator.timeoutSeconds`,title:`Narrator timeout (seconds)`,description:`Maximum time allowed for one narration.`,control:`number`,range:`CHANGE_MAP_NARRATOR_TIMEOUT_RANGE`,keywords:[`deadline`,`narration`],defaultValue:90}]},{id:`lanes-visions`,level:`lanes`,title:`Visions`,description:`Editor-buffer findings and bounded model comments.`,settings:[{id:`visions-enabled`,path:`visions.enabled`,title:`Enable Visions`,description:`Set up supported editors detected on this machine, then show their buffer findings in the Visions view.`,control:`toggle`,keywords:[`editor`,`findings`,`lsp`],defaultValue:!1},{id:`visions-dispatch-enabled`,path:`visions.dispatch.enabled`,title:`Enable model comments`,description:`Start bounded review sessions for local editor buffers.`,control:`toggle`,keywords:[`review`,`dispatch`],defaultValue:!1},{id:`visions-quiet-delay`,path:`visions.dispatch.quietMs`,title:`Quiet delay (ms)`,description:`Editor quiet time before a scheduled review. Saves and blank-line boundaries can dispatch immediately, subject to the other review limits.`,control:`number`,range:`VISIONS_QUIET_MS_RANGE`,keywords:[`debounce`,`idle`],defaultValue:3e4},{id:`visions-cooldown`,path:`visions.dispatch.cooldownMs`,title:`Cooldown (ms)`,description:`Minimum delay between reviews of the same document. Initial orientation reviews bypass this delay.`,control:`number`,range:`VISIONS_COOLDOWN_MS_RANGE`,keywords:[`rate limit`,`delay`],defaultValue:3e5},{id:`visions-max-per-hour`,path:`visions.dispatch.maxPerHour`,title:`Max per hour`,description:`Maximum review sessions dispatched per hour.`,control:`number`,range:`VISIONS_MAX_PER_HOUR_RANGE`,keywords:[`rate limit`,`reviews`],defaultValue:6},{id:`visions-activity-max-per-hour`,path:`visions.dispatch.activityMaxPerHour`,title:`Activity max per hour`,description:`Maximum activity-driven reviews dispatched per hour, capped at the overall hourly limit minus one to reserve an edit-review slot.`,control:`number`,range:`VISIONS_ACTIVITY_MAX_PER_HOUR_RANGE`,status:`visions-activity-limit`,keywords:[`rate limit`,`events`],defaultValue:2},{id:`visions-dispatch-timeout`,path:`visions.dispatch.dispatchTimeoutSeconds`,title:`Dispatch timeout (seconds)`,description:`Maximum time allowed for one review session.`,control:`number`,range:`VISIONS_DISPATCH_TIMEOUT_RANGE`,keywords:[`deadline`,`review`],defaultValue:180},{id:`visions-intent-thread-ttl`,path:`visions.intent.threadTtlMs`,title:`Intent thread lifetime (ms)`,description:`How long an intent thread nobody advanced stays live before it retires.`,control:`number`,range:`VISIONS_INTENT_THREAD_TTL_MS_RANGE`,keywords:[`intent`,`decay`,`thread`],defaultValue:2592e5},{id:`visions-model`,path:`visions.dispatch.model`,title:`Model override`,description:`Leave blank to use the opus model alias.`,control:`text`,keywords:[`claude`,`override`],defaultValue:``},{id:`visions-projects`,path:`visions.projects`,title:`Projects`,description:`Clear every selection, including unavailable projects, to accept buffers from every configured project.`,control:`projects`,keywords:[`repositories`,`filter`],defaultValue:[]},{id:`visions-auto-fix`,path:`visions.autoFix`,title:`Apply tier 1 fixes`,description:`Allow Visions to edit eligible open Markdown buffers, including inactive buffers, without asking.`,control:`toggle`,keywords:[`automatic`,`edits`],danger:!0,warning:`Enabling this control lets Visions edit eligible buffers without a carbon unit present.`,defaultValue:!1}]},{id:`lanes-ingest`,level:`lanes`,title:`Ingest`,description:`Machine-context ingest behind Visions.`,settings:[{id:`ingest-enabled`,path:`ingest.enabled`,title:`Enable machine context ingest`,description:`Enable the local activity feed behind Visions. Turning Visions on enables ingest unless ingest.enabled is explicitly false.`,control:`toggle`,keywords:[`events`,`activity`],defaultValue:!1},{id:`ingest-terminal`,path:`ingest.sources.terminal.enabled`,title:`Terminal output source`,description:`Include terminal output in the ingest feed.`,control:`toggle`,keywords:[`pty`,`source`],defaultValue:!1},{id:`ingest-agent-logs`,path:`ingest.sources.agentLogs.enabled`,title:`Agent logs source`,description:`Include local agent logs in the ingest feed.`,control:`toggle`,keywords:[`transcript`,`source`],defaultValue:!1},{id:`ingest-git`,path:`ingest.sources.git.enabled`,title:`Git activity source`,description:`Include local Git activity in the ingest feed.`,control:`toggle`,keywords:[`commits`,`source`],defaultValue:!1},{id:`ingest-fs`,path:`ingest.sources.fs.enabled`,title:`File changes source`,description:`Include watched file changes in the ingest feed.`,control:`toggle`,keywords:[`filesystem`,`source`],defaultValue:!1},{id:`ingest-shell-history`,path:`ingest.sources.shellHistory.enabled`,title:`Shell history source`,description:`Include local shell history in the ingest feed.`,control:`toggle`,keywords:[`commands`,`source`],defaultValue:!1},{id:`ingest-editor`,path:`ingest.sources.editor.enabled`,title:`Editor events source`,description:`Include local editor events in the ingest feed.`,control:`toggle`,keywords:[`buffers`,`source`],defaultValue:!1}]},{id:`lanes-posthog`,level:`lanes`,title:`PostHog`,description:`Error monitoring, investigations and traffic-spike alerts.`,settings:[{id:`posthog-enabled`,path:`posthog.enabled`,title:`Enable PostHog monitoring`,description:`Poll PostHog error tracking and investigate issues that move.`,control:`toggle`,keywords:[`errors`,`monitoring`],defaultValue:!1},{id:`posthog-host`,path:`posthog.host`,title:`Host`,description:`PostHog cloud or self-hosted HTTP URL.`,control:`text`,keywords:[`url`,`server`],defaultValue:`https://us.posthog.com`},{id:`posthog-api-key`,path:`posthog.apiKey`,title:`Personal API key`,description:`Credential with read access to PostHog projects. When GLIMMERVOID_POSTHOG_API_KEY supplies it, this field is read-only.`,control:`password`,keywords:[`credential`,`token`],defaultValue:``},{id:`posthog-projects`,path:`posthog.projects`,title:`Projects`,description:`Use all, none for an empty selection, or a comma-separated list of positive integer PostHog project ids. Blank means all.`,control:`text`,keywords:[`project ids`,`filter`],defaultValue:`all`,valueKind:`posthog-projects`},{id:`posthog-interval`,path:`posthog.intervalMinutes`,title:`Poll interval (minutes)`,description:`Delay between PostHog polling passes.`,control:`number`,integer:!1,step:`any`,range:`POSTHOG_INTERVAL_RANGE`,keywords:[`refresh`,`schedule`],defaultValue:15},{id:`posthog-max-investigations`,path:`posthog.maxConcurrentInvestigations`,title:`Max concurrent investigations`,description:`Maximum investigation sessions running together.`,control:`number`,range:`POSTHOG_MAX_CONCURRENT_RANGE`,keywords:[`parallel`,`workers`],defaultValue:2},{id:`posthog-investigation-timeout`,path:`posthog.investigationTimeoutSeconds`,title:`Investigation timeout (seconds)`,description:`Maximum time allowed for one investigation.`,control:`number`,integer:!1,step:`any`,range:`POSTHOG_INVESTIGATION_TIMEOUT_RANGE`,keywords:[`deadline`,`session`],defaultValue:900},{id:`posthog-min-users`,path:`posthog.minUsersToInvestigate`,title:`Min users to investigate`,description:`Minimum affected users for a new issue investigation. Regressions, worsening issues and eligible error spikes bypass this minimum.`,control:`number`,range:`POSTHOG_MIN_USERS_RANGE`,keywords:[`threshold`,`affected`],defaultValue:1},{id:`posthog-escalation`,path:`posthog.userEscalationThreshold`,title:`Escalation threshold (users)`,description:`Affected-user count that escalates an issue.`,control:`number`,range:`POSTHOG_ESCALATION_RANGE`,keywords:[`threshold`,`severity`],defaultValue:25},{id:`posthog-fix-timeout`,path:`posthog.fixTimeoutSeconds`,title:`Fix timeout (seconds)`,description:`Maximum time allowed for one fix session.`,control:`number`,integer:!1,step:`any`,range:`POSTHOG_FIX_TIMEOUT_RANGE`,keywords:[`deadline`,`repair`],defaultValue:1800},{id:`posthog-traffic-enabled`,path:`posthog.trafficSpikeEnabled`,title:`Traffic spike alerts`,description:`Ping when recent unique users exceed a project baseline.`,control:`toggle`,keywords:[`analytics`,`alert`],defaultValue:!0},{id:`posthog-traffic-multiplier`,path:`posthog.trafficSpikeMultiplier`,title:`Spike multiplier`,description:`Baseline multiplier required to classify a traffic spike.`,control:`number`,integer:!1,step:`any`,range:`POSTHOG_TRAFFIC_MULTIPLIER_RANGE`,keywords:[`baseline`,`ratio`],defaultValue:3},{id:`posthog-traffic-min-users`,path:`posthog.trafficSpikeMinUsers`,title:`Min users to alert`,description:`Minimum recent unique users for an initial traffic-spike alert. Escalation and recovery alerts bypass this minimum.`,control:`number`,range:`POSTHOG_TRAFFIC_MIN_USERS_RANGE`,keywords:[`threshold`,`analytics`],defaultValue:10},{id:`posthog-traffic-cooldown`,path:`posthog.trafficSpikeCooldownMinutes`,title:`Spike cooldown (minutes)`,description:`Cooldown for new traffic spikes. Escalation and recovery alerts bypass it. Zero removes the time delay; repeated active-spike alerts are still suppressed.`,control:`number`,integer:!1,step:`any`,range:`POSTHOG_TRAFFIC_COOLDOWN_RANGE`,keywords:[`silence`,`delay`],defaultValue:360},{id:`posthog-traffic-baseline`,path:`posthog.trafficSpikeBaselineDays`,title:`Baseline window (days)`,description:`Historical window used to calculate normal hourly traffic.`,control:`number`,range:`POSTHOG_TRAFFIC_BASELINE_RANGE`,keywords:[`history`,`analytics`],defaultValue:7},{id:`posthog-auto-fix`,path:`posthog.autoFix`,title:`Attempt fixes for major issues`,description:`Allow an isolated agent to fix an issue, push a branch and open a pull request.`,control:`toggle`,keywords:[`automatic`,`pull request`],danger:!0,warning:`Enabling this control lets PostHog fixes commit, push and open pull requests automatically.`,defaultValue:!1}]},{id:`lanes-team-review`,level:`lanes`,title:`Team review`,description:`Draft reviews of teammates' pull requests for you to post from the Reviews tab.`,settings:[{id:`team-review-enabled`,path:`teamReview.enabled`,title:`Enable team review`,description:`Poll open pull requests from the team and draft a review of each one. Nothing is posted until you choose Approve or Comment.`,control:`toggle`,keywords:[`pull requests`,`github`],defaultValue:!1},{id:`github-teams`,path:`github.teams`,title:`GitHub teams`,description:`Teams to search for review requests and members, one org/slug per entry. Leave empty to use the organization and team below.`,control:`list`,keywords:[`github`,`teams`,`review requests`],defaultValue:[],listPlaceholder:`org/team-slug`,listEmptyText:`No GitHub teams configured.`},{id:`team-review-org`,path:`teamReview.org`,title:`GitHub organization`,description:`Organization login that owns the team, for example PostHog.`,control:`text`,keywords:[`github`,`owner`],defaultValue:``},{id:`team-review-team`,path:`teamReview.team`,title:`GitHub team`,description:`Team slug whose members and review requests are polled.`,control:`text`,keywords:[`github`,`slug`],defaultValue:``},{id:`team-review-re-review-after-hours`,path:`teamReview.reReviewAfterHours`,title:`Re-review after (hours)`,description:`When a reviewed PR has a new head, review it again after this many hours since its last review. Queue review runs it at any time.`,control:`number`,range:`POSTHOG_INTERVAL_RANGE`,keywords:[`review`,`delay`],defaultValue:24,integer:!1,step:.5},{id:`team-review-skip-idle-after-days`,path:`teamReview.skipIdleAfterDays`,title:`Skip PRs idle for (days)`,description:`Leave pull requests without GitHub activity for this long out of automatic review.`,control:`number`,range:`POSTHOG_INTERVAL_RANGE`,keywords:[`idle`,`activity`],defaultValue:14,integer:!1,step:.5},{id:`team-review-skill`,path:`teamReview.skill`,title:`Review skill`,description:`Name of a Claude Code skill installed for the review agent, for example your own PR review skill. Leave empty to let the agent review with whatever skills it has.`,control:`text`,keywords:[`skill`,`claude code`,`pr review`],defaultValue:``},{id:`team-review-auto-rebase-my-prs`,path:`teamReview.autoRebaseMyPrs`,title:`Keep my pull requests rebased`,description:`On each poll, rebase your open, non-draft pull requests that are behind their base branch. A pull request with conflicts or checks still running is left alone, and a failed rebase is not retried until you push again.`,control:`toggle`,keywords:[`rebase`,`update branch`,`behind`,`my prs`],danger:!0,warning:`Enabling this control rewrites your pull request branches on GitHub. Pull before you push from a local checkout of one.`,defaultValue:!1},{id:`team-review-keep-mergeable-enabled`,path:`teamReview.keepMergeableEnabled`,title:`Keep mergeable`,description:`Offer Keep mergeable on your pull requests: a sandboxed agent repairs conflicts and failing checks and pushes the repair. Off hides the control and starts no repair; the pull requests you chose stay chosen for when you turn it back on.`,control:`toggle`,keywords:[`repair`,`conflicts`,`my prs`],defaultValue:!0},{id:`team-review-keep-mergeable-timeout`,path:`teamReview.keepMergeableTimeoutMinutes`,title:`Keep mergeable deadline (minutes)`,description:`Longest a Keep mergeable repair session may run before it is stopped and nothing is pushed.`,control:`number`,range:`KEEP_MERGEABLE_TIMEOUT_MINUTES_RANGE`,keywords:[`timeout`,`repair`],defaultValue:30},{id:`team-review-merge-queue-enabled`,path:`teamReview.mergeQueueEnabled`,title:`Merge when ready`,description:`Offer Merge when ready on your pull requests: queued pull requests are rebased when behind and merged once ready, one per repository per poll. Off hides the control and merges nothing; the queue is kept for when you turn it back on.`,control:`toggle`,keywords:[`merge queue`,`auto merge`,`my prs`],defaultValue:!0}]},{id:`lanes-benchmarks`,level:`lanes`,title:`Benchmarks`,description:`Compare agent setups on frozen cases from the suites in the benchmarks folder of the Glimmervoid home.`,settings:[{id:`benchmarks-enabled`,path:`benchmarks.enabled`,title:`Enable benchmarks`,description:`Show the Bench tab. Nothing runs until you choose Mine or Run there.`,control:`toggle`,keywords:[`eval`,`arms`,`recall`,`compare`],defaultValue:!1}]},{id:`lanes-factory`,level:`lanes`,title:`Factory`,description:`Read Coherence reports from repositories whose integration branch holds a coherence.config.json and show their status in the Factory tab.`,settings:[{id:`factory-enabled`,path:`factory.enabled`,title:`Enable the factory`,description:`Enable Coherence status polling and show the Factory tab. Off by default.`,control:`toggle`,keywords:[`orchestrator`,`intents`,`queue`,`coherence`,`guardrails`],defaultValue:!1},{id:`factory-max-risk`,path:`factory.maxRisk`,title:`Worker risk ceiling`,description:`Highest risk admitted for a ticket.`,control:`select`,defaultValue:`medium`,options:[`low`,`medium`,`high`,`critical`].map(e=>({value:e,label:e})),keywords:[`risk`,`admission`]},{id:`factory-max-live-workers`,path:`factory.maxLiveWorkers`,title:`Live worker cap`,description:`Most live workers per factory project.`,control:`number`,range:`FACTORY_MAX_LIVE_WORKERS_RANGE`,defaultValue:2,keywords:[`workers`,`parallel`]},{id:`factory-checks`,path:`factory.checks`,title:`Worker checks`,description:`Commands glimmervoid runs before merging worker commits.`,control:`list`,defaultValue:[`npm run typecheck`,`npm run lint`,`npm test`],keywords:[`tests`,`checks`]},{id:`factory-protected-paths`,path:`factory.protectedPaths`,title:`Protected paths`,description:`Repo-relative files, directory prefixes ending in /, or **/NAME basenames workers cannot change.`,control:`list`,defaultValue:[`coherence.config.json`,`.coherence/`,`package.json`,`package-lock.json`,`**/AGENTS.md`,`**/CLAUDE.md`,`**/CLAUDE.local.md`,`.claude/`,`.github/`],keywords:[`fence`,`scope`]},{id:`factory-reviewer-model`,path:`factory.reviewerModel`,title:`Reviewer model`,description:`Claude model for independent worker review. Blank uses the CLI default.`,control:`text`,defaultValue:null,nullable:!0,keywords:[`claude`,`review`]},{id:`factory-daily-budget`,path:`factory.dailyBudgetUsd`,title:`Factory daily budget (USD)`,description:`Factory lane spend ceiling. Blank means no ceiling. Needs usage tracking: with it off, dispatch refuses.`,control:`number`,range:`NON_NEGATIVE_NUMBER_RANGE`,integer:!1,nullable:!0,step:.01,defaultValue:null,keywords:[`spend`,`budget`]},{id:`factory-verifier-model`,path:`factory.verifierModel`,title:`Verifier model`,description:`Claude model for independent intent verification. Blank uses the CLI default.`,control:`text`,nullable:!0,defaultValue:null,keywords:[`claude`,`verification`]},{id:`factory-mirror-harness-runs`,path:`factory.mirrorHarnessRuns`,title:`Mirror harness runs`,description:`Show the latest factory harness run as a read-only project in the Factory tab while it runs and for a day after. Needs factory.enabled on; leave it off on a harness instance.`,control:`toggle`,defaultValue:!1,keywords:[`harness`,`test`,`read-only`]}]},{id:`lanes-knowledge-graph`,level:`lanes`,title:`Knowledge graph (experimental)`,description:`A typed local graph of projects, tasks, notes, references and questions, driven from the glimmervoid kg command. Its SQLite database defaults to the Glimmervoid home; --db selects another path.`,settings:[{id:`knowledge-graph-enabled`,path:`knowledgeGraph.enabled`,title:`Enable the knowledge graph`,description:`Allow the glimmervoid kg command. It reads Coherence ledgers to report where your tasks and the agents' tickets disagree, without modifying those ledgers. Graph writes go to the selected SQLite database, which can be inside a repository when --db names that path. Off by default.`,control:`toggle`,keywords:[`experimental`,`kg`,`tasks`,`notes`,`references`,`coherence`],defaultValue:!1}]},{id:`lanes-workflows`,level:`lanes`,title:`Workflows`,description:`Rules that act on pull request events in the repositories you choose.`,settings:[{id:`workflows-enabled`,path:`workflows.enabled`,title:`Run workflows`,description:`Poll the repositories your enabled rules watch and run their actions. Off stops polling and every action, whatever each rule says.`,control:`toggle`,keywords:[`pull requests`,`automation`,`master switch`],defaultValue:!0},{id:`workflows-max-concurrent-sessions`,path:`workflows.maxConcurrentSessions`,title:`Concurrent agent sessions`,description:`Most workflow agent sessions running at once. Up to twenty later spawns wait for a free slot; additional spawns are dropped and logged.`,control:`number`,range:`WORKFLOWS_MAX_CONCURRENT_SESSIONS_RANGE`,keywords:[`parallel`,`spawn`],defaultValue:2},{id:`workflows-max-actions-per-poll`,path:`workflows.maxActionsPerPoll`,title:`Actions per poll`,description:`Most actions run in one poll. The rest are dropped and logged.`,control:`number`,range:`WORKFLOWS_MAX_ACTIONS_PER_POLL_RANGE`,keywords:[`cap`,`rate limit`],defaultValue:20},{id:`workflows-rules`,path:`workflows`,title:`Workflow rules`,description:`Each rule watches repositories for one pull request event (opened, checks-failed, review-requested, approved, commented or merged), narrows it by author, labels, base branch, your own pull requests or a review request to your team, and then notifies you, labels or comments on the pull request, or starts a sandboxed agent session that pushes nothing. Rules start disabled. Turn each rule on or off here; everything else about a rule is set in config.json.`,control:`readonly`,keywords:[`pull requests`,`automation`,`github`,`rules`],fileOnly:!0,status:`workflows`}]},{id:`machine-guardrails`,level:`machine`,title:`Session guardrails`,description:`Claude Code sessions on Linux and macOS write anywhere this account can, except credentials, Glimmervoid's own state and the blocked folders below. Changes apply to sessions started after the change.`,settings:[{id:`guardrails-unguarded-repos`,path:`guardrails.unguardedRepos`,title:`Unguarded repositories`,description:`Folders whose sessions run without guardrails. A session started in one of these folders, or below it, is not guarded. Applies to sessions created after the change.`,control:`list`,keywords:[`guardrails`,`opt out`,`dotfiles`],danger:!0,warning:`A session without guardrails can read credentials and write anywhere this account can.`,defaultValue:[]},{id:`guardrails-blocked-paths`,path:`guardrails.blockedPaths`,title:`Blocked folders`,description:`Extra folders and files a guarded session cannot write, on top of credentials and Glimmervoid's own state. A leading ~ means the home folder.`,control:`list`,keywords:[`guardrails`,`block`,`protect`],defaultValue:[]},{id:`guardrails-unreadable-paths`,path:`guardrails.unreadablePaths`,title:`Unreadable folders`,description:`Extra folders and files a guarded session cannot read, on top of the built-in credential list. A leading ~ means the home folder.`,control:`list`,keywords:[`guardrails`,`secrets`,`credentials`],defaultValue:[]}]},{id:`lanes-unattended`,level:`lanes`,title:`Unattended actions`,description:`Controls that let automated work change repositories or install executable tooling.`,settings:[{id:`skip-permissions-by-default`,path:`skipPermissionsByDefault`,title:`Skip permission prompts by default`,description:`Start sessions whose project sets no permission choice with the agent CLI permission bypass flag.`,control:`toggle`,keywords:[`permissions`,`yolo`,`dangerously`],danger:!0,warning:`Enabling this control lets agents edit files and run shell commands without asking, and restarts running sessions that inherit it.`,defaultValue:!1},{id:`sane-yolo`,path:`saneYolo`,title:`Sane YOLO`,description:`Block catastrophic commands in sessions that skip permission prompts when the cc-safety-net executable is available and trusted hooks are installed. Missing or untrusted hooks leave a session unprotected. Applies to sessions created after the change.`,control:`toggle`,keywords:[`permissions`,`yolo`,`safety`],defaultValue:!0},{id:`branch-gc-delete-unmerged`,path:`branchGc.deleteUnmerged`,title:`Delete unmerged branches`,description:`Also delete stale remote branches with no merge proof. Off keeps every unmerged branch.`,control:`toggle`,keywords:[`git`,`cleanup`,`orphan`],danger:!0,warning:`Enabling this control lets branch cleanup delete stale remote branches without merge proof.`,defaultValue:!1},{id:`post-turn-checks-mode`,path:`postTurnChecks.mode`,title:`Post-turn checks mode`,description:`Default mode for post-turn checks. Project and individual rule modes override it, so Report can still allow file fixes.`,control:`select`,options:XY(WY),keywords:[`quality`,`fixes`],defaultValue:`report`},{id:`rtk-compression`,path:`rtk`,title:`rtk output compression`,description:`Compress Bash output for newly spawned or restarted sessions.`,control:`toggle`,keywords:[`bash`,`tokens`],danger:!0,status:`rtk-install`,warning:`Enabling this control permits Glimmervoid to install the pinned rtk executable automatically.`,defaultValue:!1}]}]);function eX(e){return[e.repos.join(`, `),e.trigger,e.actions.map(e=>e.type).join(`, `)].join(` `)}function tX(e){if(e==null)return[`No rules. Add workflows.rules to config.json.`];let t=EY.safeParse(e);return t.success?t.data.rules.length===0?[`No rules. Add workflows.rules to config.json.`]:t.data.rules.map(e=>[e.name,e.enabled?`enabled`:`disabled`,eX(e)].join(` `)):[`The workflows block is invalid, so no rule runs: ${t.error.issues[0]?.message??`unknown problem`}`]}function nX(e){let t=EY.safeParse(e??{});return t.success?t.data.rules.map(e=>({id:e.id,name:e.name,isEnabled:e.enabled,summary:eX(e)})):[]}function rX(e){let t=e.workflows;return typeof t!=`object`||!t||Array.isArray(t)?e:{...e,workflows:Object.fromEntries(Object.entries(t).filter(([e])=>e!==`rules`))}}function iX({checked:e=[],stored:t=[],rendered:n=[]}={}){let r=new Set(n),i=[...e];for(let e of t)typeof e==`string`&&e.trim()&&(r.has(e)||i.includes(e)||i.push(e));return i}function aX(e,t){let n=new Set(e.map(e=>e.id)),r=[...new Set(t)].filter(e=>!n.has(e));return[...e,...r.map(e=>({id:e,name:`Unavailable project (${e})`}))]}function oX(e,t,n){return n?e.some(e=>e.toLowerCase()===t.toLowerCase()):e.includes(t)}var sX=new WeakMap,cX=`Configured`,lX=`•`.repeat(12);function uX(e,t){let n=t.secretSources;if(!n||typeof n!=`object`)return null;let r=n[e.path];return typeof r==`string`?r:null}function dX(e){let t=String(e??``).trim().toLowerCase();if(!t||t===`all`)return`all`;if(t===`none`)return[];let n=t.split(`,`).map(e=>e.trim());return n.every(e=>/^\d+$/.test(e)&&Number.isSafeInteger(Number(e))&&Number(e)>0)?n.map(Number):null}function fX(e){let t=Number(e[`visions.dispatch.maxPerHour`]),n=Number(e[`visions.dispatch.activityMaxPerHour`]);return!Number.isSafeInteger(t)||t<1||!Number.isSafeInteger(n)||n<0?``:`Effective activity limit: ${Math.min(n,t-1)} per hour. One slot is reserved for edit reviews.`}function pX(e){let t=e.rtkInstall;return t?.status===`installing`?`No rtk binary found. Glimmervoid is installing it into ~/.glimmervoid/bin now.`:e.rtkInstallSupported===!1?`No rtk binary found. Automatic installation is unavailable on this server platform; install a compatible binary manually.`:t?.status===`failed`?`No rtk binary found. The last install attempt failed: ${t.reason||`unknown reason`}. A save can retry after the ten-minute failure cooldown; saves during the cooldown skip installation.`:`No rtk binary found. Saving requests installation into ~/.glimmervoid/bin on supported server platforms, subject to installer eligibility.`}function mX(e){return e.control===`password`}function hX(e){return`${e.path}${cX}`}function gX(e){return Array.isArray(e)?e.map(gX):!e||typeof e!=`object`?e:Object.fromEntries(Object.entries(e).map(([e,t])=>[e,gX(t)]))}function _X(e,t){let n=e;for(let e of t.split(`.`)){if(typeof n!=`object`||!n)return;n=n[e]}return n}function vX(e,t){let n=t.split(`.`),r=e;for(let e of n.slice(0,-1)){if(!r||typeof r!=`object`)return;r=r[e]}r&&typeof r==`object`&&delete r[n.at(-1)]}function yX(e,t,n){let r=t.split(`.`),i=e;for(let e of r.slice(0,-1))(!i[e]||typeof i[e]!=`object`||Array.isArray(i[e]))&&(i[e]={}),i=i[e];i[r.at(-1)]=gX(n)}function bX(e){return e.flatMap(e=>e.settings||[])}function xX(e){return e.fileOnly||e.control===`readonly`}function SX(e){return String(e||``).toLowerCase().match(/[a-z0-9]+/g)||[]}var CX=3,wX=2,TX=1,EX=3;function DX(e,t){return e===t?CX:e.startsWith(t)?wX:t.length>=EX&&e.includes(t)?TX:0}function OX(e,t,n){let r=0;for(let n of t){let t=Math.max(0,...e.map(e=>DX(e,n)));if(t===0)return 0;r+=t}return r*n}function kX(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((e,n)=>kX(e,t[n]));if(!e||!t||typeof e!=`object`||typeof t!=`object`)return!1;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>Object.hasOwn(t,n)&&kX(e[n],t[n]))}function AX(e,t){return e.valueKind===`posthog-projects`?Array.isArray(t)?t.length===0?`none`:t.join(`, `):t??`all`:gX(t)}function jX(e,t){if(e.control===`number`){if(e.nullable&&(t==null||String(t).trim()===``))return null;let n=Number(t);return e.zeroIsNull&&n<=0?null:n}if(e.valueKind===`posthog-projects`)return dX(t);if(e.control===`text`||e.control===`password`){let n=String(t??``).trim();return e.nullable&&!n?null:n}return gX(t)}function MX(e){return sX.get(e)||null}function NX(e,t={}){let n={};for(let r of bX(e)){if(xX(r))continue;if(r.path.startsWith(`pref:`)){let e=r.path.slice(5),i=t.prefs?.[e]??t[r.path];n[r.path]=AX(r,i??r.defaultValue);continue}if(mX(r)){let e=_X(t,hX(r))===!0;n[r.path]=e?lX:``;continue}let e=_X(t,r.path);n[r.path]=AX(r,e??r.defaultValue)}return sX.set(n,gX(t)),n}function PX(e,t,n,r,i={}){let{rehydrateSectionIds:a=[]}=i,o=NX(e,t),s=NX(e,t);if(!n||!r)return{original:o,edited:s};let c=new Set(a);for(let t of e)if(!c.has(t.id)&&t.settings.some(e=>!e.path.startsWith(`pref:`)&&!kX(n[e.path],r[e.path])))for(let e of t.settings)o[e.path]=gX(n[e.path]),s[e.path]=gX(r[e.path]);return{original:o,edited:s}}function FX(e,t,n){let r=bX(e).filter(e=>xX(e)||e.path.startsWith(`pref:`)||uX(e,MX(t)||{})||mX(e)&&n[e.path]===lX?!1:!kX(t[e.path],n[e.path]));if(r.length===0)return{};let i=MX(t)||{},a=(Array.isArray(i.projectChoices)?i.projectChoices:[]).map(e=>e.id).filter(e=>typeof e==`string`),o={},s=new Set;for(let e of r){let[r]=e.path.split(`.`);if(!e.path.includes(`.`)){o[r]=jX(e,n[e.path]);continue}if(!s.has(r)){let e=i[r];o[r]=e&&typeof e==`object`&&!Array.isArray(e)?gX(e):{},s.add(r)}let c=jX(e,n[e.path]);if(e.control===`projects`){let n=t[e.path];c=iX({checked:Array.isArray(c)?c:[],stored:Array.isArray(n)?n:[],rendered:aX(a.map(e=>({id:e,name:e})),Array.isArray(n)?n:[]).map(e=>e.id)})}yX(o,e.path,c)}for(let t of bX(e))mX(t)&&vX(o,hX(t));return delete o.secretSources,o}function IX(e,t){let n=t.integer===!1?`number`:`whole number`;return e.exclusiveMin?`Must be a positive ${n}.`:e.max==null?`Must be a ${n} of at least ${e.min}.`:`Must be a ${n} between ${e.min} and ${e.max}.`}function LX(e,t,n){if(e.nullable&&(t==null||String(t).trim()===``))return null;let r=Number(t),i=n[e.range??``];return i?!Number.isFinite(r)||e.integer!==!1&&!Number.isSafeInteger(r)?IX(i,e):i.exclusiveMin&&r<=i.min?e.zeroIsNull&&r<=0?null:IX(i,e):!i.exclusiveMin&&r<i.min||i.max!=null&&r>i.max?IX(i,e):null:`Allowed range is unavailable.`}function RX(e){return dX(e)===null?`Must be "all", "none", or a comma-separated list of positive safe integer ids without empty entries.`:null}function zX(e,t,n={}){let r={};for(let i of bX(e)){if(xX(i))continue;let e=null;i.control===`number`&&(e=LX(i,t[i.path],n)),i.valueKind===`posthog-projects`&&(e=RX(t[i.path])),i.control===`select`&&!i.options.some(e=>e.value===t[i.path])&&(e=`Choose one of the available options.`),e&&(r[i.id]=e)}return BX(bX(e),t,r),r}function BX(e,t,n){for(let r of e){let i=e.find(e=>e.id===r.maximumSettingId);if(!i||n[r.id]||n[i.id])continue;let a=Number(t[r.path]),o=Number(t[i.path]);a>o&&(n[r.id]=`Minimum must not exceed the maximum (${o}).`,n[i.id]=`Maximum must not be below the minimum (${a}).`)}}function VX(e,t){return bX(e).find(e=>e.id===t.maximumSettingId||e.maximumSettingId===t.id)}function HX(e){let t={browser:[],machine:[],lanes:[],projects:[]};for(let n of e)t[n.level]||(t[n.level]=[]),t[n.level].push(n);return t}function UX(e,t){let n=SX(t);if(n.length===0)return[];let r=[];for(let t of e){let e=SX(t.title);for(let i of t.settings||[]){let a=OX(SX(i.title),n,1e3),o=OX(SX((i.keywords||[]).join(` `)),n,100),s=OX(e,n,10),c=OX(SX(i.description),n,1),l=a+o+s+c;l!==0&&r.push({section:t,setting:i,score:l})}}return r.sort((e,t)=>t.score-e.score||e.section.title.localeCompare(t.section.title)||e.setting.title.localeCompare(t.setting.title)).slice(0,30)}function WX(e,t,n={},r={}){let i=/^#settings\/([^/]+)(?:\/([^/]+))?$/.exec(String(e||``));if(!i)return null;let a,o;try{a=decodeURIComponent(i[1]),o=i[2]?decodeURIComponent(i[2]):null}catch{return null}let s=(o?r[a]?.[o]:void 0)||n[a]||a,c=t.find(e=>e.id===s);if(!c)return null;let l=o?(c.settings||[]).find(e=>e.id===o):null;return o&&!l?null:{sectionId:s,settingId:l?.id||null,hash:`#settings/${s}${l?`/${l.id}`:``}`}}function GX(e){let t=`lanes-unattended`,n=e.find(e=>e.id===t);if(!n)return[...e];let r=e.filter(e=>e.id!==t),i=r.findLastIndex(e=>e.level===`lanes`);return r.splice(i+1,0,n),r}function KX(e,t,n){return{id:`project-${e}-${t}`,projectId:e,...n}}function qX(e){return String(e||``).replace(/\s+\(\d+\)$/,``)}function JX(e){return String(e||``).replace(/[\\/]+$/,``).split(/[\\/]/).at(-1)||``}function YX(e){return JX(e?.path)||qX(e?.name)||e?.id}function XX(e=[]){return e.filter(e=>typeof e?.id==`string`&&e.id).map(e=>({id:`project-${e.id}`,level:`projects`,title:YX(e),description:`Settings scoped to this configured project.`,caption:(e.recordNames?.length??0)>1?`Cards: ${e.recordNames?.join(`, `)}`:``,project:e,settings:[KX(e.id,`agent`,{path:`project:${e.id}:agent`,title:`Agent`,description:`Agent configured for this project.`,control:`readonly`,keywords:[`cli`,`runtime`],value:e.agent||`Not available in the current dashboard payload`}),KX(e.id,`permission-mode`,{path:`project:${e.id}:permission-mode`,title:`Default permission mode`,description:`Permission mode used for newly spawned sessions.`,control:`readonly`,keywords:[`approval`,`sandbox`],value:e.permissionMode||`Not available in the current dashboard payload`}),KX(e.id,`codex-hook-trust`,{path:`projects.${e.id}.codexBypassHookTrust`,title:`Codex hook trust bypass`,description:`Configured only on this project record.`,control:`readonly`,keywords:[`hooks`,`codex`],fileOnly:!0})]}))}function ZX(e=[]){let t=new Set;return e.filter(e=>typeof e?.id!=`string`||!e.id?!1:!e.path||!t.has(e.path)&&(t.add(e.path),!0))}function QX(e=[],t=[]){let n=new Map(t.filter(e=>typeof e?.id==`string`&&e.id).map(e=>[e.id,e]));return e.map(e=>{let r=n.get(e?.id),i=e?.path||r?.path,a=t.filter(e=>i&&e?.path===i).map(e=>e?.name).filter(e=>typeof e==`string`&&e!==``);return{...r,...e,path:i,recordNames:[...new Set(a)]}})}function $X(e,t){return e.danger===!0&&!!e.warning&&t===!0}function eZ(e,t){return e.find(e=>e.id===t)||e[0]||null}var tZ={ready:{label:`Ready`,meaning:`Ready to merge, or nothing left for you to do.`},passed:{label:`Passed`,meaning:`Checks passing, approved, or nothing open.`},failed:{label:`Failed`,meaning:`Checks failing, an automated review failed, or an auto-rebase failed.`},conflict:{label:`Conflict`,meaning:`Merge conflicts with the base branch.`},"your-turn":{label:`Your turn`,meaning:`Waiting on you: a review to give or a thread to answer.`},"changes-requested":{label:`Changes`,meaning:`A reviewer requested changes.`},thread:{label:`Threads`,meaning:`Unresolved review threads or comments.`},behind:{label:`Behind`,meaning:`The branch is behind its base.`},stale:{label:`Out of date`,meaning:`New commits landed since the automated review.`},fork:{label:`Fork`,meaning:`Opened from a fork, so it is reviewed by hand.`},running:{label:`Running`,meaning:`Checks or an automated review in progress.`},reviewer:{label:`Reviewer`,meaning:`Waiting on a reviewer.`},queued:{label:`Queued`,meaning:`Waiting for an automated review slot.`},draft:{label:`Draft`,meaning:`Still a draft.`},merged:{label:`Merged`,meaning:`Merged.`},discarded:{label:`Discarded`,meaning:`Review discarded or dismissed.`},unknown:{label:`Unknown`,meaning:`GitHub has not computed this yet.`},none:{label:`None`,meaning:`Nothing applies, such as no checks or no review requested.`}},nZ={merged:`M5.45 5.154A4.25 4.25 0 0 0 9.25 7.5h1.378a2.251 2.251 0 1 1 0 1.5H9.25A5.734 5.734 0 0 1 5 7.123v3.505a2.25 2.25 0 1 1-1.5 0V5.372a2.25 2.25 0 1 1 1.95-.218ZM4.25 13.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Zm8.5-4.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5ZM5 3.25a.75.75 0 1 0 0 .005V3.25Z`,draft:`M3.25 1A2.25 2.25 0 0 1 4 5.372v5.256a2.251 2.251 0 1 1-1.5 0V5.372A2.251 2.251 0 0 1 3.25 1Zm9.5 14a2.25 2.25 0 1 1 0-4.5 2.25 2.25 0 0 1 0 4.5ZM2.5 3.25a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0ZM3.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm9.5 0a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5ZM14 7.5a1.25 1.25 0 1 1-2.5 0 1.25 1.25 0 0 1 2.5 0Zm0-4.25a1.25 1.25 0 1 1-2.5 0 1.25 1.25 0 0 1 2.5 0Z`,conflict:`M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z`,behind:`M13.03 8.22a.75.75 0 0 1 0 1.06l-4.25 4.25a.75.75 0 0 1-1.06 0L3.47 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018l2.97 2.97V3.75a.75.75 0 0 1 1.5 0v7.44l2.97-2.97a.75.75 0 0 1 1.06 0Z`,failed:`M2.343 13.657A8 8 0 1 1 13.658 2.343 8 8 0 0 1 2.343 13.657ZM6.03 4.97a.751.751 0 0 0-1.042.018.751.751 0 0 0-.018 1.042L6.94 8 4.97 9.97a.749.749 0 0 0 .326 1.275.749.749 0 0 0 .734-.215L8 9.06l1.97 1.97a.749.749 0 0 0 1.275-.326.749.749 0 0 0-.215-.734L9.06 8l1.97-1.97a.749.749 0 0 0-.326-1.275.749.749 0 0 0-.734.215L8 6.94Z`,running:`M8 4a4 4 0 1 1 0 8 4 4 0 0 1 0-8Z`,passed:`M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z`,ready:`M8 16A8 8 0 1 1 8 0a8 8 0 0 1 0 16Zm3.78-9.72a.751.751 0 0 0-.018-1.042.751.751 0 0 0-1.042-.018L6.75 9.19 5.28 7.72a.751.751 0 0 0-1.042.018.751.751 0 0 0-.018 1.042l2 2a.75.75 0 0 0 1.06 0Z`,"changes-requested":`M1 1.75C1 .784 1.784 0 2.75 0h7.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16H2.75A1.75 1.75 0 0 1 1 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h10.5a.25.25 0 0 0 .25-.25V4.664a.25.25 0 0 0-.073-.177l-2.914-2.914a.25.25 0 0 0-.177-.073ZM8 3.25a.75.75 0 0 1 .75.75v1.5h1.5a.75.75 0 0 1 0 1.5h-1.5v1.5a.75.75 0 0 1-1.5 0V7h-1.5a.75.75 0 0 1 0-1.5h1.5V4A.75.75 0 0 1 8 3.25Zm-3 8a.75.75 0 0 1 .75-.75h4.5a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1-.75-.75Z`,thread:`M1 2.75C1 1.784 1.784 1 2.75 1h10.5c.966 0 1.75.784 1.75 1.75v7.5A1.75 1.75 0 0 1 13.25 12H9.06l-2.573 2.573A1.458 1.458 0 0 1 4 13.543V12H2.75A1.75 1.75 0 0 1 1 10.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h4.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z`,reviewer:`M1.75 1h12.5c.966 0 1.75.784 1.75 1.75v8.5A1.75 1.75 0 0 1 14.25 13H8.061l-2.574 2.573A1.458 1.458 0 0 1 3 14.543V13H1.75A1.75 1.75 0 0 1 0 11.25v-8.5C0 1.784.784 1 1.75 1ZM1.5 2.75v8.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-8.5a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25Zm5.28 1.72a.75.75 0 0 1 0 1.06L5.31 7l1.47 1.47a.751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018l-2-2a.75.75 0 0 1 0-1.06l2-2a.75.75 0 0 1 1.06 0Zm2.44 0a.75.75 0 0 1 1.06 0l2 2a.75.75 0 0 1 0 1.06l-2 2a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L10.69 7 9.22 5.53a.75.75 0 0 1 0-1.06Z`,"your-turn":`M8 16a2 2 0 0 0 1.985-1.75c.017-.137-.097-.25-.235-.25h-3.5c-.138 0-.252.113-.235.25A2 2 0 0 0 8 16ZM3 5a5 5 0 0 1 10 0v2.947c0 .05.015.098.042.139l1.703 2.555A1.519 1.519 0 0 1 13.482 13H2.518a1.516 1.516 0 0 1-1.263-2.36l1.703-2.554A.255.255 0 0 0 3 7.947Zm5-3.5A3.5 3.5 0 0 0 4.5 5v2.947c0 .346-.102.683-.294.97l-1.703 2.556a.017.017 0 0 0-.003.01l.001.006c0 .002.002.004.004.006l.006.004.007.001h10.964l.007-.001.006-.004.004-.006.001-.007a.017.017 0 0 0-.003-.01l-1.703-2.554a1.745 1.745 0 0 1-.294-.97V5A3.5 3.5 0 0 0 8 1.5Z`,queued:`M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Zm7-3.25v2.992l2.028.812a.75.75 0 0 1-.557 1.392l-2.5-1A.751.751 0 0 1 7 8.25v-3.5a.75.75 0 0 1 1.5 0Z`,fork:`M5 5.372v.878c0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75v-.878a2.25 2.25 0 1 1 1.5 0v.878a2.25 2.25 0 0 1-2.25 2.25h-1.5v2.128a2.251 2.251 0 1 1-1.5 0V8.5h-1.5A2.25 2.25 0 0 1 3.5 6.25v-.878a2.25 2.25 0 1 1 1.5 0ZM5 3.25a.75.75 0 1 0-1.5 0 .75.75 0 0 0 1.5 0Zm6.75.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Zm-3 8.75a.75.75 0 1 0-1.5 0 .75.75 0 0 0 1.5 0Z`,discarded:`M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Zm9.78-2.22-5.5 5.5a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734l5.5-5.5a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042Z`,stale:`M1.705 8.005a.75.75 0 0 1 .834.656 5.5 5.5 0 0 0 9.592 2.97l-1.204-1.204a.25.25 0 0 1 .177-.427h3.646a.25.25 0 0 1 .25.25v3.646a.25.25 0 0 1-.427.177l-1.38-1.38A7.002 7.002 0 0 1 1.05 8.84a.75.75 0 0 1 .656-.834ZM8 2.5a5.487 5.487 0 0 0-4.131 1.869l1.204 1.204A.25.25 0 0 1 4.896 6H1.25A.25.25 0 0 1 1 5.75V2.104a.25.25 0 0 1 .427-.177l1.38 1.38A7.002 7.002 0 0 1 14.95 7.16a.75.75 0 0 1-1.49.178A5.5 5.5 0 0 0 8 2.5Z`,unknown:`M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.92 6.085h.001a.749.749 0 1 1-1.342-.67c.169-.339.436-.701.849-.977C6.845 4.16 7.369 4 8 4a2.756 2.756 0 0 1 1.637.525c.503.377.863.965.863 1.725 0 .448-.115.83-.329 1.15-.205.307-.47.513-.692.662-.109.072-.22.138-.313.195l-.006.004a6.24 6.24 0 0 0-.26.16.952.952 0 0 0-.276.245.75.75 0 0 1-1.248-.832c.184-.264.42-.489.692-.661.103-.067.207-.132.313-.195l.007-.004c.1-.061.182-.11.258-.161a.969.969 0 0 0 .277-.245C8.96 6.514 9 6.427 9 6.25a.612.612 0 0 0-.262-.525A1.27 1.27 0 0 0 8 5.5c-.369 0-.595.09-.74.187a1.01 1.01 0 0 0-.34.398ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z`,none:`M2 7.75A.75.75 0 0 1 2.75 7h10a.75.75 0 0 1 0 1.5h-10A.75.75 0 0 1 2 7.75Z`};function rZ(e,t){let n=QL(16,16);return n.classList.add(`pr-status-icon`),t&&(n.dataset.tone=t),n.append(ZL(`path`,{d:nZ[e],fill:`currentColor`})),n}var iZ=(e,t,n=!1)=>({state:e,awaitingBackgroundTasks:n,label:n?`Monitoring`:Gs[e],meaning:t}),aZ=Object.freeze([iZ(F.DORMANT,`Not started yet.`),iZ(F.INITIALIZING,`Setting up the worktree and launching the agent.`),iZ(F.STARTING,`The agent is booting.`),iZ(F.RUNNING,`The agent is mid-turn.`),iZ(F.RUNNING,`The turn ended but background tasks or sub-agents are still running.`,!0),iZ(F.WAITING,`Waiting on a permission prompt or your answer.`),iZ(F.IDLE,`Ready for the next prompt.`),iZ(F.COMPLETE,`Finished a turn you have not looked at yet.`),iZ(F.DONE,`The agent process ended.`),iZ(F.FAILED,`The agent failed to start or crashed.`)]);function oZ(e,t){let n=V(`section`,`status-legend`),r=V(`dl`,`status-legend-rows`);return r.append(...t),n.append(V(`h2`,`status-legend-title`,e),r),n}function sZ(e,t){let n=V(`div`,`status-legend-row`);return n.append(e,V(`dd`,`status-legend-meaning`,t)),n}function cZ(){return oZ(`Status colors`,aZ.map(e=>{let t=V(`dt`,`status-legend-badge`),n=V(`span`,`status-legend-glyph`),r=V(`span`,`status-legend-name`);n.setAttribute(`aria-hidden`,`true`),t.append(n,r);let i=sZ(t,e.meaning);return fU(i,{glyph:n,label:r},e.state,e.awaitingBackgroundTasks),i}))}function lZ(){return oZ(`Pull request icons`,Object.keys(tZ).map(e=>{let t=tZ[e],n=V(`dt`,`status-legend-badge`);return n.append(rZ(e),V(`span`,`status-legend-name`,t.label)),sZ(n,t.meaning)}))}var uZ=2e4,Z=null,dZ=null,fZ=null,pZ=null,mZ=null,hZ=null,gZ=null,_Z=`all`,vZ=!1,yZ=null,bZ=AM,xZ=kM,SZ=OM,CZ=!1,wZ=null,TZ=`day`,EZ=new Set,DZ=Ek({getAck:lO,setAck:uO,signature:()=>Aae(Z,fZ),isLooking:()=>!$d(pZ)}),OZ=null,kZ=null,AZ=null,jZ=null,MZ=null,NZ=null,PZ=null,FZ=null,IZ=iF(()=>pZ),LZ=(e,t)=>Xd(`usage`,e,t);function RZ(e,t,n,r){let i=V(`div`,`usage-tile`);r&&r!==`ok`&&(i.dataset.tone=r);let a=V(`span`,`usage-tile-value`,t);i.append(a,V(`span`,`usage-tile-label`,e));let o=n?V(`span`,`usage-tile-sub`,n):null;return o&&i.append(o),{tile:i,valueEl:a,subEl:o}}function zZ(e){let t=Number(e);return Number.isFinite(t)?Math.min(Math.max(t,0),100):0}function BZ(e,t,n){let r=V(`div`,`usage-meter`);r.dataset.tone=String(t),r.setAttribute(`role`,`progressbar`),r.setAttribute(`aria-valuemin`,`0`),r.setAttribute(`aria-valuemax`,`100`),r.setAttribute(`aria-label`,n);let i=V(`span`,`usage-meter-fill`);return r.append(i),VZ(r,e),r}function VZ(e,t){if(!e)return;let n=zZ(t);e.setAttribute(`aria-valuenow`,String(Math.round(n)));let r=e.querySelector(`.usage-meter-fill`);r&&(r.style.width=`${n}%`)}function HZ(e,t,n,r){let i=V(`div`,`usage-table-scroll`);i.dataset.usageTable=r;let a=V(`table`,`usage-table`),o=V(`thead`),s=V(`tr`);for(let i of e){let e=V(`th`,i.numeric?`usage-num`:null);if(e.scope=`col`,!i.key){e.textContent=i.label,s.append(e);continue}let a=i.key;e.setAttribute(`aria-sort`,Wae(t,a));let o=V(`button`,`usage-sort`,i.label);o.type=`button`,o.dataset.sortKey=a,o.addEventListener(`click`,()=>{wZ={kind:`sort`,table:r,key:a},n(a)}),e.append(o),s.append(e)}o.append(s);let c=V(`tbody`);return a.append(o,c),i.append(a),{wrap:i,body:c}}function UZ(e,t){for(let n of t){let t=V(`td`,n.numeric?`usage-num`:n.className||null,n.node?null:n.text);n.node&&t.append(n.node),n.title&&(t.title=n.title),n.span&&(t.colSpan=n.span),e.append(t)}}function WZ(e){let t=V(`div`,`usage-share`);if(!Number.isFinite(e))return t.append(V(`span`,`usage-share-text`,Pj(e))),t;let n=V(`span`,`usage-share-bar`),r=V(`span`,`usage-share-fill`);return r.style.width=`${zZ(e)}%`,n.append(r),t.append(n,V(`span`,`usage-share-text`,Pj(e))),t}function GZ(){if(!OZ?.isConnected)return;let e=Number(Z?.ts);OZ.textContent=Number.isFinite(e)&&e>0?`Report ${nF(e)}`:``}function KZ(){if(!kZ?.isConnected)return;let e=Number(dZ?.ts);kZ.textContent=Number.isFinite(e)&&e>0?`Sessions ${nF(e)}`:``}function qZ(){let e=Hj(Z?.activeBlock);e&&(jZ?.isConnected&&(jZ.textContent=`${e.pct}%`),MZ?.isConnected&&(MZ.textContent=`${Vj(e.remainingMinutes)} left`),NZ?.isConnected&&VZ(NZ,e.pct))}function JZ(e){let t=Ej.find(t=>t.value===e);return t?t.days:null}function YZ(){let e=V(`div`,`usage-controls`),t=V(`label`,`usage-control`);t.append(V(`span`,`usage-control-label`,`Range`));let n=V(`select`,`usage-select`);for(let e of Ej){let t=V(`option`,null,e.label);t.value=e.value,n.append(t)}n.value=_Z,n.addEventListener(`change`,()=>{_Z=n.value,MQ()}),t.append(n);let r=V(`button`,`usage-refresh`,`Refresh`);r.type=`button`,r.title=`Re-read every transcript from the start`,r.addEventListener(`click`,()=>MQ({force:!0}));let i=V(`span`,`usage-refresh-status`,``);return PZ=r,FZ=i,OQ(),e.append(t,r,i),e}function XZ(){let e=LZ(`Usage`,Pie(Z?.daily||[]));e.append(YZ()),OZ=V(`p`,`usage-meta`,``),e.append(OZ),GZ(),IZ.onTick(GZ);let t=Bae(Z);t&&e.append(V(`p`,`usage-warning`,t));let n=Lae(Z?.pricing?.missing);return n&&e.append(V(`p`,`usage-warning`,n)),e}function ZZ(){if(!Oae(fZ))return null;let e=pM(Z?.totals),t=LZ(`Plan limits`,e?`${gM(`official`)}, ${e}`:gM(`official`)),n=Pae(fZ?.ts);if(n){let e=V(`p`,`usage-meta`,n);e.dataset.tone=`warn`,t.append(e)}let r=V(`div`,`usage-plan`);for(let e of mM){let t=hM(fZ,e.key);t&&r.append(QZ(e,t))}return t.append(r),AZ=V(`p`,`usage-meta`,``),t.append(AZ),$Z(),IZ.onTick($Z),t}function QZ(e,t){let n=V(`div`,`usage-plan-window`),r=V(`div`,`usage-plan-head`);r.append(V(`span`,`usage-plan-label`,e.label)),r.append(V(`span`,`usage-plan-used`,jae(t)));let i=V(`span`,`usage-plan-reset`,``);r.append(i),n.append(r),Number.isFinite(t.pct)&&n.append(BZ(t.pct,Uj(t.pct),`${e.label} plan limit used`));let a=()=>{i.isConnected&&(i.textContent=Mae(t.resetsAtMs))};return a(),IZ.onTick(a),n}function $Z(){if(!AZ?.isConnected)return;let e=vM(fZ?.ts);AZ.textContent=e?`Plan ${e}`:``}function eQ(){let e=Xie(Z,fZ),t=tQ();if(e.length===0&&!t)return null;let n=LZ(`Glimmervoid overhead`,e.length>0?Gie:null);if(e.length>0){let t=V(`div`,`usage-tiles`);for(let n of e){let e=[Zie(n),Mj(n.costUSD)].filter(Boolean).join(`, `);t.append(RZ(`${n.label}, share of Claude use`,Pj(n.sharePct),e).tile)}n.append(t);for(let t of e){let e=Qie(t);e&&n.append(V(`p`,`usage-meta`,`${t.label}: ${e}`))}}return t&&(n.append(V(`p`,`usage-meta`,`Selected range by lane. ${Wie}`)),n.append(t)),n}function tQ(){if(!Kie(Z))return null;let e=Yj(Z),t=e.reduce((e,t)=>e+(typeof t.costUSD==`number`&&Number.isFinite(t.costUSD)?t.costUSD:0),0),{wrap:n,body:r}=HZ([{label:`Lane`},{label:`Cost`,numeric:!0},{label:`Tokens`,numeric:!0},{label:`Sessions`,numeric:!0},{label:`Share`,numeric:!0}],null,()=>{},`lane`);for(let n of e){let e=V(`tr`,`usage-row`);n.lane===`other`&&(e.dataset.lane=`other`),UZ(e,[{text:Jj(n.lane),className:`usage-lane-cell`},{text:Mj(n.costUSD),numeric:!0},{text:Nj(n.tokens),numeric:!0},{text:Qj(n.sessions),numeric:!0},{node:WZ(Lj(n.costUSD,t)),className:`usage-share-cell`}]),r.append(e)}return n}function nQ(){let e=Z?.activeBlock,t=Z?.blockHours,n=typeof t==`number`&&Number.isFinite(t)?t:5,r=pM(Z?.totals),i=LZ(`Current block`,r?`${n}h window, ${r}`:`${n}h window`);if(!e){i.append(V(`p`,`usage-empty`,`No active block.`));let e=rQ();return e&&i.append(e),i}let a=_M(Z,fZ),o=V(`div`,`usage-tiles`);o.append(RZ(`block tokens`,Nj(e.tokens??0),Mj(e.costUSD??0),a).tile);for(let t of Rie(e.burn))o.append(RZ(t.label,t.value,t.sub,a).tile);let s=Hj(e);if(s){let e=RZ(`elapsed`,`${s.pct}%`,`${Vj(s.remainingMinutes)} left`);jZ=e.valueEl,MZ=e.subEl,o.append(e.tile)}i.append(o),s&&(NZ=BZ(s.pct,`ok`,`Elapsed share of the current block window`),i.append(NZ),IZ.onTick(qZ));let c=zie(e.projection);if(c){let e=V(`p`,`usage-projection`,c);e.dataset.tone=a,i.append(e)}let l=rQ();l&&i.append(l);let u=Bie(Z?.tokenLimit);if(!u)return i;let d=Gj(Z?.tokenLimit),f=_M(Z);i.append(BZ(d,f,`Share of the largest completed block seen, estimated`));let p=V(`p`,`usage-meta`,u);p.dataset.tone=f,i.append(p),i.append(V(`p`,`usage-provenance`,gM(`estimated`)));let m=Vie(e.projection,Z?.tokenLimit);if(m){let e=V(`p`,`usage-meta`,m);e.dataset.tone=f,i.append(e)}return i}function rQ(){let e=Z?.anomaly;if(!Cae(e))return null;let t=V(`p`,`usage-meta`,xae(e));return t.dataset.tone=Sae(e),t}function iQ(){let e=Xae(Z?.blocks);if(e.length===0)return null;let t=pM(Z?.totals),n=LZ(`Recent blocks`,t?`newest first, ${t}`:`newest first`),r=V(`div`,`usage-blocks`),i=e.reduce((e,t)=>Math.max(e,t.tokens),0);for(let t of e){let e=V(`div`,`usage-block`);t.isActive&&(e.dataset.active=`true`),e.append(V(`span`,`usage-block-label`,Lie(t.startTs)));let n=V(`span`,`usage-block-bar`),a=V(`span`,`usage-block-fill`);a.style.width=`${zZ(Lj(t.tokens,i)??0)}%`,n.append(a),e.append(n),e.append(V(`span`,`usage-block-value`,`${Nj(t.tokens)} ${Mj(t.costUSD)}`)),r.append(e)}return n.append(r),n}function aQ(){let e=Z?.totals||{},t=Yae(Z?.daily,zj(Z)),n=LZ(`Totals`,[Aie,Z?.tz?`TZ ${Z.tz}`:``].filter(Boolean).join(` `)),r=_M(Z,fZ),i=V(`div`,`usage-tiles`);i.append(RZ(`today`,Nj(t?.tokens??0),Mj(t?.costUSD??0),r).tile),i.append(RZ(`range total`,Nj(e.tokens??0),Mj(e.costUSD??0)).tile);let a=$ie(Z);a&&i.append(RZ(a.label,a.value,a.sub).tile),n.append(i);let o=oQ(e);o&&n.append(o);let s=fM(e)?Tae(e):[];if(s.length>0){let e=V(`div`,`usage-tiles usage-vendor-tiles`);for(let t of s)e.append(RZ(t.label,Nj(t.tokens),Mj(t.costUSD)).tile);n.append(e)}return kZ=V(`p`,`usage-meta`,``),n.append(kZ),KZ(),IZ.onTick(KZ),n}function oQ(e){let t=Uie(e);if(t.length===0)return null;let n=V(`div`,`usage-compo`),r=V(`div`,`usage-compo-bar`);r.setAttribute(`aria-hidden`,`true`);for(let e of t){if(e.pct<=0)continue;let t=V(`span`,`usage-compo-fill`);t.dataset.part=e.key,t.style.width=`${e.pct}%`,t.title=e.title,r.append(t)}let i=V(`div`,`usage-compo-legend`);for(let e of t){let t=V(`span`,`usage-compo-item`),n=V(`span`,`usage-compo-swatch`);n.dataset.part=e.key,t.append(n,V(`span`,`usage-compo-label`,e.label),V(`span`,`usage-compo-value`,e.value)),i.append(t)}return n.append(r,i),n}function sQ(){let e=Z?.savings;if(!eae(e))return null;let t=LZ(`Savings`,``),n=V(`div`,`usage-tiles`),r=tae(e);r&&n.append(RZ(`rtk compression`,r.value,r.sub).tile);let i=nae(e);return i&&n.append(RZ(`Prompt cache`,i.value,i.sub).tile),t.append(n),t}function cQ(){let e=tM(Z);if(e.length===0)return null;let t=LZ(`Budgets`,`your own ceilings`),n=V(`div`,`usage-budgets`),r=bW(`machine-usage`,`usage-daily-budget`,`Budget settings`);n.appendChild(r);for(let t of e){let e=V(`div`,`usage-budget`),r=V(`div`,`usage-budget-head`);r.append(V(`span`,`usage-budget-label`,nM(t.scope))),r.append(V(`span`,`usage-budget-value`,rae(t))),r.append(V(`span`,`usage-budget-pct`,Pj(rM(t)))),e.append(r),e.append(BZ(rM(t),t.tone,iae(t))),n.append(e)}return t.append(n),t}function lQ(){let e=Z?.daily||[],t=TZ,n=Jae(dae(e,t),bZ),r=iM.find(e=>e.value===t)?.label||`Day`,i=LZ(`Over time`,[mae(e)].filter(Boolean).join(`, `));if(i.append(uQ()),n.length===0)return i.append(V(`p`,`usage-empty`,`No usage.`)),i;let a=fQ(e);a&&i.append(a);let{wrap:o,body:s}=HZ([{label:r,key:`day`},{label:`Tokens`,numeric:!0,key:`tokens`},{label:`Cost`,numeric:!0,key:`costUSD`},{label:`Models`}],bZ,e=>{bZ=DM(bZ,e),xQ()},`day`);for(let e of n){let n=String(e.day??``),r=V(`tr`,`usage-row`);e.source===`history`&&(r.dataset.source=`history`);let i=jM(e.models),a=`${t}:${n}`,o=pQ(a,i.length);UZ(r,[{node:dQ(e,t),title:n},{text:Nj(e.tokens),numeric:!0},{text:Mj(e.costUSD),numeric:!0},{node:o,className:`usage-toggle-cell`}]),s.append(r),i.length!==0&&EZ.has(a)&&s.append(mQ(i))}return i.append(o),i}function uQ(){let e=V(`div`,`usage-period`);e.setAttribute(`role`,`group`),e.setAttribute(`aria-label`,`Period`);for(let t of iM){let n=V(`button`,`usage-period-button`,t.label);n.type=`button`,n.dataset.periodView=t.value,n.setAttribute(`aria-pressed`,t.value===TZ?`true`:`false`),n.addEventListener(`click`,()=>{TZ!==t.value&&(TZ=t.value,wZ={kind:`period`,view:t.value},xQ())}),e.append(n)}return e}function dQ(e,t){let n=V(`span`,`usage-period-cell`);return n.append(V(`span`,null,pae(e.day,t))),e.source===`history`&&n.append(V(`span`,`usage-history-tag`,`history`)),n}function fQ(e){let{cells:t,max:n}=_ae(e,{today:zj(Z)});if(t.length===0||n<=0)return null;let r=V(`div`,`usage-heatmap-scroll`),i=V(`div`,`usage-heatmap`);i.setAttribute(`role`,`img`),i.setAttribute(`aria-label`,`Daily usage for the trailing ${Math.max(...t.map(e=>e.week))+1} weeks`);let a=V(`div`,`usage-heatmap-days`);for(let e of hae)a.append(V(`span`,`usage-heatmap-day`,e));for(let e of t){let t=V(`span`,`usage-heatmap-cell`);t.dataset.tone=String(e.tone),e.noData&&(t.dataset.noData=`true`),e.source===`history`&&(t.dataset.source=`history`),t.style.gridColumn=String(e.week+1),t.style.gridRow=String(e.weekday+1),t.title=vae(e),i.append(t)}return r.append(a,i),r}function pQ(e,t){if(t===0)return null;let n=V(`button`,`usage-toggle`,`Models`);return n.type=`button`,n.dataset.usageDay=e,n.setAttribute(`aria-expanded`,EZ.has(e)?`true`:`false`),n.addEventListener(`click`,()=>{wZ={kind:`day`,day:e},EZ.has(e)?(EZ.delete(e),xQ()):(EZ.add(e),xQ())}),n}function mQ(e){let t=V(`tr`,`usage-row-breakdown`),n=V(`td`,`usage-models`);n.colSpan=4;for(let t of e){let e=V(`span`,`usage-model-chip`);e.append(V(`span`,`usage-model-name`,CM(t)),V(`span`,`usage-model-value`,`${Nj(t.tokens)} ${Mj(t.costUSD)}`)),n.append(e)}return t.append(n),t}function hQ(e,t){let n=V(`span`,`usage-model-name-wrap`),r=wae(e,t);return r&&n.append(V(`span`,`usage-vendor-tag`,r)),n.append(V(`span`,null,CM(e))),n}function gQ(){let e=jM(Z?.models,xZ),t=Z?.totals||{},n=Fj(t),r=LZ(`By model`,Ij(n));if(e.length===0)return r.append(V(`p`,`usage-empty`,`No models.`)),r;let{wrap:i,body:a}=HZ([{label:`Model`,key:`model`},{label:`Tokens`,numeric:!0,key:`tokens`},{label:`Cost`,numeric:!0,key:`costUSD`},{label:`Share`,numeric:!0},{label:`Input`,numeric:!0,key:`input`},{label:`Output`,numeric:!0,key:`output`},{label:`Cache write`,numeric:!0,key:`cacheCreate`},{label:`Cache read`,numeric:!0,key:`cacheRead`}],xZ,e=>{xZ=DM(xZ,e),xQ()},`model`);for(let r of e){let e=V(`tr`,`usage-row`);UZ(e,[{node:hQ(r,t),className:`usage-model-cell`,title:CM(r)},{text:Nj(r.tokens),numeric:!0},{text:Mj(r.costUSD),numeric:!0},{node:WZ(Lj(r[n],t[n])),className:`usage-share-cell`},{text:Nj(r.input),numeric:!0},{text:Nj(r.output),numeric:!0},{text:Nj(r.cacheCreate),numeric:!0},{text:Nj(r.cacheRead),numeric:!0}]),a.append(e)}return r.append(i),r}function _Q(){let e=Gae(Z?.sessions,SZ),t=Kae(e,CZ),n=Z?.totals||{},r=Fj(n),i=LZ(`By session`,Ij(r));if(e.length===0)return i.append(V(`p`,`usage-empty`,`No sessions.`)),i;let{wrap:a,body:o}=HZ([{label:`Session`,key:`label`},{label:`Tokens`,numeric:!0,key:`tokens`},{label:`Cost`,numeric:!0,key:`costUSD`},{label:`Share`,numeric:!0},{label:`Last activity`,numeric:!0,key:`lastTs`}],SZ,e=>{SZ=DM(SZ,e),xQ()},`session`);for(let e of t.rows){let t=V(`tr`,`usage-row`);xM(e)&&(t.dataset.managed=`true`);let i=SM(e),a=V(`span`,`usage-ago`,``);UZ(t,[{text:i,className:`usage-session-cell`,title:e.project?String(e.project):i},{text:Nj(e.tokens),numeric:!0},{text:Mj(e.costUSD),numeric:!0},{node:WZ(Lj(e[r],n[r])),className:`usage-share-cell`},{node:a,numeric:!0}]),IZ.track(a,Number(e.lastTs),nF),o.append(t)}return i.append(a),e.length>10&&i.append(vQ(t.hiddenCount)),i}function vQ(e){let t=V(`div`,`usage-overflow`),n=qae(e);n&&t.append(V(`p`,`usage-meta`,n));let r=V(`button`,`usage-toggle`,`All sessions`);return r.type=`button`,r.dataset.usageSessionsToggle=`true`,r.setAttribute(`aria-expanded`,CZ?`true`:`false`),r.addEventListener(`click`,()=>{wZ={kind:`sessions-toggle`},CZ=!CZ,xQ()}),t.append(r),t}function yQ(){let e=LZ(`Not available`,``);return e.append(V(`p`,`usage-empty`,yM(Z))),e.append(V(`p`,`usage-empty`,jie)),e}function bQ(){OZ=null,kZ=null,AZ=null,jZ=null,MZ=null,NZ=null,PZ=null,FZ=null}function xQ({force:e=!1}={}){if(!pZ||!e&&$d(pZ))return;let t=pZ.parentElement,n=t?t.scrollTop:0;IZ.reset(),bQ(),pZ.textContent=``,wQ(),t&&(t.scrollTop=n),SQ()}function SQ(){let e=wZ;if(wZ=null,!e)return;let t=CQ(e);if(!t||!pZ)return;let n=pZ.querySelector(t);n instanceof HTMLElement&&n.focus()}function CQ(e){return e.kind===`day`?`.usage-toggle[data-usage-day="${CSS.escape(e.day)}"]`:e.kind===`period`?`.usage-period-button[data-period-view="${CSS.escape(e.view)}"]`:e.kind===`sessions-toggle`?`.usage-toggle[data-usage-sessions-toggle="true"]`:e.kind===`sort`?`[data-usage-table="${CSS.escape(e.table)}"] .usage-sort[data-sort-key="${CSS.escape(e.key)}"]`:null}function wQ(){if(!pZ)return;pZ.append(XZ());let e=ZZ();if(bM(Z)){e&&pZ.append(e),pZ.append(yQ());return}if(!Z){e&&pZ.append(e),pZ.append(V(`p`,`usage-empty`,`Waiting for scan.`));return}let t=[e,cQ()].filter(e=>e!==null);pZ.append(TQ(`usage-band-now`,nQ(),t,{sideFirst:!0}));let n=[sQ()].filter(e=>e!==null);pZ.append(TQ(`usage-band-spend`,aQ(),n));let r=[iQ()].filter(e=>e!==null);pZ.append(TQ(`usage-band-trend`,lQ(),r));let i=eQ();i&&pZ.append(i),pZ.append(gQ(),_Q())}function TQ(e,t,n,{sideFirst:r=!1}={}){if(n.length===0)return t;let i=V(`div`,`usage-band ${e}`),a=V(`div`,`usage-band-col`);for(let e of n)a.append(e);return r?(i.append(a,t),i):(i.append(t,a),i)}function EQ(){mZ&&mZ(DZ.refresh())}function DQ(){DZ.acknowledge(),EQ()}function OQ(){PZ&&(PZ.disabled=vZ),FZ&&(FZ.textContent=vZ?`Refreshing`:``)}function kQ(e){vZ=e,OQ(),yZ&&=(clearTimeout(yZ),null),e&&(yZ=setTimeout(()=>{yZ=null,vZ=!1,OQ()},uZ))}function AQ(e){mZ=e,EQ()}function jQ(e){hZ=e}function MQ({force:e=!1}={}){if(!hZ)return;gZ=Md(`usage`);let t={type:`request-usage-report`,requestId:gZ};e&&(t.force=!0);let n=JZ(_Z);n!==null&&(t.days=n),kQ(!0),hZ(t)}function NQ(e){if(pZ)return pZ;let t=V(`div`,`usage-content`);return e.appendChild(t),pZ=t,IZ.ensure(),xQ({force:!0}),t}function PQ(){xQ({force:!0})}function FQ(e){dZ=e,Z&&!bM(Z)&&kZ?.isConnected?KZ():xQ()}function IQ(e){fZ=e,xQ(),EQ()}function LQ(e){Vae(e,gZ)&&(kQ(!1),Z=e,xQ(),EQ())}function RQ(){let e=Z?.pricing||(dZ?{source:dZ.pricingSource}:null),t=Iae(e?.fetchedAt),n=[Fae(e,t!==null&&t>0?nF(t):``)],r=yM(Z);r&&n.push(r);let i=zae(Z?.scan);return i&&n.push(i),n}var zQ=null,BQ=new Set;function VQ(){zQ?.setAttribute(`aria-pressed`,String(!CD()))}function HQ(e){wD(e),VQ();for(let t of BQ)t(e)}function UQ(e){BQ.add(e)}function WQ(e){zQ=e,VQ(),e.addEventListener(`click`,()=>HQ(!CD()))}var GQ=Object.freeze({fetch:`Fetch`,stage:`Stage`,install:`Install dependencies`,"link-deps":`Link dependencies`,build:`Build`}),KQ=Object.freeze({"branch-count-unavailable":`The last check could not compare the checked-out branch with its upstream.`,"branch-diverged":`The checked-out branch has diverged from its upstream.`,"fetch-failed":`The last update check could not fetch the upstream branch.`,"main-channel-requires-clone":`The main channel requires a clone install.`,"no-branch":`The last update check found no checked-out branch.`,"no-upstream":`The checked-out branch has no upstream.`,"release-already-checked-out":`The checkout already contains the latest release. Restart to run it.`,"release-check-failed":`The last release check failed.`,"remote-tip-unavailable":`The last update check could not resolve the upstream branch tip.`,"update-check-failed":`The last update check failed.`}),qQ=Object.freeze([`unsupported-flavor`,`unsupported-platform`]),JQ=`Not connected to the server. Reconnecting.`,YQ=Object.freeze({requested:!1,failure:null});function XQ(e,t){return t===`request-sent`?{requested:!0,failure:null}:t===`request-unsent`?{requested:!1,failure:JQ}:t===`progress-frame`?YQ:t===`error-frame`?e.requested?YQ:e:e.failure===null?e:{requested:e.requested,failure:null}}function ZQ(e,t){return t?.state?t.state:e?.journalSummary?.state}function QQ(e){return{enabled:!1,reason:e}}function $Q(){return{enabled:!0,reason:null}}function e$({status:e,journal:t,request:n=YQ}){let r=ZQ(e,t)===`running`||n.requested,i=r?QQ(`Wait for update staging to finish.`):$Q();if(n.failure)return{update:QQ(n.failure),restart:i};if(r)return{update:QQ(`Wait for the current update to finish.`),restart:i};if(!e)return{update:QQ(`Update status unavailable. Check for updates.`),restart:i};let a=e.applyRefusal;return a?{update:QQ(a.message),restart:i}:{update:$Q(),restart:i}}function t$(e){let t=e?.applyRefusal;return t===void 0?`command`:t===null?`link`:qQ.includes(t.reason)?`command`:`link`}function n$(e){let t=Ck(e,``);return t?`: ${t}`:``}function r$(e){return e.state===`staged`?`Update staged. Restart to hand it off${n$(e.reason)}.`:e.state===`succeeded`?`Update succeeded at restart${n$(e.reason)}.`:e.state===`failed`?`Update failed${n$(e.reason)}.`:e.state===`discarded`?`Update discarded${n$(e.reason)}.`:e.state===`interrupted`?`Update interrupted${n$(e.reason)}.`:null}function i$(e){return GQ[e]??e}function a$(e){let t=e.steps.find(t=>t.id===e.activeStep);if(t&&t.outputTail.length>0)return{stepId:t.id,lines:t.outputTail};let n=e.steps.findLast(e=>e.outputTail.length>0);return n?{stepId:n.id,lines:n.outputTail}:{stepId:null,lines:[]}}function o$(e){if(!e||e.state===`idle`)return null;let t=a$(e),n=t.stepId!==null&&t.stepId!==e.activeStep?t.stepId:null;return{state:e.state,terminalLine:r$(e),steps:e.steps.map(e=>({id:e.id,label:i$(e.id),status:e.status})),outputTail:t.lines,outputStepId:t.stepId,outputStepLabel:n===null?null:i$(n)}}var s$=6e5;function c$(e){return e.channel!==`main`||!Number.isInteger(e.behindCount)?``:`${e.behindCount} ${e.behindCount===1?`commit`:`commits`} behind`}function l$(e,t){let n=ZQ(e,t),r=_A(t?.toVersion,t?.toSha)||_A(e?.latest,e?.latestSha)||`the update`;if(n===`running`)return{tone:`running`,headline:`Updating to ${r}. Glimmervoid keeps running until the restart.`};if(n===`staged`)return{tone:`staged`,headline:`${r} is staged. Restart to finish updating.`};if(!e)return{tone:`unknown`,headline:`No update check has run yet.`};let i=_A(e.current,e.currentSha)||`an unknown version`;if(e.updateAvailable){let t=_A(e.latest,e.latestSha)||`a newer build`,n=c$(e);return{tone:`available`,headline:`Update available: ${i} to ${t}${n?` (${n})`:``}.`}}return Ck(e.reason,``)?{tone:`unknown`,headline:`Running ${i}. The last check did not finish.`}:{tone:`current`,headline:`Up to date. Running ${i}.`}}function u$(e){if(!e)return`Update status unavailable.`;let t=_A(e.current,null)||`Unknown version`,n=ol(e.currentSha,{validate:!0}),r=Ck(e.installedBranch,``);return[t,[n?`commit ${n}`:``,r?`on ${r}`:``].filter(Boolean).join(` `),e.isTreeClean===!0?`clean checkout`:e.isTreeClean===!1?`uncommitted local changes`:``].filter(Boolean).join(`, `)}function d$(e){return e?{label:_A(e.latest,e.latestSha)||`Latest target unknown`,behind:c$(e),releaseUrl:Ck(e.releaseUrl,``)}:{label:`Update status unavailable.`,behind:``,releaseUrl:``}}function f$({status:e,checkForUpdates:t,now:n,lastAutoCheckAt:r}){if(t===!1||r!==null&&n-r<s$)return!1;let i=typeof e?.lastCheckAt==`number`?e.lastCheckAt:null;return i===null||n-i>=s$}function p$({status:e,checkForUpdates:t,relativeTime:n}){if(t===!1)return`Update checks are off.`;if(!e)return`No update check has run.`;let r=Ck(e.reason,``);return r?KQ[r]??`The last update check failed: ${r}.`:e.flavor===`unknown`?`The install flavor is unknown.`:n}var m$=UE,h$=Object.freeze({sounds:()=>jb(),themes:$b});function g$(e){if(!e.optionsFrom)return e;let t=h$[e.optionsFrom]?.()??[];return{...e,options:t.map(e=>({value:e.id,label:e.label}))}}function _$(){return Object.freeze($Y.map(e=>({...e,settings:e.settings.map(g$)})))}var v$=_$(),y$=GX(v$),b$=Object.freeze({browser:`This browser`,machine:`Machine`,lanes:`Lanes`,projects:`Projects`}),x$=!1,S$=null,C$=null,w$=null,T$=null,E$=null,D$=null,O$=null,k$=null,A$=null,j$=null,M$=null,Q=y$[0],N$={},P$=[],F$=[],I$=new Map,L$=null,R$=null,z$=``,B$=``,V$=null,H$=null,U$=null,W$=null,G$=YQ,K$=()=>{},q$=e=>{e([])},J$=null,Y$=!1,X$=!1,Z$=null,Q$=new Set,$$=new Map;function e1(){return{themeId:ND(),flyingAnimalsEnabled:FD(),...TO(),soundEnabled:CD(),soundId:Mb(TD()),notificationsEnabled:DD(),compactStatusLabels:kD(),sessionUsageChips:jD()}}function t1(e){let t={...e,prefs:e1()};L$=NX(y$,t),R$=NX(y$,t)}function n1(e){return e.control===`readonly`?e.value:R$?.[e.path]??e.defaultValue}function goe(e){return e.settings.some(e=>!e.path.startsWith(`pref:`)&&JSON.stringify(L$?.[e.path])!==JSON.stringify(R$?.[e.path]))}function r1(e,t=null){return`#settings/${encodeURIComponent(e)}${t?`/${encodeURIComponent(t)}`:``}`}function i1(e,t=null){history.replaceState(history.state,``,r1(e,t))}function a1(e){requestAnimationFrame(()=>{let t=document.getElementById(e),n=t?.closest(`.settings-view-advanced-panel`);n&&(x$=!0,n.hidden=!1,M$?.querySelector(`.settings-view-advanced-toggle`)?.setAttribute(`aria-expanded`,`true`));let r=t?.closest(`.settings-view-setting`);r&&(r.scrollIntoView({block:`center`}),r.classList.remove(`settings-view-setting-flash`),requestAnimationFrame(()=>r.classList.add(`settings-view-setting-flash`)))})}function o1(){let e=XX(F$);y$=GX([...v$,...e]),Q=eZ(y$,Q?.id)??Q}function s1(e){let t=Array.isArray(e)?e:[];for(let e of t)typeof e?.id==`string`&&e.id&&I$.set(e.id,{...I$.get(e.id),...e});F$=QX(ZX(P$),[...I$.values()])}function c1(e){for(let t of Tre(db)){let n=V(`div`,`shortcut-group`);n.appendChild(V(`div`,`shortcut-group-title`,t.title));let r=V(`dl`,`shortcut-rows`);for(let e of t.items){let t=V(`dt`,`shortcut-keys`);e.combos.forEach((e,n)=>{n>0&&t.appendChild(V(`span`,`shortcut-sep`,`/`)),mb(t,e)}),r.append(t,V(`dd`,`shortcut-label`,e.label))}n.appendChild(r),e.appendChild(n)}}function l1(e){let t=V(`div`,`settings-about`),n=V(`span`,`settings-about-version`,`GLIMMERVOID `);n.appendChild(V(`span`,`settings-about-v`,`v0.35.1`));let r=V(`span`,`settings-about-links`),i=V(`a`,`settings-about-link`,`GitHub`);i.href=`https://github.com/${aY}`,i.target=`_blank`,i.rel=`noopener`;let a=V(`a`,`settings-about-link`,`Changelog`);a.href=`https://github.com/${aY}/blob/main/CHANGELOG.md`,a.target=`_blank`,a.rel=`noopener`,r.append(i,a),t.append(n,r),e.appendChild(t)}function u1(e){R$&&R$[`pref:soundEnabled`]!==e&&(R$[`pref:soundEnabled`]=e,L$&&(L$[`pref:soundEnabled`]=e),n0())}function d1(){for(let[e,t]of Object.entries(TO()))L$&&(L$[`pref:${e}`]=t),R$&&(R$[`pref:${e}`]=t)}var f1={"pref:flyingAnimalsMinGapSeconds":e=>_O(Number(e)),"pref:flyingAnimalsMaxGapSeconds":e=>vO(Number(e)),"pref:flyingAnimalsMinDurationSeconds":e=>yO(Number(e)),"pref:flyingAnimalsMaxDurationSeconds":e=>bO(Number(e)),"pref:flyingAnimalsScale":e=>xO(Number(e)),"pref:flyingAnimalsOnPhone":e=>SO(e===!0)};function p1(e,t){if(e.path===`pref:compactStatusLabels`){AD(t===!0),Xb(t===!0);return}if(e.path===`pref:sessionUsageChips`){MD(t===!0),Zb(t===!0);return}if(e.path===`pref:themeId`){PD(t),Yb(t);return}if(e.path===`pref:flyingAnimalsEnabled`){ID(t),rY(t);return}let n=f1[e.path];if(n){let r=zX([Q],R$??{},m$);if(r[e.id])return;n(t);let i=VX([Q],e),a=i&&f1[i.path];i&&a&&!r[i.id]&&a(R$?.[i.path]),rY(FD())}else e.path===`pref:soundEnabled`?HQ(t===!0):e.path===`pref:soundId`?(ED(t),Ub(t)):e.path===`pref:notificationsEnabled`&&(OD(t),t&&IJ().then(n0))}function m1(){if(!M$||!R$)return;M$.querySelector(`.settings-view-footer`)?.remove();let e=G1(zX([Q],R$,m$));e&&M$.appendChild(e)}function h1(e,t,{rerender:n=!0}={}){R$&&(R$[e.path]=t,z$=``,e.path.startsWith(`pref:`)&&L$&&(L$[e.path]=t,p1(e,t)),n?n0():(m1(),C0()))}function g1(e,t){if(!t.exclusiveMin)return t.min;if(e.integer!==!1)return t.min+1}function _1(e){let t=V(`div`,`settings-view-toggle-wrap`),n=V(`label`,`settings-view-toggle`),r=V(`input`,`settings-view-checkbox`);return r.type=`checkbox`,r.checked=n1(e)===!0,e.id===`desktop-notifications`&&!PJ()&&(r.checked=!1,r.disabled=!0),r.setAttribute(`aria-labelledby`,e.id),r.addEventListener(`change`,()=>h1(e,r.checked)),n.append(r,V(`span`,`settings-view-toggle-state`,r.checked?`On`:`Off`)),t.appendChild(n),t}function v1(e){let t=V(`input`,`settings-view-input`);t.type=e.control??`text`,t.value=String(n1(e)??``),e.control===`password`&&(t.placeholder=`No credential stored`);let n=uX(e,N$);return n&&(t.disabled=!0,t.setAttribute(`aria-description`,`Supplied by ${n}`)),t.autocomplete=`off`,t.spellcheck=!1,t.setAttribute(`aria-labelledby`,e.id),t.addEventListener(`input`,()=>h1(e,t.value,{rerender:!1})),t}function y1(e){let t=V(`input`,`settings-view-input`),n=m$[e.range??``];t.type=`number`,t.value=String(n1(e)??``),t.step=String(e.step??1);let r=g1(e,n);return r!=null&&(t.min=String(r)),n.max!=null&&(t.max=String(n.max)),t.autocomplete=`off`,t.setAttribute(`aria-labelledby`,e.id),e.commitOnChange?(t.addEventListener(`change`,()=>h1(e,t.value.trim()===``?e.defaultValue:t.value)),t):(t.addEventListener(`input`,()=>h1(e,t.value,{rerender:!1})),t)}function b1(e){let t=V(`select`,`settings-view-input`);t.setAttribute(`aria-labelledby`,e.id);for(let n of e.options){let e=V(`option`,null,n.label);e.value=n.value,t.appendChild(e)}return t.value=String(n1(e)),t.addEventListener(`change`,()=>h1(e,t.value)),t}function x1(e){let t=V(`div`,`settings-view-list`),n=n1(e),r=Array.isArray(n)?n:[];r.length===0&&t.appendChild(V(`div`,`settings-empty`,e.listEmptyText??`No repository roots configured.`));for(let[n,i]of r.entries()){let a=V(`div`,`settings-root-item`),o=V(`span`,`settings-root-path`,i);o.title=i;let s=V(`button`,`btn-settings-remove`,`×`);s.type=`button`,s.title=`Remove`,s.setAttribute(`aria-label`,`Remove ${i}`),s.addEventListener(`click`,()=>{h1(e,r.filter((e,t)=>t!==n))}),a.append(o,s),t.appendChild(a)}let i=V(`div`,`settings-add-row`),a=V(`input`,`settings-view-input settings-root-input`);a.type=`text`,a.autocomplete=`off`,a.spellcheck=!1,a.placeholder=e.listPlaceholder??`Repository root path`;let o=V(`button`,`btn-dialog btn-dialog-confirm btn-settings-add`,`Add`);o.type=`button`;let s=()=>{let t=a.value.trim();t&&(oX(r,t,N$.repositoryRootCaseInsensitive===!0)||h1(e,[...r,t]))};return o.addEventListener(`click`,s),a.addEventListener(`keydown`,e=>{e.key===`Enter`&&(e.preventDefault(),s())}),i.append(a,o),t.appendChild(i),t}function S1(e){let t=V(`div`,`settings-view-projects`),n=n1(e),r=new Set(Array.isArray(n)?n:[]),i=Array.isArray(N$.projectChoices)?N$.projectChoices:[];i.length===0&&t.appendChild(V(`div`,`settings-empty`,`No configured projects are available.`));for(let n of aX(i,[...r])){let i=V(`label`,`settings-view-project-choice`),a=V(`input`,`settings-view-checkbox`);a.type=`checkbox`,a.checked=r.has(n.id),a.addEventListener(`change`,()=>{let t=new Set(r);a.checked&&t.add(n.id),a.checked||t.delete(n.id),h1(e,[...t])}),i.append(a,document.createTextNode(n.name)),t.appendChild(i)}return t}function C1(e){let t=V(`div`,`settings-view-file-only`);return t.append(V(`code`,`settings-view-key-path`,e.path)),t.append(V(`span`,`settings-view-file-caption`,`Configured in config.json`)),t}function w1(){let e=l$(U$,W$),t=V(`div`,`settings-readonly settings-update-readout settings-update-summary`,e.headline);return t.dataset.tone=e.tone,t}function T1(){return V(`div`,`settings-readonly settings-update-readout`,u$(U$))}function E1(){let e=d$(U$),t=V(`div`,`settings-readonly settings-update-readout`);if(t.appendChild(V(`span`,`settings-update-latest-label`,e.label)),e.behind&&t.appendChild(V(`span`,`settings-update-behind`,e.behind)),!e.releaseUrl)return t;let n=V(`a`,`settings-link`,`View release`);return n.href=e.releaseUrl,n.target=`_blank`,n.rel=`noopener noreferrer`,t.appendChild(n),t}function D1(){let e=typeof U$?.lastCheckAt==`number`?U$.lastCheckAt:null,t=V(`div`,`settings-readonly settings-update-readout`,p$({status:U$,checkForUpdates:N$.checkForUpdates,relativeTime:nF(e)}));return e&&(t.title=new Date(e).toLocaleString()),t}function O1(e,t,{decision:n={enabled:!0,reason:null},isPrimary:r=!1}={}){let i=V(`button`,`btn-dialog ${r?`btn-dialog-confirm`:`btn-dialog-cancel`} settings-update-button`,e);return i.type=`button`,i.disabled=!n.enabled,i.addEventListener(`click`,t),i}function k1(e){let t=V(`span`,`settings-update-action-status`,e??``);return t.setAttribute(`role`,`status`),t}function A1(e){let t=XQ(G$,e);t!==G$&&(G$=t,w0())}function j1({restartWhenStaged:e,confirmedSessionIds:t}){A1(B({type:`update-apply`,restartWhenStaged:e,confirmedSessionIds:t})?`request-sent`:`request-unsent`)}function M1(){J$=Date.now();let e=B({type:`update-check`});X$=e,Z$=e?null:JQ,w0()}function N1(){return X$?`Checking for updates.`:Z$}function P1(){U$?(Y$=!1,f$({status:U$,checkForUpdates:N$.checkForUpdates,now:Date.now(),lastAutoCheckAt:J$})&&M1()):Y$=!0}function F1(){let e=e$({status:U$,journal:W$,request:G$}),t=V(`div`,`settings-update-actions settings-update-readout`),n=V(`div`,`settings-update-buttons`);n.append(O1(`Update and restart`,()=>q$(e=>j1({restartWhenStaged:!0,confirmedSessionIds:e})),{decision:e.update,isPrimary:!0}),O1(`Update without restart`,()=>j1({restartWhenStaged:!1}),{decision:e.update}),O1(`Check for updates`,M1,{decision:{enabled:!X$,reason:null}}),O1(`Restart`,K$,{decision:e.restart})),t.append(n,k1(e.update.reason));let r=N1();return r&&t.append(k1(r)),t}function I1(e){return e.status===`update-summary`?w1():e.status===`update-installed`?T1():e.status===`update-latest`?E1():e.status===`update-last-checked`?D1():e.status===`update-actions`?F1():V(`div`,`settings-readonly`,String(e.value||`Not configured`))}function L1(e){return e.fileOnly?C1(e):e.control===`readonly`?I1(e):e.control===`toggle`?_1(e):e.control===`number`?y1(e):e.control===`select`?b1(e):e.control===`list`?x1(e):e.control===`projects`?S1(e):v1(e)}function R1(e){let t=uX(e,N$);return t?`Supplied by ${t}. Change the server environment and restart to replace this credential.`:e.status===`visions-activity-limit`?fX(R$||{}):e.id===`desktop-notifications`&&!PJ()?`Desktop notifications are unavailable for this page.`:e.id===`desktop-notifications`&&n1(e)&&FJ()===`denied`?`Blocked by the browser. Allow notifications for this site to enable them.`:e.status!==`rtk-install`||!n1(e)||N$.rtkAvailable?``:pX(N$)}function z1(e){if(e.status===`custom-agents`)return J1();if(e.status===`workflows`)return Q1();if(e.status===`usage-last-report`)return $1();if(e.status===`update-actions`)return B1();if(e.status?.startsWith(`update-`))return null;let t=R1(e);return t?V(`div`,`settings-view-warning settings-view-status-slot`,t):null}function B1(){let e=o$(W$);if(!e)return null;let t=V(`div`,`settings-update-progress settings-view-status-block settings-view-status-slot`);t.dataset.state=e.state,t.setAttribute(`role`,`status`),e.terminalLine&&t.appendChild(V(`div`,`settings-update-terminal`,e.terminalLine));let n=V(`ol`,`settings-update-steps`);for(let t of e.steps){let e=V(`li`,`settings-update-step`);e.dataset.status=t.status,e.append(V(`span`,`settings-update-step-state`,t.status),V(`span`,`settings-update-step-label`,t.label)),n.appendChild(e)}if(t.appendChild(n),e.outputTail.length===0)return t;let r=V(`pre`,`settings-update-output`,e.outputTail.join(`
|
|
247
247
|
`));if(e.outputStepId&&(r.dataset.step=e.outputStepId),!e.outputStepLabel)return t.appendChild(r),t;let i=`Output from ${e.outputStepLabel}`;return r.setAttribute(`aria-label`,i),t.append(V(`div`,`settings-update-output-label`,i),r),t}function V1(e){let t=V(`div`,`settings-view-setting-heading`),n=V(`h2`,`settings-view-setting-title`,e.title);n.id=e.id,n.addEventListener(`click`,()=>i1(Q.id,e.id));let r=V(`button`,`settings-view-copy-link`,`#`);r.type=`button`,r.setAttribute(`aria-label`,`Copy link`);let i=V(`span`,`settings-view-copy-status`);return i.setAttribute(`role`,`status`),r.addEventListener(`click`,async()=>{let t=new URL(r1(Q.id,e.id),location.href).href;try{await navigator.clipboard.writeText(t),i.textContent=`Link copied`}catch{i.textContent=`Copy failed`}setTimeout(()=>{i.textContent=``},1600)}),t.append(n,r,i),t}function H1(e,t){let n=V(`article`,`settings-view-setting`);n.append(V1(e),V(`p`,`settings-view-setting-description`,e.description)),n.appendChild(L1(e)),e.id===`compact-status`&&n.appendChild(VJ()),$X(e,n1(e))&&n.appendChild(V(`div`,`settings-view-warning settings-warning`,e.warning));let r=z1(e);return r&&n.appendChild(r),t[e.id]&&n.appendChild(V(`div`,`settings-view-field-error`,t[e.id])),n}function U1(){if(R$&&L$){for(let e of Q.settings)R$[e.path]=structuredClone(L$[e.path]);z$=``,n0()}}async function W1(){let e=Q,t=[e],n=zX(t,R$??{},m$);if(Object.keys(n).length>0){z$=`Fix the highlighted settings before saving.`,n0();return}let r=rX(FX(t,L$??{},R$??{}));if(Object.keys(r).length!==0)try{let t=await Nd(`update-settings`,{settings:r});if(t.type===`settings-error`){if(Q!==e)return;z$=String(t.message),n0();return}t.settings&&b0(t.settings,{rehydrateSectionIds:[e.id]})}catch(t){if(Q!==e)return;z$=t?.message||`Failed to save settings.`,n0()}}function G1(e){let t=goe(Q);if(Q.level===`browser`||!t&&!z$)return null;let n=V(`footer`,`settings-view-footer`),r=V(`div`,`settings-view-footer-error`,z$);if(r.setAttribute(`role`,`status`),n.appendChild(r),!t)return n;let i=V(`div`,`settings-view-footer-actions`),a=V(`button`,`btn-dialog btn-dialog-cancel`,`Revert`);a.type=`button`,a.addEventListener(`click`,U1);let o=V(`button`,`btn-dialog btn-dialog-confirm`,`Save`);return o.type=`button`,o.disabled=Object.keys(e).length>0,o.addEventListener(`click`,W1),i.append(a,o),n.appendChild(i),n}function K1(e){return e===null?`not probed yet`:e?`resolved`:`not found on PATH`}function q1(){let e=Array.isArray(N$.customAgents)?N$.customAgents:[];return e.length===0?[`None declared. Add customAgents to config.json.`]:e.map(e=>{let t=e.args.length>0?`${e.command} ${e.args.join(` `)}`:e.command;return`${e.id} ${e.label} ${t} ${K1(e.resolvable)}`})}function J1(){let e=V(`div`,`settings-view-status-block settings-view-status-slot`);e.appendChild(V(`div`,`settings-section-title`,`Declared agents`));for(let t of q1())e.appendChild(V(`div`,`settings-readonly`,t));return e}async function Y1(e,t){Q$.add(e.id),$$.delete(e.id),C0();try{let n=await Nd(`update-settings`,{settings:{workflows:{rules:[{id:e.id,enabled:t}]}}});if(n.type===`settings-error`&&$$.set(e.id,String(n.message)),Q$.delete(e.id),n.type!==`settings-error`&&n.settings){b0(n.settings);return}}catch(t){$$.set(e.id,t?.message||`Failed to save the rule.`)}Q$.delete(e.id),C0()}function X1(e){return Q$.has(e.id)?`Saving`:$$.get(e.id)??``}function Z1(e){let t=V(`div`,`settings-view-toggle-wrap`),n=V(`label`,`settings-view-toggle`),r=V(`input`,`settings-view-checkbox`);r.type=`checkbox`,r.checked=e.isEnabled,r.disabled=Q$.has(e.id),r.setAttribute(`aria-label`,`Run rule ${e.name}`),r.addEventListener(`change`,()=>{Y1(e,r.checked)}),n.append(r,V(`span`,`settings-view-toggle-state`,e.isEnabled?`On`:`Off`),V(`span`,`settings-readonly`,`${e.name} ${e.summary}`));let i=V(`span`,`settings-view-copy-status`,X1(e));return i.setAttribute(`role`,`status`),t.append(n,i),t}function Q1(){let e=V(`div`,`settings-view-status-block settings-view-status-slot`);e.appendChild(V(`div`,`settings-section-title`,`Rules`));let t=nX(N$.workflows);if(t.length>0){for(let n of t)e.appendChild(Z1(n));return e}for(let t of tX(N$.workflows))e.appendChild(V(`div`,`settings-readonly`,t));return e}function $1(){let e=V(`div`,`settings-view-status-block settings-view-status-slot`);e.appendChild(V(`div`,`settings-section-title`,`Last report`));let t=RQ();for(let n of t)e.appendChild(V(`div`,`settings-readonly`,n));return e}function e0(){let e=V(`button`,`btn-dialog btn-dialog-cancel`,`Reset to defaults`);return e.type=`button`,e.addEventListener(`click`,()=>{EO(),d1(),rY(FD()),n0()}),e}function t0(e,t){let n=V(`div`,`settings-view-advanced`),r=V(`button`,`dialog-advanced-toggle settings-view-advanced-toggle`,`Advanced`);r.type=`button`,r.setAttribute(`aria-expanded`,String(x$)),r.setAttribute(`aria-controls`,`settings-view-advanced-panel`);let i=V(`div`,`dialog-advanced-panel settings-view-advanced-panel`);i.id=`settings-view-advanced-panel`,i.hidden=!x$,r.addEventListener(`click`,()=>{x$=!x$,i.hidden=!x$,r.setAttribute(`aria-expanded`,String(x$))});for(let n of e)i.append(H1(n,t));return Q.id===`browser-flying-animals`&&i.append(e0()),n.append(r,i),n}function n0(){if(!M$||!R$)return;M$.textContent=``;let e=V(`header`,`settings-view-section-header`),t=V(`div`,`settings-view-title-row`),n=V(`h1`,`settings-view-section-title`,Q.title);if(n.tabIndex=-1,n.addEventListener(`click`,()=>i1(Q.id)),t.append(n),t.append(V(`span`,`settings-view-level`,b$[Q.level]||Q.level)),e.append(t,V(`p`,`settings-view-section-description`,Q.description)),Q.caption&&e.appendChild(V(`p`,`settings-view-section-caption`,Q.caption)),M$.appendChild(e),Q.id===`browser-shortcuts`){let e=V(`div`,`shortcut-groups settings-view-shortcuts`);c1(e),M$.appendChild(e),M$.appendChild(cZ()),M$.appendChild(lZ()),l1(M$);return}let r=zX([Q],R$,m$),i=V(`div`,`settings-view-stack`);for(let e of Q.settings.filter(e=>!e.advanced))i.appendChild(H1(e,r));Q.id===`browser-flying-animals`&&i.append(iY());let a=Q.settings.filter(e=>e.advanced);a.length>0&&i.append(t0(a,r));for(let e of Q.unattendedLinks||[]){let t=V(`div`,`settings-view-unattended-link`);t.append(document.createTextNode(`${e.title}: `));let n=V(`a`,null,`Enabled in Unattended actions`);n.href=r1(`lanes-unattended`,e.settingId),t.appendChild(n),i.appendChild(t)}M$.appendChild(i);let o=G1(r);o&&M$.appendChild(o)}function r0(e,{focusContent:t=!1,settingId:n=null,updateHash:r=!0}={}){Q.id!==e&&(x$=!1),Q=eZ(y$,e)??Q,z$=``,i0(T$),i0(A$),O$&&(O$.textContent=Q.title,D$&&(D$.title=Q.title)),k$&&(k$.textContent=b$[Q.level]||Q.level),n0(),h0(Q)&&m0(),Q.id===`machine-updates`&&P1(),r&&i1(Q.id,n),n&&a1(n),t&&M$?.querySelector(`h1`)?.focus()}function i0(e){for(let t of e?.querySelectorAll(`[data-settings-section]`)||[]){let e=t.dataset.settingsSection===Q.id;t.setAttribute(`aria-current`,e?`page`:`false`)}}function a0(e){u0(!1),E$&&(E$.value=``,B$=``,d0(),r0(e.section.id,{settingId:e.setting.id}))}function o0(e,t){if(t.length===0){e.appendChild(V(`div`,`settings-empty settings-view-search-empty`,`No settings found.`));return}let n=new Map;for(let e of t)n.has(e.section.id)||n.set(e.section.id,[]),n.get(e.section.id)?.push(e);for(let t of n.values()){let n=t[0].section,r=V(`div`,`settings-view-nav-group`);r.appendChild(V(`div`,`settings-view-nav-label`,`${n.title} (${b$[n.level]})`));for(let e of t){let t=V(`button`,`settings-view-nav-item settings-view-search-result`,e.setting.title);t.type=`button`,t.addEventListener(`click`,()=>a0(e)),r.appendChild(t)}e.appendChild(r)}}function s0(e,t,{groupClassName:n,headingClassName:r,createButton:i}){for(let a of[`browser`,`machine`,`lanes`,`projects`]){if(t[a].length===0)continue;let o=V(`div`,n);o.appendChild(V(`div`,r,b$[a]));for(let e of t[a])o.appendChild(i(e));e.appendChild(o)}}function c0(e){A$&&(A$.textContent=``,s0(A$,e,{groupClassName:`settings-view-section-picker-group`,headingClassName:`settings-view-section-picker-heading`,createButton(e){let t=V(`button`,`settings-view-section-option`,e.title);return t.type=`button`,t.dataset.settingsSection=e.id,t.addEventListener(`click`,()=>{u0(!1),r0(e.id)}),t}}),i0(A$))}function l0(){return!!A$&&!A$.hidden}function u0(e,{returnFocus:t=!0}={}){if(!A$||!D$)return;let n=l0();A$.hidden=!e,D$.setAttribute(`aria-expanded`,String(e)),e?(c0(HX(y$)),requestAnimationFrame(()=>{let e=A$?.querySelector(`[aria-current="page"]`);e instanceof HTMLElement&&e.focus()})):t&&n&&D$.focus()}function d0(){if(!T$||!j$||!w$)return;let e=HX(y$);if(T$.textContent=``,j$.textContent=``,w$.dataset.searching=String(!!B$),j$.hidden=!B$,B$){let e=UX(y$,B$);o0(T$,e),o0(j$,e)}else s0(T$,e,{groupClassName:`settings-view-nav-group`,headingClassName:`settings-view-nav-label`,createButton(e){let t=V(`button`,`settings-view-nav-item`,e.title);return t.type=`button`,t.dataset.settingsSection=e.id,t.addEventListener(`click`,()=>r0(e.id)),t}}),c0(e),r0(Q.id,{updateHash:!1})}function f0(e){if(B$&&e.key===`Enter`){let t=UX(y$,B$)[0];if(!t)return;e.preventDefault(),a0(t);return}if(e.key===`Escape`&&B$){if(!E$)return;e.preventDefault(),E$.value=``,B$=``,d0(),E$.focus();return}if(e.key!==`ArrowUp`&&e.key!==`ArrowDown`||!T$)return;let t=[...T$.querySelectorAll(`[data-settings-section]`)].filter(e=>e instanceof HTMLElement),n=document.activeElement;if(!(n instanceof HTMLElement))return;let r=t.indexOf(n);r<0||(e.preventDefault(),t[(r+(e.key===`ArrowDown`?1:-1)+t.length)%t.length].focus())}function p0(e,{onRestart:t=()=>{},onConfirmUpdateAndRestart:n=e=>{e([])}}={}){K$=t,q$=n,UQ(u1),S$=e,S$.textContent=``,w$=V(`div`,`settings-view-shell`);let r=V(`div`,`settings-view-sidebar`);E$=V(`input`,`settings-view-search`),E$.type=`search`,E$.placeholder=`Search settings`,E$.setAttribute(`aria-label`,`Search settings`),T$=V(`nav`,`settings-view-nav`),T$.setAttribute(`role`,`navigation`),T$.setAttribute(`aria-label`,`Settings sections`),D$=V(`button`,`settings-view-section-button`),D$.type=`button`,D$.setAttribute(`aria-expanded`,`false`),D$.setAttribute(`aria-controls`,`settings-section-picker`),O$=V(`span`,`settings-view-section-button-title`),k$=V(`span`,`settings-view-section-button-level`);let i=V(`span`,`settings-view-section-button-chevron`,`⌄`);i.setAttribute(`aria-hidden`,`true`),D$.append(O$,k$,i),A$=V(`div`,`settings-view-section-picker`),A$.id=`settings-section-picker`,A$.hidden=!0,A$.setAttribute(`role`,`dialog`),A$.setAttribute(`aria-label`,`Settings sections`),j$=V(`nav`,`settings-view-phone-results`),j$.hidden=!0,j$.setAttribute(`aria-label`,`Settings search results`),M$=V(`div`,`settings-view-content`),M$.setAttribute(`aria-live`,`polite`),E$.addEventListener(`input`,()=>{let e=E$;e&&(B$=e.value.trim(),d0())}),E$.addEventListener(`keydown`,f0),T$.addEventListener(`keydown`,f0),j$.addEventListener(`keydown`,f0),D$.addEventListener(`click`,()=>u0(!l0())),V$&&document.removeEventListener(`click`,V$),H$&&document.removeEventListener(`keydown`,H$),V$=e=>{l0()&&e.target instanceof Node&&(A$?.contains(e.target)||D$?.contains(e.target)||u0(!1))},H$=e=>{e.key===`Escape`&&l0()&&(e.preventDefault(),u0(!1))},document.addEventListener(`click`,V$),document.addEventListener(`keydown`,H$),r.append(E$,D$,T$,A$),w$.append(r,j$,M$),S$.appendChild(w$),t1(N$),d0(),m0(),C$?.disconnect(),C$=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&m0()}),C$.observe(S$)}function m0(){Nb().then(g0)}function h0(e){return e.settings.some(e=>e.path===`pref:soundId`)}function g0(){v$=_$(),o1();let e=Mb(TD());L$&&(L$[`pref:soundId`]=e),R$&&(R$[`pref:soundId`]=e),h0(Q)&&n0()}function _0({returnFocus:e=!0}={}){u0(!1,{returnFocus:e})}function v0(e=null,t=null){r0(e||Q.id,{settingId:t})}function y0(e){return WX(e,y$,ZY,QY)}function b0(e,t={}){let{rehydrateSectionIds:n=[]}=t;if(!e)return;N$=e,P$=Array.isArray(N$.projectChoices)?N$.projectChoices:[],s1(N$.projectChoices),o1();let r={...N$,prefs:e1()},i=PX(y$,r,L$,R$,{rehydrateSectionIds:n});L$=i.original,R$=i.edited,z$=``,T$&&d0(),n0()}function x0(e){return document.getElementById(e.id)?.closest(`.settings-view-setting`)??null}function S0(e,t){let n=t.querySelector(`.settings-view-status-slot`),r=z1(e);n&&r&&n.replaceWith(r),n&&!r&&n.remove(),!n&&r&&t.appendChild(r)}function C0(){for(let e of Q.settings||[]){if(!e.status)continue;let t=x0(e);t&&S0(e,t)}}function w0(){if(Q.id===`machine-updates`)for(let e of Q.settings||[]){if(!e.status?.startsWith(`update-`))continue;let t=x0(e);t&&(t.querySelector(`.settings-update-readout`)?.replaceWith(L1(e)),S0(e,t))}}function T0(e){U$=e,X$=!1,Z$=null,G$=XQ(G$,`status-frame`),w0(),Y$&&Q.id===`machine-updates`&&P1()}function E0(e){W$=e,G$=XQ(G$,`progress-frame`),w0()}function D0(){A1(`error-frame`),X$&&(X$=!1,w0())}function O0(e){s1(e),o1(),T$&&d0()}function k0(){Q.id===`browser-flying-animals`&&n0()}window.matchMedia(`(prefers-reduced-motion: reduce)`).addEventListener(`change`,k0),yf(k0);function A0(e){return[...e||[]].map((e,t)=>({row:e,index:t})).sort((e,t)=>yj(e.row||{},`phone-triage`)-yj(t.row||{},`phone-triage`)||e.index-t.index).map(e=>e.row)}var j0=new Set;function M0(e,t,n){let r=lU(e,t,n),i=r.groups.map(e=>({...e,rows:A0(e.rows)})),a={...r,groups:i};return{...a,visibleIds:uU(a,j0)}}var N0=e=>e.ui.path;function P0({onSelectSession:e}){let t=V(`div`,`phone-board`),n=V(`header`,`phone-topbar`),r=V(`div`,`phone-attention`);r.setAttribute(`role`,`status`),r.setAttribute(`aria-live`,`polite`);let i=V(`div`,`phone-calm calm-view`);i.hidden=!0;let a=V(`div`,`phone-board-list`),o=V(`div`,`phone-empty`);o.append(V(`p`,`phone-empty-title`,`No sessions`),V(`p`,`phone-empty-desc`,`Spawn a session to start watching.`)),t.append(n,r,i,a,o);let s=new Map,c=new Map,l=new WeakMap,u=new WeakMap,d=new WeakMap,f=0;Yd(n);function p(t){let n=V(`button`,`phone-row`);n.type=`button`,n.dataset.id=t,n.innerHTML=`<span class="phone-row-glyph" aria-hidden="true"></span><span class="phone-row-main"><span class="phone-row-name"></span><span class="phone-row-meta"><span class="phone-row-badge"></span><span class="phone-row-merge"></span></span></span><span class="phone-row-elapsed" aria-hidden="true"></span>`;let r={glyph:H(n,`.phone-row-glyph`,`span`),name:H(n,`.phone-row-name`,`span`),badge:H(n,`.phone-row-badge`,`span`),merge:H(n,`.phone-row-merge`,`span`),elapsed:H(n,`.phone-row-elapsed`,`span`)};n.addEventListener(`click`,()=>e?.(t));let i=V(`div`,`phone-row-item`);i.setAttribute(`role`,`listitem`);let a=V(`button`,`phone-row-remove`,`x`);return a.type=`button`,a.title=`Remove session`,a.setAttribute(`aria-label`,`Remove session`),a.addEventListener(`click`,e=>{e.stopPropagation(),II(t)}),i.append(n,a),l.set(n,{refs:r,item:i}),n}function m(e){let t=V(`section`,`phone-board-group`);t.dataset.key=e;let n=V(`div`,`phone-board-group-header`),r=V(`span`,`phone-board-group-label`),i=V(`span`,`phone-board-group-count`),a=V(`button`,`phone-board-group-add`,`+`);a.type=`button`,a.addEventListener(`click`,()=>FI(t.dataset.path,t.dataset.label));let o=V(`button`,`phone-board-group-forget`,`x`);o.type=`button`,o.addEventListener(`click`,()=>{wI(t.dataset.path),b()});let s=V(`div`,`phone-board-group-rows`);return s.setAttribute(`role`,`list`),n.append(r,i,o,a),t.append(n,s),u.set(t,{header:n,label:r,count:i,addButton:a,forgetButton:o,rows:s}),t}function h(e,t){let n=l.get(e);if(!n)return;let{ui:r,state:i,unseen:a}=t,{glyph:o,label:s,isMonitoring:c}=Jd(i,r.awaitingBackgroundTasks),u=r.pendingPromptKind===`plan`?`Plan ready`:s,d=t.name;e.dataset.state=i,e.toggleAttribute(`data-monitoring`,c),e.dataset.prompt=r.pendingPromptKind??``,e.toggleAttribute(`data-unseen`,a),n.refs.glyph.textContent=o,n.refs.name.textContent=d;let f=V(`span`,`session-list-task-title`,r.taskTitle??``);n.refs.name.append(f),n.refs.name.title=[d,r.taskTitle].filter(Boolean).join(` | `),n.refs.badge.textContent=u;let p=r.card?.dataset.merge||``;e.dataset.merge=p,n.refs.merge.textContent=Kd[p]||``,n.refs.elapsed.textContent=sp(r),e.setAttribute(`aria-label`,`${d}, ${u}`)}function g(e,t){let n=u.get(e);if(!n)return;let{header:r,label:i,count:a,addButton:o,forgetButton:s,rows:c}=n,l=t.key===sU,d=t.rows.length===0;e.dataset.path=t.key,e.dataset.label=t.label,e.toggleAttribute(`data-empty`,d),r.title=t.title,i.textContent=t.label,a.textContent=String(t.rows.length),a.title=`${t.rows.length} ${t.rows.length===1?`session`:`sessions`}`,o.hidden=l,s.hidden=l||!d,l||(o.title=`Add a session to ${t.label}`,o.setAttribute(`aria-label`,`Add a session to ${t.label}`)),!l&&d&&(s.title=`Remove ${t.label} from the Board`,s.setAttribute(`aria-label`,`Remove ${t.label} from the Board`)),c.setAttribute(`aria-label`,`${t.label} sessions`)}let{noteStates:_,acknowledge:v,isUnseen:y}=pU();function ee(){let e=PI();_(e);for(let t of e)t.unseen=y(t.id);return bj(e)}function b(){let e=ee(),t=M0(e,N0,CI(e,N0));f=wj(e),r.textContent=Tj(f),r.toggleAttribute(`data-lit`,f>0);let n=new Set(t.order),i=t.order.join(`,`),_=d.get(a)===i&&a.childElementCount===t.groups.length;for(let e of t.groups){let t=c.get(e.key);t||(t=m(e.key),c.set(e.key,t)),g(t,e),_||a.appendChild(t);let n=e.rows.map(e=>e.id).join(`,`),r=u.get(t);if(!r)continue;let i=d.get(r.rows)===n&&r.rows.childElementCount===e.rows.length;for(let t of e.rows){let e=s.get(t.id);e||(e=p(t.id),s.set(t.id,e)),h(e,t);let n=l.get(e);n&&(i||r.rows.appendChild(n.item))}d.set(r.rows,n)}d.set(a,i);for(let[e,t]of[...c])n.has(e)||(t.remove(),c.delete(e));let v=new Set(t.visibleIds);for(let[e,t]of[...s]){if(v.has(e))continue;let n=l.get(t);n&&n.item.remove(),s.delete(e)}let y=t.groups.length>0;a.hidden=!y,o.hidden=y}up(()=>{for(let[e,t]of s){let n=U.get(e),r=l.get(t);n&&r&&(r.refs.elapsed.textContent=sp(n))}});function te(e){i.hidden=!e,t.toggleAttribute(`data-calm`,e)}return{el:t,topBarEl:n,calmEl:i,setCalmShown:te,refresh:b,acknowledge:v,getAttentionCount:()=>f}}var F0=`glimmervoidCalmSheet`,I0=Object.freeze({[F0]:!0});function L0(e){return typeof e!=`object`||!e?!1:F0 in e}function R0({poppedState:e,isCalmSheetOpen:t,isOwnSheetPopPending:n}){if(n)return`own-sheet-pop`;let r=L0(e);return r&&t?`adopt-sheet-entry`:r?`consume-stray-sheet-entry`:t?`close-sheet`:`navigate`}function z0({pushedEntry:e,isOwnSheetPopPending:t}){return e===`none`?t?`defer-until-own-pop`:`push-sheet-entry`:`keep-history`}function B0({pushedEntry:e,topState:t,isOwnSheetPopPending:n}){return!n&&e===`calm-sheet`&&L0(t)}var V0=`clipboard`,H0=`upload`,U0=Object.freeze([Object.freeze({id:`esc`,label:`Esc`,bytes:`\x1B`,title:`Send Escape`}),Object.freeze({id:`tab`,label:`Tab`,bytes:` `,title:`Send Tab`}),Object.freeze({id:`up`,label:`Up`,bytes:`\x1B[A`,title:`Arrow up`}),Object.freeze({id:`down`,label:`Down`,bytes:`\x1B[B`,title:`Arrow down`}),Object.freeze({id:`paste`,label:`Paste`,bytes:null,action:V0,title:`Paste from the clipboard`}),Object.freeze({id:`upload-image`,label:`Image`,bytes:null,action:H0,accept:`image/*`,title:`Upload an image to this session`}),Object.freeze({id:`upload-file`,label:`File`,bytes:null,action:H0,title:`Upload a file to this session`})]);function W0(e){let t=U0.find(t=>t.id===e);return t?t.bytes:null}function G0(e){return!!e&&e.action===V0}function K0(e){return!!e&&e.action===`upload`}function q0({send:e,getSessionId:t}){let n=V(`div`,`phone-key-strip`);n.setAttribute(`role`,`toolbar`),n.setAttribute(`aria-label`,`Terminal keys`);let r=null,i=null;for(let e of U0){let t=V(`button`,`phone-key`,e.label);t.type=`button`,t.dataset.key=e.id,t.title=e.title,t.addEventListener(`pointerdown`,e=>e.preventDefault()),t.addEventListener(`click`,()=>a(e,t)),n.appendChild(t)}function a(t,n){K0(t)?o(t,n):G0(t)?J0(e):e(W0(t.id))}function o(e,t){i=t,r||(r=V(`input`,`phone-file-picker`),r.type=`file`,r.hidden=!0,r.addEventListener(`change`,s),n.appendChild(r)),e.accept&&(r.accept=e.accept),e.accept||r.removeAttribute(`accept`),r.click()}function s(){let e=r;if(!e)return;let n=e.files?e.files[0]:null;if(e.value=``,!n)return;let a=t?.();a?c(a,n,i):rS(`No session is open to upload to`)}async function c(e,t,n){n&&(n.disabled=!0),await iS(e,t),n&&(n.disabled=!1)}return n}function J0(e){let t=null;try{t=navigator.clipboard?.readText?.()}catch{rS(`Paste needs clipboard permission`);return}t?t.then(t=>{t&&e(t)}).catch(()=>rS(`Paste needs clipboard permission`)):rS(`Paste is unavailable in this browser`)}var Y0=`‹`;function X0({onBack:e}){let t=V(`div`,`phone-terminal`),n=V(`header`,`phone-topbar phone-terminal-bar`),r=V(`button`,`phone-back`,Y0);r.type=`button`,r.setAttribute(`aria-label`,`Back to board`),r.addEventListener(`click`,()=>e?.());let i=V(`div`,`phone-terminal-identity`),a=V(`span`,`phone-terminal-name`);a.title=`Tap to rename`,a.addEventListener(`click`,()=>b());let o=V(`span`,`session-task-title session-list-task-title`);GV(o,()=>te());let s=V(`span`,`phone-terminal-identity-line`),c=V(`span`,`phone-terminal-badge`);c.innerHTML=`<span class="phone-terminal-glyph" aria-hidden="true"></span><span class="phone-terminal-label"></span><span class="phone-terminal-elapsed" aria-hidden="true"></span>`;let l=H(c,`.phone-terminal-glyph`,`span`),u=H(c,`.phone-terminal-label`,`span`),d=H(c,`.phone-terminal-elapsed`,`span`);s.append(a,o),i.append(s,c);let f=V(`div`,`phone-terminal-actions`);n.append(r,i,f);let p=V(`div`,`phone-card-slot`),m=V(`div`,`phone-empty`);m.innerHTML=`<p class="phone-empty-title">No session selected</p><p class="phone-empty-desc">Select a session from the board to watch it here.</p>`;let h=q0({send:y,getSessionId:()=>g});t.append(n,p,m,h);let g=null,_=null,v=null;function y(e){let t=g?U.get(g):null;t&&(ik(t,e)||rS(`Session is not connected; key press was dropped`))}function ee(){let e=g?U.get(g):null;e?.term&&e.term.focus()}p.addEventListener(`click`,ee);function b(){let e=g?U.get(g):null;e&&g&&XV(e,g)}function te(){let e=g?U.get(g):null;e&&g&&qV(e,g)}function ne(){let e=g?U.get(g):null,t=!!e;if(m.hidden=t,p.hidden=!t,h.hidden=!t,i.hidden=!t,!t){n.removeAttribute(`data-state`),n.removeAttribute(`data-monitoring`);return}let r=e.currentState||F.DORMANT;n.dataset.state=r;let{glyph:s,label:c,isMonitoring:f}=Jd(r,e.awaitingBackgroundTasks);n.toggleAttribute(`data-monitoring`,f),YV(a)||(a.textContent=e.card?.dataset.session||g),KV(o,e.taskTitle),l.textContent=s,u.textContent=c,d.textContent=sp(e)}function re(){v&&=(delete v.renameTargetEl,delete v.titleTargetEl,null),a.replaceChildren(),_&&=(nf(_),_.parentElement===f&&_.remove(),null)}function ie(e){let t=U.get(e);t&&(g===e&&AP()===e&&t.card.parentElement===p||(re(),g=e,jP(t,e,p,{className:`phone-centered`}),_=H(t.card,`.session-actions`,`div`),tf(_,f),t.renameTargetEl=a,t.titleTargetEl=o,v=t),ne())}function ae(){re(),AP()===g&&MP(),g=null,ne()}function x(){if(!g){ne();return}let e=U.get(g);e?e.card.parentElement===p?ne():ie(g):ae()}function oe(){let e=g;e&&hk(U.get(e),e,!1)}function se(){x();let e=g;if(!e)return;let t=U.get(e);t&&hk(t,e,!0)}return up(()=>{let e=g?U.get(g):null;e&&(d.textContent=sp(e))}),ne(),{el:t,show:ie,clear:ae,refresh:x,reveal:se,unview:oe,getSessionId:()=>g}}var Z0=`board`,Q0=Object.freeze([{id:Z0,label:`Board`,glyph:`▤`},{id:`terminal`,label:`Terminal`,glyph:`▸`},{id:`review`,label:`Review`,glyph:`◫`}]),$0=[],e2=new Map,t2=null,n2=new Map,r2=new Map,i2=new Map,a2=null,o2=null,s2=null,c2=null,l2=null,u2=new Map,d2=new Set,f2={},p2=!1,m2=120,h2=0,g2=0,_2=`none`,v2=!1,y2=!1,b2=!1,x2={openTerminal:P2,openPlan:e=>{Q2(e)},onSheetOpenChange:B2};function S2(){h2=0,g2=0}function C2(){let e=window.visualViewport;t2&&(!p2||!e?t2.removeAttribute(`data-keyboard`):(t2.style.setProperty(`--phone-vh`,`${e.height}px`),t2.style.setProperty(`--phone-vv-top`,`${e.offsetTop}px`),e.width!==g2&&(g2=e.width,h2=0),h2=Math.max(h2,e.height),h2-e.height>m2?t2.dataset.keyboard=`open`:t2.removeAttribute(`data-keyboard`)))}function w2(e,t,n=`phone-nav-item`,r=`phone-nav-dot`){let i=V(`button`,n);i.type=`button`;let a=V(`span`,`phone-nav-glyph`,t);a.setAttribute(`aria-hidden`,`true`),i.append(a,V(`span`,`phone-nav-label`,e));let o=V(`span`,r);return o.setAttribute(`aria-hidden`,`true`),o.hidden=!0,i.appendChild(o),i}function T2(e){return e?.querySelector(`.phone-nav-dot`)||null}function E2(e,t){e&&(e.hidden=!t,typeof t==`string`&&(e.dataset.attention=t),typeof t!=`string`&&delete e.dataset.attention)}function D2(){let e=[];for(let t of $0){if(d2.has(t.id))continue;let n=i2.get(t.id)||!1;e.push(n),E2(T2(u2.get(t.id)),n)}E2(T2(c2),kie(e))}function O2(){let e=V(`div`,`phone-nav-more-menu`);e.hidden=!0;for(let t of $0){let n=w2(t.label,t.glyph,`phone-nav-menu-item`,`phone-nav-dot phone-nav-menu-dot`);n.dataset.screen=t.id,n.hidden=d2.has(t.id),n.addEventListener(`click`,()=>{k2(!1),K2(t.id)}),u2.set(t.id,n),e.appendChild(n)}return e}function k2(e){l2&&c2&&(l2.hidden=!e,c2.setAttribute(`aria-expanded`,String(e)))}function A2(){return!!l2&&!l2.hidden}function j2(){let e=V(`nav`,`phone-nav`);e.setAttribute(`aria-label`,`Screens`);for(let t of Q0){let n=w2(t.label,t.glyph);n.dataset.screen=t.id,n.addEventListener(`click`,()=>K2(t.id)),n2.set(t.id,n),e.appendChild(n)}return c2=w2(`More`,`⋯`),c2.setAttribute(`aria-expanded`,`false`),c2.addEventListener(`click`,()=>k2(!A2())),e.appendChild(c2),l2=O2(),e.appendChild(l2),e}function M2(e,t,n){let r=V(`section`,`phone-screen`);return r.dataset.screen=e,r.setAttribute(`aria-label`,t),r.hidden=!0,n&&r.appendChild(n),r2.set(e,r),r}function N2(){if(t2)return;a2=P0({onSelectSession:P2}),a2.setCalmShown(b2),o2=X0({onBack:()=>K2(Z0)}),s2=V(`div`,`phone-review`);let e=V(`div`,`phone-screens`),t={[Z0]:a2.el,terminal:o2.el,review:s2};for(let n of Q0)e.appendChild(M2(n.id,n.label,t[n.id]));for(let t of $0){let n=V(`div`,`phone-panel phone-${t.id}`);e2.set(t.id,n),e.appendChild(M2(t.id,t.label,n))}t2=V(`div`,`phone-shell`),t2.id=`phone-shell`,t2.append(e,j2()),document.body.appendChild(t2),D2(),window.visualViewport?.addEventListener(`resize`,C2),window.visualViewport?.addEventListener(`scroll`,C2),window.addEventListener(`popstate`,H2),document.addEventListener(`click`,e=>{A2()&&l2&&c2&&e.target instanceof Node&&(l2.contains(e.target)||c2.contains(e.target)||k2(!1))}),document.addEventListener(`keydown`,e=>{e.key===`Escape`&&A2()&&k2(!1)})}function P2(e){if(U.has(e)){if(!a2||!o2)throw Error(`Phone shell is not built`);jI(e,`dormant-fallback`),a2.acknowledge(e),MI(e),o2.show(e),K2(`terminal`)}}function F2(e){if(e===Z0){L2();return}let t={glimmervoidScreen:e};_2===`none`?(history.pushState(t,``),_2=`screen`):(history.replaceState(t,``),_2=`screen`)}function I2(){if(L0(history.state))return _2=`calm-sheet`,z2(),Z0;let e=V2(history.state);return e&&G2(e)?(_2=`screen`,e):(e&&history.replaceState(null,``),_2=`none`,Z0)}function L2(){_2!==`none`&&(_2=`none`,history.back())}function R2(){z0({pushedEntry:_2,isOwnSheetPopPending:y2})===`push-sheet-entry`&&(history.pushState(I0,``),_2=`calm-sheet`)}function z2(){B0({pushedEntry:_2,topState:history.state,isOwnSheetPopPending:y2})&&(_2=`none`,y2=!0,history.back())}function B2(e){v2=e,e?R2():z2()}function V2(e){let t=e?.glimmervoidScreen;return typeof t==`string`?t:null}function H2(e){let t=y2;if(y2=!1,!p2)return;let n=R0({poppedState:e.state,isCalmSheetOpen:v2,isOwnSheetPopPending:t});if(n===`own-sheet-pop`){v2&&R2();return}if(n===`adopt-sheet-entry`){_2=`calm-sheet`;return}if(n===`consume-stray-sheet-entry`){_2=`calm-sheet`,z2();return}if(n===`close-sheet`){_2=`none`,CP();return}let r=V2(e.state);_2=r?`screen`:`none`,W2(r&&G2(r)?r:Z0)}function U2(e,t){for(let[n,r]of e)n===t?r.setAttribute(`aria-current`,`page`):r.removeAttribute(`aria-current`)}function W2(e){if(!c2||!o2)throw Error(`Phone shell is not built`);df.dispatch(`setPhoneScreen`,e),k2(!1);for(let[t,n]of r2)n.hidden=t!==e;f2.onScreenShown?.(e),X2(),U2(n2,e);let t=u2.has(e);t&&c2.setAttribute(`aria-current`,`page`),t||c2.removeAttribute(`aria-current`),U2(u2,e),e===`terminal`?o2.reveal():o2.unview()}function G2(e){return r2.has(e)&&!d2.has(e)}function K2(e){t2&&G2(e)&&(e!==df.snapshot().phoneScreen&&F2(e),W2(e))}function q2(e){f2=e||{},$0=f2.panels||[]}function J2({sessionId:e}={}){if(p2)return;if(N2(),!t2||!a2||!o2)throw Error(`Phone shell is not built`);p2=!0,t2.hidden=!1;for(let e of f2.headerControls||[])tf(e,a2.topBarEl);pz(s2);for(let e of $0)tf(e.el,e2.get(e.id)),e.el.hidden=!1;C2(),e&&o2.show(e);let t=I2();t4(),e&&t===Z0?(df.dispatch(`setPhoneScreen`,Z0),K2(`terminal`)):W2(t)}function Y2(){if(p2){if(!t2||!o2)throw Error(`Phone shell is not built`);p2=!1,X2(),_0({returnFocus:!1}),o2.clear(),pz(null);for(let e of $0)nf(e.el);for(let e of f2.headerControls||[])nf(e);k2(!1),t2.hidden=!0,t2.removeAttribute(`data-keyboard`),S2(),L2()}}function X2(){a2&&(p2&&b2&&df.snapshot().phoneScreen===Z0?SP(a2.calmEl,x2):wP())}function Z2(e){b2=e,a2?.setCalmShown(e),X2()}function Q2(e){return!p2||!a2||!o2||!U.has(e)?!1:(P2(e),NH(e))}function $2(){return p2}function e4(){return p2&&o2?o2.getSessionId():null}function t4(){if(!p2)return;if(!a2||!o2)throw Error(`Phone shell is not built`);a4(),a2.refresh(),o2.refresh(),df.snapshot().phoneScreen===`terminal`&&!o2.getSessionId()&&K2(Z0);let e=T2(n2.get(Z0));e&&(e.hidden=a2.getAttentionCount()===0)}function n4(e){return!p2||!G2(e)?!1:(K2(e),!0)}function r4(e,t){t&&d2.delete(e),t||d2.add(e);let n=u2.get(e);n&&(n.hidden=!t);let r=r2.get(e);r&&!t&&(r.hidden=!0),D2(),!t&&p2&&df.snapshot().phoneScreen===e&&K2(Z0)}function i4(e,t){i2.set(e,typeof t==`string`&&t?t:t===!0),D2()}function a4(){if(!o2)throw Error(`Phone shell is not built`);if(o2.getSessionId())return;let e=NI();e&&(o2.show(e),MI(e,{rememberFocus:!1}))}function o4(e,t){return!!e?.error&&!e.isRefreshing&&typeof e.nextAttemptAt==`number`&&e.nextAttemptAt>t}function s4(e,t){if(!e?.error)return null;let n=`Could not reach GitHub: ${e.error.trim().replace(/[.!]+$/,``)}.`;if(e.isRefreshing)return`${n} Refreshing.`;if(typeof e.nextAttemptAt!=`number`)return n;let r=Math.max(0,Math.ceil((e.nextAttemptAt-t)/1e3));return r===0?`${n} Retrying now.`:e.retry?`${n} Retrying in ${r}s (${e.retry.attempt} of ${e.retry.limit}).`:`${n} Next try in ${r>=60?`${Math.ceil(r/60)} min`:`${r}s`}.`}function c4(e,t,n){return e?.refreshNotice&&e.isRefreshing?e.refreshNotice:t||e?.isRefreshing?`Refreshing.`:n||e?.refreshNotice||``}var l4={minPx:220,maxPx:720},u4=16,d4=new Set,f4=0;function p4(e){let t=qD();e.toggleAttribute(`data-queue-collapsed`,t),e.querySelector(`.pr-queue-toggle`)?.setAttribute(`aria-expanded`,String(!t));let n=GD();n===null?e.style.removeProperty(`--pr-queue-width`):e.style.setProperty(`--pr-queue-width`,`${n}px`)}function m4(){for(let e of d4)e.isConnected?p4(e):d4.delete(e)}function h4(e,t){let n=V(`div`,`pr-queue-head`);return e&&n.append(e),t&&n.append(t),n}function g4(e){let t=V(`div`,`pr-queue-foot`);return e&&t.append(e),t}function _4({queueLabel:e,scopeTabs:t,resizerLabel:n}){let r=V(`div`,`pr-columns`),i=V(`div`,`pr-queue-pane`),a=V(`nav`,`pr-queue`);a.id=`pr-queue-${++f4}`,a.setAttribute(`aria-label`,e);let o=V(`button`,`pr-queue-toggle`);o.type=`button`,o.setAttribute(`aria-label`,`Review queue`),o.setAttribute(`aria-controls`,a.id),o.title=`Collapse or expand the review queue`;let s=QL(16,16);s.append(ZL(`rect`,{x:`1.5`,y:`2`,width:`13`,height:`12`,rx:`2`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.3`})),s.append(ZL(`path`,{d:`M5.5 2V14`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.3`}));let c=ZL(`path`,{d:`M11 6L9 8L11 10`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.3`,"stroke-linecap":`round`,"stroke-linejoin":`round`});c.classList.add(`pr-queue-chevron`),s.append(c),o.append(s),o.addEventListener(`click`,()=>{JD(!qD()),m4()});let l=g4(null);i.append(h4(t,o),a,l);let u=V(`div`,`pr-queue-resizer`);u.setAttribute(`role`,`separator`),u.setAttribute(`aria-orientation`,`vertical`),u.setAttribute(`aria-label`,n),u.tabIndex=0;let d=V(`main`,`pr-detail-host`);return r.append(i,u,d),p4(r),d4.add(r),yI({resizer:u,column:i,widthHost:r,widthProperty:`--pr-queue-width`,bounds:l4,keyStepPx:u4,getStoredWidth:GD,setStoredWidth:KD}),{columns:r,queue:a,foot:l,detail:d}}var v4=1.2,y4=1.55,b4=.12,x4=523.25,S4=2,C4=8,$=(e,t,n)=>({semitone:e,startBeat:t,beats:n}),w4={melody:[$(7,4,.5),$(11,4.5,.5),$(12,5,3)],bass:[$(-5,4,1),$(-12,5,3)]},T4=[{melody:[$(0,0,1),$(4,1,1),$(7,2,1),$(9,3,1)],bass:[$(-12,0,2),$(-8,2,2)]},{melody:[$(7,0,.67),$(7,.67,.67),$(7,1.33,.67),$(9,2,1),$(5,3,1)],bass:[$(-12,0,2),$(-7,2,2)]},{melody:[$(5,0,1),$(9,1,1),$(7,2,1),$(4,3,1)],bass:[$(-7,0,2),$(-12,2,2)]},{melody:[$(12,0,.5),$(7,.5,.5),$(12,1,.5),$(16,1.5,.5),$(16,2,1),$(14,3,1)],bass:[$(-12,0,2),$(-3,2,2)]},{melody:[$(4,0,1),$(7,1,1),$(4,2,.5),$(5,2.5,.5),$(7,3,.5),$(4,3.5,.5)],bass:[$(-8,0,2),$(-12,2,2)]}].map(e=>({melody:[...e.melody,...w4.melody],bass:[...e.bass,...w4.bass]}));function E4(e,t){return x4*2**((e+t)/12)}function D4(e,t){let n=(e,n,r)=>e.map(e=>({frequency:E4(e.semitone,t),startSeconds:y4+e.startBeat*b4,durationSeconds:e.beats*b4,waveform:n,gain:r}));return[...n(e.melody,`square`,.2),...n(e.melody,`triangle`,.5),...n(e.bass,`triangle`,.6)]}var O4=[{frequency:220,endFrequency:880,startSeconds:0,durationSeconds:.32,waveform:`triangle`,gain:.25},{frequency:160,endFrequency:45,startSeconds:v4,durationSeconds:.28,waveform:`sine`,gain:1},{frequency:1400,endFrequency:380,startSeconds:v4,durationSeconds:.06,waveform:`square`,gain:.12}];function k4(e){let t=T4[e%T4.length],n=Math.min(e*S4,C4);return{peakGain:.1,tones:[...O4,...D4(t,n)]}}function A4(e){return Math.round(Math.sqrt(2*e/780)*1e3)}function j4(e,t,n=Math.random){return Math.round(e+n()*(t-e))}function M4(e,t=Math.random){let n=[...e];for(let e=n.length-1;e>0;--e){let r=Math.floor(t()*(e+1));[n[e],n[r]]=[n[r],n[e]]}return n}var N4=.6,P4=.25,F4=1.6;function I4(e){return Math.min(N4+e*P4,F4)}var L4=[`var(--accent)`,`var(--state-running)`,`var(--state-idle)`,`var(--state-waiting)`,`var(--state-failed)`];function R4(e,t=Math.random){let n=j4(320,520,t),r=j4(1800,2800,t);return[[`--confetti-start-x`,`${j4(4,96,t)}%`],[`--confetti-x`,`${j4(-140,140,t)}px`],[`--confetti-rise`,`${-j4(20,55,t)}px`],[`--confetti-fall`,`${j4(45,70,t)}vh`],[`--confetti-rise-ms`,`${n}ms`],[`--confetti-fall-ms`,`${r}ms`],[`--confetti-flight-ms`,`${n+r}ms`],[`--confetti-tilt`,`${j4(0,180,t)}deg`],[`--confetti-spin`,`${j4(-360,360,t)}deg`],[`--confetti-flutter-ms`,`${j4(160,340,t)}ms`],[`--confetti-delay`,`${j4(0,160,t)}ms`],[`--confetti-color`,L4[e%L4.length]]]}var z4=`<svg viewBox="0 0 36 36" aria-hidden="true"><circle class="merge-bullseye-ring-light" cx="18" cy="18" r="17"/><circle class="merge-bullseye-ring-red" cx="18" cy="18" r="13"/><circle class="merge-bullseye-ring-light" cx="18" cy="18" r="9"/><circle class="merge-bullseye-ring-red" cx="18" cy="18" r="5"/></svg>`,B4=`<svg viewBox="0 0 26 8" aria-hidden="true"><path class="merge-bullseye-dart-flight" d="M0 0L7 3V5L0 8L2 4Z"/><rect class="merge-bullseye-dart-shaft" x="6" y="3.3" width="8" height="1.4"/><rect class="merge-bullseye-dart-barrel" x="13" y="2.5" width="7" height="3" rx="1"/><path class="merge-bullseye-dart-tip" d="M20 3L26 4L20 5Z"/></svg>`;function V4(){let e=Bd(`div`,`merge-bullseye-target`,z4);return e.append(V(`span`,`merge-bullseye-ripple`)),e}function H4(){let e=V(`div`,`merge-bullseye-dart-drift`),t=V(`div`,`merge-bullseye-dart-arc`),n=V(`div`,`merge-bullseye-dart-aim`);return n.append(Bd(`div`,`merge-bullseye-dart`,B4)),t.append(n),e.append(t),e}function U4(){let e=V(`div`,`merge-bullseye-range`),t=V(`div`,`merge-bullseye-track`);return t.append(H4()),e.append(V4(),t),e}var W4={title:`BULLSEYE!`,buildScene:U4},G4=6,K4=30,q4=-14,J4=16;function Y4(e=Math.random){return[[`--crosshair-start-left`,`${j4(G4,K4,e)}%`],[`--crosshair-start-offset-y`,`${j4(q4,J4,e)}px`]]}var X4=`<svg viewBox="0 0 26 40" aria-hidden="true"><path class="merge-headshot-target-body" d="M9 13H17L18 16Q25 18 25 24V40H1V24Q1 18 8 16Z"/><circle class="merge-headshot-target-head" cx="13" cy="7" r="6"/><circle class="merge-headshot-target-ring" cx="13" cy="7" r="3"/><circle class="merge-headshot-target-ring" cx="13" cy="27" r="6"/><circle class="merge-headshot-target-ring" cx="13" cy="27" r="2.5"/></svg>`,Z4=`<svg viewBox="0 0 22 22" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="M11 0V5M11 17V22M0 11H5M17 11H22"/><circle class="merge-headshot-crosshair-dot" cx="11" cy="11" r="1"/></svg>`,Q4=`<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M3 3L8 8M21 3L16 8M3 21L8 16M21 21L16 16"/></svg>`;function $4(){let e=V(`div`,`merge-headshot-sweep`);Vd(e,Y4());let t=V(`div`,`merge-headshot-aim`);t.append(Bd(`div`,`merge-headshot-crosshair`,Z4));let n=V(`div`,`merge-headshot-bob`);return n.append(t,Bd(`div`,`merge-headshot-hitmarker`,Q4)),e.append(n),e}function e3(){let e=V(`div`,`merge-headshot-range`),t=V(`div`,`merge-headshot-track`);return t.append($4()),e.append(Bd(`div`,`merge-headshot-target`,X4),t),e}var t3={title:`HEADSHOT!`,buildScene:e3},n3=[`10`,`J`,`Q`,`K`,`A`],_oe=19,voe=5,yoe=9,boe=780,xoe=70,Soe=70,Coe=35;function woe(e){let t=n3.length-1,n=e-t/2;return{offsetPx:n*_oe,titleSpreadFraction:n/t,tiltDegrees:n*voe,bottomPx:yoe-n**2,dealLeadMs:boe-e*xoe,flipLeadMs:160+(t-e)*Soe,waveDelayMs:e*Coe}}function Toe(e){return[[`--card-offset`,`${e.offsetPx}px`],[`--card-title-spread`,String(e.titleSpreadFraction)],[`--card-tilt`,`${e.tiltDegrees}deg`],[`--card-bottom`,`${e.bottomPx}px`],[`--card-deal-lead-ms`,`${e.dealLeadMs}ms`],[`--card-flip-lead-ms`,`${e.flipLeadMs}ms`],[`--card-wave-delay-ms`,`${e.waveDelayMs}ms`]]}function Eoe(){return[[`--card-flip-ms`,`160ms`]]}var Doe=`<svg viewBox="0 0 10 9" aria-hidden="true"><path d="M5 8.5C5 8.5 0 5.3 0 2.6C0 1.1 1.2 0 2.6 0C3.6 0 4.5 .6 5 1.4C5.5 .6 6.4 0 7.4 0C8.8 0 10 1.1 10 2.6C10 5.3 5 8.5 5 8.5Z"/></svg>`;function Ooe(e,t){let n=V(`div`,`merge-flush-deal`);Vd(n,Toe(woe(t)));let r=V(`div`,`merge-flush-hop`),i=V(`div`,`merge-flush-card`),a=V(`div`,`merge-flush-face`);return a.append(V(`span`,`merge-flush-rank`,e)),a.insertAdjacentHTML(`beforeend`,Doe),i.append(V(`div`,`merge-flush-back`),a),r.append(i),n.append(r),n}function koe(){let e=V(`div`,`merge-flush-table`);return Vd(e,Eoe()),e.append(...n3.map(Ooe)),e}var Aoe={title:`ROYAL FLUSH!`,buildScene:koe},joe=[1,2,3,4],Moe=14,Noe=3,Poe=3,r3=10,Foe=20,Ioe=2,i3=28,a3=18,Loe=.01,Roe=1.5,zoe=2200,Boe=1,o3=120,s3=.35,Voe=4,Hoe=65,Uoe=145;function Woe(e){return Math.round(e/(Math.PI*a3)*360)}function c3(e){return Foe-e*Ioe}function l3(e){return e.rowIndex*Moe+e.depthIndex*Noe}function u3(e,t,n){return Array.from({length:n},(r,i)=>e+(t-e)*i/(n-1))}function d3(){return joe.flatMap((e,t)=>Array.from({length:e},(n,r)=>({rowIndex:t,depthIndex:e-1-r})))}function Goe(e,t){let n=M4(u3(15,105,e),t),r=M4(u3(Hoe,Uoe,e),t);return n.map((e,n)=>({angleDegrees:e+j4(-4,Voe,t),depthScalePercent:Math.round(r[n])}))}function Koe(e,t,n){let r=j4(240,380,n),i=t.angleDegrees*Math.PI/180,a=r*Math.cos(i),o=(r*Math.sin(i))**2/1560,s=j4(15,45,n),c=A4(o),l=A4(o+s),u=c+l,d=j4(540,1080,n),f=a>=0?1:-1,p=l3(e);return{depthIndex:e.depthIndex,launchAngleDegrees:t.angleDegrees,distanceFromHeadPinPx:p,layer:c3(e.depthIndex),flyXPx:Math.round(a*u/1e3),peakRisePx:Math.round(o),landingDropPx:s,riseMs:c,fallMs:l,flightMs:u,spinDegrees:Math.round(f*d*u/1e3),glintMs:Math.round(180/d*1e3),depthScalePercent:t.depthScalePercent,delayMs:Math.round(p/s3)}}function qoe(e=Math.random){let t=d3(),n=Goe(t.length,e);return t.map((t,r)=>Koe(t,n[r],e))}function Joe(e){return[[`--pin-left`,`${e.distanceFromHeadPinPx}px`],[`--pin-raise`,`${e.depthIndex*Poe}px`],[`--pin-shade`,`${100-e.depthIndex*12}%`],[`--pin-fly-x`,`${e.flyXPx}px`],[`--pin-peak-y`,`${-e.peakRisePx}px`],[`--pin-land-y`,`${e.landingDropPx}px`],[`--pin-rise-ms`,`${e.riseMs}ms`],[`--pin-fall-ms`,`${e.fallMs}ms`],[`--pin-flight-ms`,`${e.flightMs}ms`],[`--pin-spin`,`${e.spinDegrees}deg`],[`--pin-glint-ms`,`${e.glintMs}ms`],[`--pin-depth-scale`,`${e.depthScalePercent}%`],[`--pin-depth-shade`,`${e.depthScalePercent-10}%`],[`--pin-delay`,`${e.delayMs}ms`],[`--pin-layer`,String(e.layer)]]}function Yoe(){return c3(Roe)}function Xoe(){return Math.max(...d3().map(l3))+r3}function Zoe(){let e=Xoe(),t=i3+e+a3-Boe;return[[`--ball-follow-px`,`${o3}px`],[`--ball-follow-ms`,`${Math.round(o3/s3)}ms`],[`--ball-follow-spin`,`${Woe(o3)}deg`],[`--ball-size`,`${a3}px`],[`--ball-approach-spin`,`${zoe}deg`],[`--ball-impact-inset`,`${t}px`],[`--ball-layer`,String(Yoe())],[`--rack-right`,`${i3}px`],[`--rack-width`,`${e}px`],[`--pin-width`,`${r3}px`]]}function Qoe(e=Math.random){return e()>=Loe?null:WE[Math.floor(e()*WE.length)].sprite}var $oe=`<svg viewBox="0 0 10 24" aria-hidden="true"><path class="merge-strike-pin-body" d="M5 0C7 0 7.6 2 7.2 4C6.9 5.6 6.3 6.6 6.4 8C6.6 10 9.6 12 9.6 16C9.6 19.5 8.4 22 7.6 24H2.4C1.6 22 .4 19.5 .4 16C.4 12 3.4 10 3.6 8C3.7 6.6 3.1 5.6 2.8 4C2.4 2 3 0 5 0Z"/><path class="merge-strike-pin-stripe" d="M3.1 5.2H6.9V6.2H3.1ZM3.4 7H6.6V8H3.4Z"/></svg>`;function ese(e){let t=V(`span`,`merge-strike-pin`);return t.append(Bd(`span`,`merge-strike-pin-arc`,$oe)),Vd(t,Joe(e)),t}function tse(){let e=Qoe();if(!e)return V(`span`,`merge-strike-ball`);let t=V(`span`,`merge-strike-ball is-animal`);return t.append(V(`span`,`nyan-sprite ${e}`)),t}function nse(){let e=V(`div`,`merge-strike-lane`);Vd(e,Zoe());let t=V(`div`,`merge-strike-rack`);t.append(...qoe().map(ese));let n=V(`div`,`merge-strike-track`);return n.append(tse()),e.append(t,n),e}var rse={title:`STRIKE!`,buildScene:nse},ise=20,ase=92,ose=23,sse=7,cse=-40;function lse(){let e=A4(72),t=A4(69),n=780*t/1e3;return{launchHeightPx:ise,peakHeightPx:ase,heightThroughRimPx:ose,heightLeavingNetPx:sse,heightOutOfCardPx:cse,riseMs:e,fallToRimMs:t,speedThroughRimPxPerSecond:n,netCatchMs:Math.round(32/n*1e3),dropMs:A4(47)}}function use(e=lse()){return[[`--ball-launch-y`,`${-e.launchHeightPx}px`],[`--ball-peak-y`,`${-e.peakHeightPx}px`],[`--ball-rim-y`,`${-e.heightThroughRimPx}px`],[`--ball-net-exit-y`,`${-e.heightLeavingNetPx}px`],[`--ball-drop-out-y`,`${-e.heightOutOfCardPx}px`],[`--ball-rise-ms`,`${e.riseMs}ms`],[`--ball-fall-to-rim-ms`,`${e.fallToRimMs}ms`],[`--ball-to-rim-ms`,`${e.riseMs+e.fallToRimMs}ms`],[`--ball-net-catch-ms`,`${e.netCatchMs}ms`],[`--ball-drop-ms`,`${e.dropMs}ms`]]}var dse=`<svg viewBox="0 0 40 48" aria-hidden="true"><rect class="merge-swish-pole" x="36" y="28" width="2" height="20"/><rect class="merge-swish-backboard" x="35" y="2" width="3" height="26" rx="1"/><path class="merge-swish-rim" d="M31 18H35M7 18A12 2.5 0 0 1 31 18"/></svg>`,fse=`<svg viewBox="0 0 40 48" aria-hidden="true"><g class="merge-swish-net"><path d="M8 18L12 32M13.5 18L15.5 32M19 18V32M24.5 18L22.5 32M30 18L26 32M9.5 23Q19 25 28.5 23M11 28Q19 29.5 27 28"/></g><path class="merge-swish-rim" d="M7 18A12 2.5 0 0 0 31 18"/></svg>`;function pse(){let e=V(`div`,`merge-swish-ball-drift`),t=V(`div`,`merge-swish-ball-arc`);return t.append(V(`span`,`merge-swish-ball`)),e.append(t),e}function mse(){let e=V(`div`,`merge-swish-court`);Vd(e,use());let t=V(`div`,`merge-swish-track`);return t.append(pse()),e.append(Bd(`div`,`merge-swish-hoop-back`,dse),t,Bd(`div`,`merge-swish-hoop-front`,fse)),e}var f3=[rse,{title:`SWISH!`,buildScene:mse},W4,t3,Aoe],hse=48,p3=5600,gse=20,m3=null,h3=[],g3=null,_3=!1,v3=0;function _se(e){let t=V(`span`,`merge-confetti-piece`),n=V(`span`,`merge-confetti-arc`);return n.append(V(`span`,`merge-confetti-paper`)),t.append(n),Vd(t,R4(e)),t}function vse(e){let t=V(`p`,`merge-celebration-title`);return t.setAttribute(`aria-hidden`,`true`),Array.from(e).forEach((e,n)=>{let r=V(`span`,`merge-celebration-letter`,e);r.style.setProperty(`--letter-delay`,`${n*45}ms`),t.append(r)}),t}function yse(e,t){let n=t.firstElementChild,r=t.lastElementChild;n instanceof HTMLElement&&r instanceof HTMLElement&&(e.style.setProperty(`--celebration-title-width`,`${r.offsetLeft+r.offsetWidth-n.offsetLeft}px`),e.style.setProperty(`--celebration-title-center-y`,`${t.offsetTop+t.offsetHeight/2}px`))}function bse(e){let t=V(`div`,`merge-celebration-scene`);return t.setAttribute(`aria-hidden`,`true`),t.append(e.buildScene()),t}function xse(){return f3[Math.floor(Math.random()*f3.length)]}function Sse(e){if(CD())try{Lb(k4(e))}catch{}}function Cse(e,t,n){m3?.remove(),Sse(n);let r=V(`div`,`merge-celebration`);r.setAttribute(`role`,`status`);let i=V(`div`,`merge-celebration-card`),a=V(`div`,`merge-celebration-stage`),o=vse(t.title);a.append(o,V(`p`,`merge-celebration-message`,e),bse(t));let s=V(`div`,`merge-confetti`);s.style.setProperty(`--confetti-scale`,String(I4(n)));for(let e=0;e<hse;e+=1)s.append(_se(e));i.append(s,a),r.append(i),document.body.append(r),yse(a,o),m3=r,window.setTimeout(()=>{r.remove(),m3===r&&(m3=null)},p3)}function wse(e){return _3?`playing`:e?`queued`:`empty`}function y3(){if(!g3)return;let e=h3.length>0;g3.tray.dataset.state=wse(e),g3.count.textContent=e?String(h3.length):``,g3.button.disabled=_3||!e}function b3(){let e=h3.shift();_3=e!==void 0,y3(),e&&(Cse(e.message,e.scene,v3),v3+=1,window.setTimeout(b3,p3))}function Tse(e,t,n){g3={tray:e,button:t,count:n},t.addEventListener(`click`,()=>{v3=0,b3()}),y3()}function Ese(e,t=xse()){h3.push({message:e,scene:t}),h3.length>gse&&h3.shift(),y3()}var Dse={MERGE:`a merge commit`,SQUASH:`squash and merge`,REBASE:`rebase and merge`},Ose=new Set([`FAILURE`,`ERROR`]);function x3(e){return Dse[e]}function kse(e){return e.state===`MERGED`?`Already merged`:e.state===`OPEN`?e.isDraft?`Drafts cannot be merged`:e.isInMergeQueue?`Already in the merge queue`:e.mergeable===`CONFLICTING`||e.mergeStateStatus===`DIRTY`?`Resolve the merge conflicts first`:e.checks.failing.length>0||e.checks.state!==null&&Ose.has(e.checks.state)?`Checks are failing`:e.stage===`ready`?null:`Not ready to merge yet`:`Closed`}function S3(e,t,n,r,i,a){return{isVisible:a&&(e.state===`OPEN`||t),isPressed:t,isDisabled:n,statusText:r||(n?`Saving...`:i)}}function Ase(e,t,n=``){if(!t||!e.keepMergeable)return null;let r=C3(e,!1,``,!0,n).statusText;if(e.isKeepMergeableFixInFlight)return{text:`Repairing`,tone:`warn`,title:r};let i=e.keepMergeableAttempt;return!i||i.outcome===`pushed`||i.outcome===`stopped`?null:{text:`Repair failed`,tone:`danger`,title:r}}function C3(e,t,n=``,r=!0,i=``){let a=e.keepMergeableAttempt,o=e.keepMergeable?`On`:`Off`;if(e.keepMergeable&&a&&a.outcome!==`pushed`&&a.outcome!==`stopped`){let e=i?` (${i})`:``;o=`Keep mergeable failed: ${a.reason??`The attempt produced no repair`}${e}`}return e.isKeepMergeableFixInFlight&&(o=`Keep mergeable is running`),S3(e,!!e.keepMergeable,t,n,o,r)}function jse(e){return e?.isKeepMergeableEnabled!==!1}function Mse(e){return e?.isMergeQueueEnabled!==!1}var Nse={one:`st`,two:`nd`,few:`rd`,other:`th`},Pse=new Intl.PluralRules(`en-US`,{type:`ordinal`});function Fse(e){return`${e}${Nse[Pse.select(e)]??`th`}`}function Ise(e,t){return e===null?`Not queued`:t?`Repair pushed, waiting for you`:`Queued, ${Fse(e)} in line for this repository`}function Lse(e,t,n=``,r=!0){let i=e.mergeQueuePosition??null;return S3(e,i!==null,t,n,Ise(i,!!e.isMergeQueueHeldForRepairPush),r)}var w3=[`Needs you`,`Waiting`,`Ready to merge`,`Drafts`,`Merged today`],Rse=[`Ready to merge`,`Needs you`,`Waiting`,`Drafts`,`Merged today`],zse={conflicts:`Needs you`,behind:`Needs you`,"checks-failing":`Needs you`,"changes-requested":`Needs you`,"unresolved-threads":`Needs you`,"checks-pending":`Waiting`,"needs-approval":`Waiting`,unknown:`Waiting`,ready:`Ready to merge`,draft:`Drafts`,merged:`Merged today`},Bse={merged:`Merged`,draft:`Draft`,conflicts:`Merge conflicts`,behind:`Behind base`,"checks-failing":`Checks failing`,"changes-requested":`Changes requested`,"unresolved-threads":`Unresolved threads`,"checks-pending":`Checks running`,"needs-approval":`Needs approval`,ready:`Ready to merge`,unknown:`Status unknown`},Vse={merged:`muted`,draft:`muted`,conflicts:`danger`,behind:`warn`,"checks-failing":`danger`,"changes-requested":`warn`,"unresolved-threads":`warn`,"checks-pending":`wait`,"needs-approval":`wait`,ready:`ok`,unknown:`muted`},Hse={merged:`merged`,draft:`draft`,conflicts:`conflict`,behind:`behind`,"checks-failing":`failed`,"changes-requested":`changes-requested`,"unresolved-threads":`thread`,"checks-pending":`running`,"needs-approval":`reviewer`,ready:`ready`,unknown:`unknown`};function Use(e){let t=ou.safeParse(e);return t.success?t.data:null}function Wse(e){let t=e.filter(e=>e.state===`OPEN`&&!e.isCrossRepository),n=new Map(t.map(e=>[JSON.stringify([e.repo.toLowerCase(),e.headRefName]),e])),r=new Map,i=[];for(let t of e){let e=t.state===`OPEN`?n.get(JSON.stringify([t.repo.toLowerCase(),t.baseRefName])):void 0;if(!e||e.key===t.key){i.push(t);continue}let a=r.get(e.key)??[];a.push(t),r.set(e.key,a)}let a=[],o=new Set;for(let t of[...i,...e]){if(o.has(t.key))continue;let e=[],n=[{pr:t,parentKey:null,depth:0}];for(;n.length>0;){let t=n.pop();if(!t||o.has(t.pr.key))continue;o.add(t.pr.key),e.push(t);let i=r.get(t.pr.key)??[];for(let e=i.length-1;e>=0;--e)n.push({pr:i[e],parentKey:t.pr.key,depth:t.depth+1})}a.push({root:t,rows:e})}return a}function Gse(e){return w3[e.rows.reduce((e,{pr:t})=>Math.min(e,w3.indexOf(zse[t.stage])),w3.length-1)]}function Kse(e){let t=new Map(w3.map(e=>[e,{title:e,prs:[],rows:[]}]));for(let n of Wse(e)){let e=t.get(Gse(n));if(e)for(let t of n.rows)e.rows.push(t),e.prs.push(t.pr)}return Rse.flatMap(e=>t.get(e)??[])}function T3(e){return Bse[e]}function E3(e){return Vse[e]}function D3(e){return Hse[e]}function qse(e){if(e.checks.failing.length>0){let t=e.checks.failing.length-3;return{label:`Checks`,tone:`danger`,icon:`failed`,text:`${e.checks.failing.length} failing: ${e.checks.failing.slice(0,3).join(`, `)}${t>0?` and ${t} more`:``}`}}return e.checks.state===`FAILURE`||e.checks.state===`ERROR`?{label:`Checks`,tone:`danger`,icon:`failed`,text:`Failing`}:e.checks.pendingCount>0?{label:`Checks`,tone:`wait`,icon:`running`,text:`${e.checks.pendingCount} running`}:e.checks.state===`PENDING`||e.checks.state===`EXPECTED`?{label:`Checks`,tone:`wait`,icon:`running`,text:`Running`}:e.checks.state===`SUCCESS`?{label:`Checks`,tone:`ok`,icon:`passed`,text:`Passing`}:{label:`Checks`,tone:`muted`,icon:`none`,text:`No checks`}}function O3(e){return`${e} ${e===1?`approval`:`approvals`}`}function k3(e){return e.reviewRequests.map(e=>e.name).join(`, `)}function Jse(e){let t=e.reviewRequests.length>0?`Requested: ${k3(e)}`:`Approval required`;return e.approvals>0?`${t}, ${O3(e.approvals)}`:t}function Yse(e){let t=e.approvals>0?O3(e.approvals):`Approved`;return e.mergeStateStatus===`BLOCKED`?{label:`Review`,tone:`wait`,icon:`reviewer`,text:`${t}, merge blocked`}:{label:`Review`,tone:`ok`,icon:`passed`,text:t}}function Xse(e){return e.reviewDecision===`CHANGES_REQUESTED`?{label:`Review`,tone:`warn`,icon:`changes-requested`,text:`Changes requested`}:e.reviewDecision===`APPROVED`?Yse(e):e.reviewDecision===`REVIEW_REQUIRED`||e.mergeStateStatus===`BLOCKED`?{label:`Review`,tone:`wait`,icon:`reviewer`,text:Jse(e)}:e.reviewRequests.length>0?{label:`Review`,tone:`wait`,icon:`reviewer`,text:`Requested: ${k3(e)}`}:{label:`Review`,tone:`muted`,icon:`none`,text:`No review requested`}}function A3(e,t){return t?e.lastAuthor!==t:null}function Zse(e){let t=e.line===null?e.path:`${e.path}:${e.line}`;return e.isOutdated?`${t} (outdated)`:t}function Qse(e){let t=e.commentCount-1;return t===0?`No replies`:`${t} ${t===1?`reply`:`replies`}, last by ${e.lastAuthor??`a deleted account`}`}function $se(e,t){let n=A3(e,t);return n===null?null:n?{tone:`warn`,icon:`your-turn`,text:`Waiting on you`}:{tone:`wait`,icon:`reviewer`,text:`Waiting on reviewer`}}function ece(e,t){return[...e.threads].sort((e,n)=>{let r=Number(A3(n,t)===!0)-Number(A3(e,t)===!0);return r===0?(Date.parse(n.lastActivityAt)||0)-(Date.parse(e.lastActivityAt)||0):r}).map(e=>({location:Zse(e),url:e.url,author:e.author??`a deleted account`,excerpt:e.excerpt,replySummary:Qse(e),lastActivityAt:e.lastActivityAt,waiting:$se(e,t)}))}function tce(e,t){if(e.unresolvedThreads===0)return{label:`Threads`,tone:`ok`,icon:`passed`,text:`None open`};let n=`${e.unresolvedThreads} unresolved`;if(!t||e.threads.length===0)return{label:`Threads`,tone:`warn`,icon:`thread`,text:n};let r=e.threads.filter(e=>A3(e,t)).length;return r===0?{label:`Threads`,tone:`wait`,icon:`thread`,text:`${n}, all waiting on reviewers`}:{label:`Threads`,tone:`warn`,icon:`your-turn`,text:`${n}, ${r} waiting on you`}}function nce(e){return e.mergeable===`CONFLICTING`||e.mergeStateStatus===`DIRTY`?{label:`Conflicts`,tone:`danger`,icon:`conflict`,text:`Conflicts with ${e.baseRefName}`}:e.mergeable===`MERGEABLE`?{label:`Conflicts`,tone:`ok`,icon:`passed`,text:`None`}:{label:`Conflicts`,tone:`muted`,icon:`unknown`,text:`Not computed yet`}}function rce(e){let t=e.behindBy!==null&&e.behindBy>0;return e.mergeStateStatus===`BEHIND`?{label:`Base`,tone:`warn`,icon:`behind`,text:t?`${e.behindBy} behind ${e.baseRefName}`:`Behind ${e.baseRefName}`}:e.behindBy===null?{label:`Base`,tone:`muted`,icon:`unknown`,text:`Unknown`}:t?{label:`Base`,tone:`muted`,icon:`behind`,text:`${e.behindBy} behind ${e.baseRefName}, update not required`}:{label:`Base`,tone:`ok`,icon:`passed`,text:`Up to date with ${e.baseRefName}`}}var ice={APPROVED:{text:`Approved`,tone:`ok`,icon:`passed`},CHANGES_REQUESTED:{text:`Requested changes`,tone:`warn`,icon:`changes-requested`},COMMENTED:{text:`Commented`,tone:`muted`,icon:`thread`},DISMISSED:{text:`Dismissed`,tone:`muted`,icon:`discarded`},PENDING:{text:`Pending`,tone:`wait`,icon:`running`}};function ace(e){return[...e.reviews].sort((e,t)=>(Date.parse(t.submittedAt??``)||0)-(Date.parse(e.submittedAt??``)||0)).map(e=>{let t=ice[e.state]??{text:e.state.toLowerCase().replaceAll(`_`,` `),tone:`muted`,icon:`unknown`};return{reviewer:e.reviewer??`a deleted account`,text:t.text,tone:t.tone,icon:t.icon,submittedAt:e.submittedAt}})}function oce(e,t=null){if(e.state===`MERGED`)return[];let n=[qse(e),Xse(e),tce(e,t),nce(e),rce(e)];return e.autoRebase?[...n,e.autoRebase.outcome===`rebased`?{label:`Auto-rebase`,tone:`ok`,icon:`passed`,text:e.autoRebase.message}:{label:`Auto-rebase`,tone:`danger`,icon:`failed`,text:e.autoRebase.message}]:n}function j3(e){return e?e.configured?e.error&&e.prs.length===0?`Pull requests will show here once GitHub answers.`:`No open or recently merged pull requests found.`:`Enable Team review and set its GitHub organization in settings to see your pull requests.`:`Waiting for your pull requests.`}function sce(e,t=0){if(!e)return[];let n=s4(e,t),r=n?[{text:n,tone:`error`}]:[];return e.truncatedNote?[...r,{text:e.truncatedNote,tone:`info`}]:r}function cce(e,t){let n=e.flatMap(e=>e.prs);return t&&n.some(e=>e.key===t)?t:n[0]?.key??null}function lce(e,t){if(!e)return[];let n=new Set(e.filter(e=>e.state===`OPEN`).map(e=>e.key));return t.filter(e=>e.state===`MERGED`&&n.has(e.key))}function uce(e){return e.length===1?`Merged ${e[0].key}`:`Merged ${e.length} pull requests`}var dce={isVisible:!1,isDisabled:!0,statusText:``,tone:null},fce={merged:{statusText:`Merged on GitHub. Refreshing the list.`,tone:`ok`},queued:{statusText:`Added to the merge queue. Refreshing the list.`,tone:`ok`},"auto-merge":{statusText:`Auto-merge enabled. GitHub merges it once its requirements pass.`,tone:`ok`},unconfirmed:{statusText:`GitHub accepted the request but did not confirm a merge. Check GitHub.`,tone:null}};function pce(e,t){if(e.state!==`OPEN`)return dce;let n=t?.head===e.headRefOid?t:void 0;if(n?.phase===`pending`)return{isVisible:!0,isDisabled:!0,statusText:`Merging on GitHub`,tone:`busy`};if(n&&n.phase!==`failed`)return{isVisible:!0,isDisabled:!0,...fce[n.phase]};let r=kse(e);return r?{isVisible:!0,isDisabled:!0,statusText:r,tone:null}:n?.phase===`failed`?{isVisible:!0,isDisabled:!1,statusText:n.text,tone:`error`}:{isVisible:!0,isDisabled:!1,statusText:`Merges into ${e.baseRefName} with ${x3(e.mergeMethod)}`,tone:null}}function mce(e){return`Merge ${e.key} "${e.title}" into ${e.baseRefName} with ${x3(e.mergeMethod)}, your default for this repository. Glimmervoid does not delete the branch.`}function hce(e){let t=lu.safeParse(e);if(!t.success)return null;let n=e&&typeof e==`object`&&`requestId`in e?e.requestId:null;return typeof n==`string`?{...t.data,requestId:n}:null}var M3=null,N3=null,P3=null,F3=null,I3=null,L3=null,R3=null,z3=new Map,B3=new Set,V3=new Map,H3={label:`Keep mergeable`,pendingKeys:new Set,errorsByKey:new Map,controlState:(e,t,n,r)=>C3(e,t,n,r,nF(e.keepMergeableAttempt?.at)),isFeatureEnabled:jse,save:async(e,t)=>{let n=await Nd(`my-pr-keep-mergeable`,{repo:e.repo,number:e.number,keepMergeable:t});if(n.type!==`my-pr-keep-mergeable-result`||n.key!==e.key)throw Error(`Unexpected keep mergeable reply.`);return n.ok?null:n.error??`Could not save Keep mergeable.`}},gce={label:`Merge when ready`,pendingKeys:new Set,errorsByKey:new Map,controlState:Lse,isFeatureEnabled:Mse,save:async(e,t)=>{let n=await Nd(`my-pr-merge-when-ready`,{repo:e.repo,number:e.number,mergeWhenReady:t});if(n.type!==`my-pr-merge-when-ready-result`||n.key!==e.key)throw Error(`Unexpected merge when ready reply.`);return n.ok?null:n.error??`Could not save Merge when ready.`}},_ce=6e4,vce=`No reply from the server. Check GitHub before trying again.`;function U3(e,t){let n=V(`div`,`reviews-refresh-control`),r=V(`button`,`pr-action reviews-refresh-button`,`Refresh`);r.type=`button`;let i=V(`span`,`reviews-refresh-status`);i.setAttribute(`role`,`status`);let a=V(`p`,`my-pr-error reviews-retry-notice`);n.append(r,i);let o=null,s=!1,c=``,l=null;function u(){a.textContent=s4(o,Date.now()),a.hidden!==!o?.error&&(a.hidden=!o?.error);let e=a.isConnected&&!$d(t)&&!document.hidden&&a.getClientRects().length>0&&o4(o,Date.now());!e&&l!==null&&(window.clearInterval(l),l=null),e&&l===null&&(l=window.setInterval(u,1e3))}function d(e){e!==o&&(c=``),o=e,r.disabled=s||!!e?.isRefreshing||!e?.configured,i.textContent=c4(e,s,c),i.hidden=!i.textContent,u()}r.addEventListener(`click`,async()=>{if(!s){s=!0,c=``,d(o);try{let t=await Nd(`github-polling-refresh`,{lane:e});t.type===`github-polling-refresh-result`&&(c=t.ok?`Refreshed.`:t.error??`Could not refresh from GitHub.`)}catch(e){c=RP(e)}finally{s=!1,d(o)}}});let f=new MutationObserver(u);f.observe(t,{attributes:!0,subtree:!0,attributeFilter:[`hidden`,`data-queue-collapsed`]});for(let e=t.parentElement;e;e=e.parentElement)f.observe(e,{attributes:!0,attributeFilter:[`hidden`,`data-queue-collapsed`]});return document.addEventListener(`visibilitychange`,u),{control:n,notice:a,update:d}}function W3(e,t,n,r){z3.set(e,{head:t,phase:n,text:r}),q3()}function yce(e){if(V3.has(e.key))return;let t=Md(`my-pr-merge`);if(!B({type:`my-pr-merge`,requestId:t,repo:e.repo,number:e.number,headRefOid:e.headRefOid})){W3(e.key,e.headRefOid,`failed`,`Not connected to the server.`);return}let n=window.setTimeout(()=>{V3.delete(e.key),W3(e.key,e.headRefOid,`failed`,vce)},_ce);V3.set(e.key,{requestId:t,head:e.headRefOid,timer:n}),z3.set(e.key,{head:e.headRefOid,phase:`pending`,text:``}),q3()}function bce(e){let t=pce(e,z3.get(e.key));if(!t.isVisible)return null;let n=V(`div`,`my-pr-merge`),r=V(`button`,`pr-action`,`Merge`);r.type=`button`,r.disabled=t.isDisabled;let i=V(`span`,`pr-action-status`,t.statusText);return i.setAttribute(`role`,`status`),i.setAttribute(`aria-live`,`polite`),t.tone&&(i.dataset.tone=t.tone),r.addEventListener(`click`,()=>{kf({title:`Merge pull request`,message:mce(e),confirmLabel:`Merge`,onConfirm:()=>yce(e)})}),n.append(r,i),n}function xce(e,t){let n=t.controlState(e,t.pendingKeys.has(e.key),t.errorsByKey.get(e.key),t.isFeatureEnabled(I3));if(!n.isVisible)return null;let r=V(`div`,`my-pr-merge`),i=V(`button`,`pr-action`,t.label);i.type=`button`,i.disabled=n.isDisabled,i.setAttribute(`aria-pressed`,String(n.isPressed));let a=V(`span`,`pr-action-status`,n.statusText);return a.setAttribute(`role`,`status`),a.setAttribute(`aria-live`,`polite`),i.addEventListener(`click`,async()=>{if(!t.pendingKeys.has(e.key)){t.pendingKeys.add(e.key),t.errorsByKey.delete(e.key),q3();try{let r=await t.save(e,!n.isPressed);r&&t.errorsByKey.set(e.key,r)}catch(n){t.errorsByKey.set(e.key,RP(n))}finally{t.pendingKeys.delete(e.key),q3()}}}),r.append(i,a),r}function G3(e,{hasGlyph:t}){let n=V(`span`,`my-pr-stage`);return n.dataset.tone=E3(e.stage),t&&n.append(rZ(D3(e.stage),E3(e.stage))),n.append(T3(e.stage)),n}function Sce(e,t){let n=V(`span`,`my-pr-requested`);n.append(V(`span`,null,`Requested`));let r=V(`span`,`avatar-stack`);for(let t of e.reviewRequests){let e=Hd({login:t.name,url:t.isTeam?t.avatarUrl:void 0,cssPx:16});e.title=t.name,e.setAttribute(`role`,`img`),e.setAttribute(`aria-label`,t.name),r.append(e)}return n.append(r,V(`span`,`my-pr-requested-names`,t.slice(11))),n}function Cce(){if(!M3||!N3||P3?.isConnected)return;let e=_4({queueLabel:`My pull requests`,scopeTabs:N3,resizerLabel:`Resize pull request list`});P3=e.queue,F3=e.detail,M3.replaceChildren(e.columns),R3&&e.foot.append(R3.control)}function K3(e){if(!F3)return;if(!e){F3.replaceChildren(V(`p`,`pr-empty`,j3(I3)));return}let t=V(`article`,`pr-detail`),n=V(`div`,`pr-detail-heading`),r=V(`div`,`pr-detail-title`);r.append(Gd(`pr-link`,e.key,e.url),V(`h2`,null,e.title)),n.append(r,G3(e,{hasGlyph:!0})),t.append(n);for(let n of[H3,gce]){let r=xce(e,n);r&&t.append(r)}let i=oce(e,I3?.viewer??null);if(i.length>0){let n=V(`section`,`pr-readiness-section`);n.append(V(`h3`,`pr-section-heading`,`Merge readiness`));let r=V(`ul`,`pr-readiness`);for(let t of i){let n=V(`li`,`pr-readiness-row`),i=V(`span`,`pr-readiness-value`);t.label===`Review`&&t.text.startsWith(`Requested: `)&&i.append(Sce(e,t.text)),i.childNodes.length===0&&(i.textContent=t.text),n.append(rZ(t.icon,t.tone),V(`span`,`pr-readiness-label`,t.label),i),r.append(n)}n.append(r);let a=bce(e);a&&n.append(a),t.append(n)}if(e.checks.failing.length>0){let n=V(`section`,`my-pr-failures`);n.append(V(`h3`,`pr-section-heading`,`Failing checks`));let r=V(`ul`,`my-pr-facts`);for(let t of e.checks.failing)r.append(V(`li`,null,t));n.append(r),t.append(n)}let a=ace(e);if(a.length>0){let e=V(`section`,`pr-readiness-section`);e.append(V(`h3`,`pr-section-heading`,`Reviews`));let n=V(`ul`,`pr-readiness`);for(let e of a){let t=V(`li`,`pr-readiness-row`),r=Date.parse(e.submittedAt??``),i=Number.isFinite(r)?`${e.text} ${nF(r)}`:e.text,a=V(`span`,`my-pr-reviewer`);a.append(Ud([{login:e.reviewer,tone:e.tone,title:e.reviewer,url:e.reviewer===`a deleted account`?null:void 0}],16),V(`span`,null,e.reviewer)),t.append(rZ(e.icon,e.tone),a,V(`span`,`pr-readiness-value`,i)),n.append(t)}e.append(n),t.append(e)}let o=ece(e,I3?.viewer??null);if(o.length>0){let e=V(`section`,`my-pr-threads-section`);e.append(V(`h3`,`pr-section-heading`,`Unresolved threads`));let n=V(`ul`,`my-pr-threads`);for(let e of o){let t=V(`li`,`my-pr-thread`),r=V(`div`,`my-pr-thread-heading`);if(r.append(Gd(`my-pr-thread-location`,e.location,e.url)),e.waiting){let t=V(`span`,`my-pr-stage`);t.dataset.tone=e.waiting.tone,t.append(rZ(e.waiting.icon,e.waiting.tone),e.waiting.text),r.append(t)}let i=V(`p`,`my-pr-thread-excerpt`);i.append(V(`strong`,null,e.author),` ${e.excerpt}`);let a=Date.parse(e.lastActivityAt),o=V(`p`,`my-pr-thread-meta`,Number.isFinite(a)?`${e.replySummary}, ${nF(a)}`:e.replySummary);t.append(r,i,o),n.append(t)}e.append(n),t.append(e)}let s=V(`p`,`pr-detail-meta`);s.append(V(`span`,null,`Opened ${nF(Date.parse(e.createdAt))}`),V(`span`,null,`${e.state===`MERGED`?`Merged`:`Updated`} ${nF(Date.parse(e.state===`MERGED`?e.mergedAt??``:e.updatedAt))}`)),t.append(s),F3.replaceChildren(t)}function q3(){if(Cce(),!P3)return;let e=I3?.prs??[],t=Kse(e);L3=cce(t,L3);let n=document.activeElement instanceof HTMLElement&&P3.contains(document.activeElement)?document.activeElement.dataset.prKey:null,r=t.filter(e=>e.rows.length>0).map(e=>{let t=V(`section`,`pr-queue-section`);t.append(V(`h3`,`pr-section-heading`,`${e.title} ${e.rows.length}`));for(let{pr:n,parentKey:r,depth:i}of e.rows){let e=V(`button`,`pr-queue-row`);e.type=`button`,e.dataset.prKey=n.key,r&&(e.style.paddingInlineStart=`${12+Math.min(i,6)*16}px`),e.setAttribute(`aria-current`,String(n.key===L3)),e.title=`${n.key}: ${T3(n.stage)}`;let a=V(`span`,`pr-queue-glyph`);a.append(rZ(D3(n.stage),E3(n.stage)));let o=V(`span`,`pr-queue-top`);o.append(V(`strong`,`pr-queue-ref`,n.key),V(`span`,`pr-queue-title`,n.title));let s=V(`span`,`pr-queue-bottom`);r&&s.append(V(`span`,`my-pr-stage`,`Stacked on ${r}`)),s.append(G3(n,{hasGlyph:!1}),V(`span`,`pr-queue-elapsed`,`opened ${nF(Date.parse(n.createdAt))}`));let c=Ase(n,H3.isFeatureEnabled(I3),nF(n.keepMergeableAttempt?.at));if(c){let e=V(`span`,`my-pr-stage`,c.text);e.dataset.tone=c.tone,e.title=c.title,s.append(e)}e.append(a,o,s),e.addEventListener(`click`,()=>{L3=n.key;for(let e of P3?.querySelectorAll(`button[data-pr-key]`)??[])e.setAttribute(`aria-current`,String(e.dataset.prKey===L3));K3(n),document.documentElement.dataset.layout===`phone`&&F3?.scrollIntoView({block:`start`,behavior:`smooth`})}),t.append(e)}return t});if(r.length===0&&P3.replaceChildren(V(`p`,`pr-empty`,j3(I3))),r.length>0){let e=sce(I3,Date.now()).filter(e=>e.tone!==`error`).map(e=>V(`p`,e.tone===`error`?`my-pr-error`:`my-pr-note`,e.text));P3.replaceChildren(...e,...r)}R3&&(P3.prepend(R3.notice),R3.update(I3)),n&&[...P3.querySelectorAll(`button[data-pr-key]`)].find(e=>e.dataset.prKey===n)?.focus({preventScroll:!0}),K3(e.find(e=>e.key===L3))}function wce(e,t){return M3||(N3=t,M3=V(`div`,`pr-content`),e.append(M3),R3=U3(`my-prs`,M3),q3(),M3)}function Tce(e){let t=Use(e);if(!t)return;let n=lce(I3?.prs??null,t.prs);I3=t,q3(),J3(n)}function J3(e){let t=e.filter(e=>!B3.has(e.key));if(t.length!==0){for(let e of t)B3.add(e.key);Ese(uce(t))}}function Ece(e){let t=hce(e);if(!t)return;let n=V3.get(t.key);if(!n||n.requestId!==t.requestId)return;if(window.clearTimeout(n.timer),V3.delete(t.key),!t.ok){W3(t.key,n.head,`failed`,t.error||`The merge failed.`);return}if(W3(t.key,n.head,t.kind??`unconfirmed`,``),t.kind!==`merged`)return;let r=I3?.prs.find(e=>e.key===t.key);r&&J3([r])}var Dce=dl.options.join(`|`),Y3=String.raw`\*\*(?:\[([^\]\n]+)\]\s+)?(${Dce})\*\*`;function Oce(e){return[...e.matchAll(new RegExp(Y3,`g`))].flatMap(e=>{let t=dl.safeParse(e[2]);return t.success?[t.data]:[]})}function kce(e){let t=new RegExp(String.raw`^${Y3}\s*(?:\r?\n|$)`).exec(e);if(!t)return null;let n=dl.safeParse(t[2]);return n.success?{reviewer:t[1]??null,severity:n.data,length:t[0].length}:null}function X3(e){let t=e.trimStart();return t.startsWith(`> [!NOTE]
|
|
248
248
|
> Automated review. Not written by a human.`)?t.slice(53).trim():e.trim()}var Ace={"direct-request":`Needs you`,"team-request":`Ready`,"changes-requested":`Author to fix`,"checks-failing":`Checks failing`,"checks-pending":`Checks running`,draft:`Draft`,"review-available":`Ready`,approved:`Approved`};function Z3(e){return e.isDraft?{band:`not-ready`,reason:`draft`}:e.reviewDecision===`CHANGES_REQUESTED`?{band:`waiting-on-author`,reason:`changes-requested`}:e.checksState===`FAILURE`||e.checksState===`ERROR`?{band:`waiting-on-author`,reason:`checks-failing`}:e.checksState===`PENDING`||e.checksState===`EXPECTED`?{band:`not-ready`,reason:`checks-pending`}:e.requestSource===`direct`&&e.reviewDecision===`REVIEW_REQUIRED`?{band:`blocking-others`,reason:`direct-request`}:e.reviewDecision===`APPROVED`?{band:`actionable`,reason:`approved`}:{band:`actionable`,reason:e.requestSource===`direct`?`review-available`:`team-request`}}var Q3={APPROVE:{label:`You approved`,tone:`ok`,icon:`passed`},COMMENT:{label:`You commented`,tone:`muted`,icon:`thread`}},$3={APPROVED:{label:`You approved`,tone:`ok`,icon:`passed`},CHANGES_REQUESTED:{label:`You requested changes`,tone:`wait`,icon:`changes-requested`},COMMENTED:{label:`You commented`,tone:`muted`,icon:`thread`}};function e6(e){let t=(e.githubReviews??[]).filter(e=>e.isViewer).sort((e,t)=>(Date.parse(t.submittedAt??``)||0)-(Date.parse(e.submittedAt??``)||0)).at(0);if(!e.postedEvent)return t?$3[t.state]:null;if(!t)return Q3[e.postedEvent];let n=Date.parse(t.submittedAt??``);return Number.isNaN(n)||e.postedAt!==void 0&&e.postedAt>n?Q3[e.postedEvent]:$3[t.state]}var jce={"changes-requested":`changes-requested`,"checks-failing":`failed`,"checks-pending":`running`,draft:`draft`};function t6(e){let{reason:t}=Z3(e),n=jce[t];return n?{text:Ace[t],icon:n}:null}function Mce(e){return t6(e)?.text??null}var Nce={discarded:{tone:`muted`,icon:`discarded`,meaning:`Discarded`},handReview:{tone:`warn`,icon:`fork`,meaning:`From a fork`}};function n6(e,t){let n=Mce(t);return n?`${e}, ${n}`:e}function Pce(e){if(Sl(e))return!0;let t=(e.githubReviews??[]).filter(e=>e.isViewer);return t.length===0||t.some(t=>t.commit===h6(e))}var Fce={tone:`warn`,icon:`your-turn`,meaning:`Comments resolved`};function r6(e,t){let n=Nce[t];if(n)return n;if(t===`inReview`)return{tone:`wait`,icon:`running`,meaning:n6(`In review`,e)};if(t===`queued`)return{tone:`muted`,icon:`queued`,meaning:n6(`Queued`,e)};if(t===`settled`&&`reviewedHead`in e){let t=Pce(e)?e6(e):null;return t?{tone:t.tone,icon:t.icon,meaning:t.label}:{tone:`ok`,icon:`passed`,meaning:`Others reviewed`}}if(t===`posted`&&`reviewedHead`in e){let t=e6(e);return t?{tone:t.tone,icon:t.icon,meaning:t.label}:{tone:`muted`,icon:`none`,meaning:`Posted`}}if(t===`attention`&&`status`in e)return e.status===`error`?{tone:`danger`,icon:`failed`,meaning:`Review failed`}:{tone:`warn`,icon:`stale`,meaning:`Out of date`};let r=t6(e);return r?{tone:`wait`,icon:r.icon,meaning:r.text}:t===`ready`&&`reviewedHead`in e&&o6(e)?Fce:{tone:`warn`,icon:`your-turn`,meaning:`Waits on you`}}function i6(e){let t=e.viewerThreads;return t!==void 0&&t.total>0&&t.resolved===t.total}function a6(e){return e.status===`posted`&&o6(e)}function o6(e){if(!i6(e)||Sl(e))return!1;let t=h6(e);return!(e.githubReviews??[]).some(e=>e.isViewer&&e.state===`APPROVED`&&e.commit===t)}function s6(e){return!e||e.total===0?null:e.total===1?e.resolved===1?`Your 1 comment resolved`:`Your 1 comment unresolved`:e.resolved===e.total?`All ${e.total} of your comments resolved`:`${e.resolved} of ${e.total} of your comments resolved`}function Ice(e){return`${e} ${e===1?`comment`:`comments`}`}function c6(e,t,n){let r=[`${D6(e.repo,e.number)}: ${e.title}`],i=`reviewedHead`in e?e.assessment?.goal.trim():``;if(i&&r.push(i),r.push(r6(e,t).meaning),n.opened&&r.push(`Opened ${n.opened}`),n.reviewed&&r.push(`Reviewed ${n.reviewed}`),n.posted&&r.push(`Posted ${n.posted}`),!(`reviewedHead`in e))return r.join(`
|
|
249
249
|
`);let a=s6(e.viewerThreads);a&&r.push(a);let o=e.comments.length;e.status!==`error`&&r.push(`Automated review: ${Gce(e.verdict)}, ${Ice(o)}`);let s=v6(e);s&&r.push(`You ${p6[s.state]} at ${ol(s.approvedCommit)}${n.viewerApproval?` ${n.viewerApproval}`:``}; new commits since.`),(t===`attention`||t===`discarded`)&&r.push(j6(e));let c=x6(e,{isViewerShown:t!==`posted`});for(let[e,t]of c.entries())r.push(b6(t.text,n.githubReviews?.[e]??null));return r.join(`
|
package/dist/client/index.html
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<link rel="icon" type="image/svg+xml" href="/assets/favicon-CKygeLwW.svg">
|
|
8
8
|
<title>Glimmervoid</title>
|
|
9
9
|
<style>html,body{background:var(--bg,#0a0810);height:100%;color:var(--text,#c8c0e0);font-family:var(--font-mono,"CommitMono", "Cascadia Code", "Fira Code", "Consolas", "Menlo", monospace);margin:0;padding:0}.app-shell{display:none}html:not([data-layout=phone]) .app-ready .app-shell{display:contents}.loading-screen{z-index:9999;background:#0a0810;flex-direction:column;justify-content:center;align-items:center;gap:20px;transition:opacity .3s;display:flex;position:fixed;inset:0}.loading-screen.fade-out{opacity:0;pointer-events:none}.loading-title{letter-spacing:.1em;color:#e8e0ff;text-transform:uppercase;font-family:CommitMono,Cascadia Code,Fira Code,Consolas,Menlo,monospace;font-size:20px;font-weight:700}.loading-title:before{content:"▸";color:#c084fc}.loading-status{color:#8276b0;letter-spacing:.04em;font-family:CommitMono,Cascadia Code,Fira Code,Consolas,Menlo,monospace;font-size:12px}.loading-spinner{border:2px solid #2a2440;border-top-color:#c084fc;border-radius:50%;width:28px;height:28px;animation:.8s linear infinite spin}@keyframes spin{to{transform:rotate(360deg)}}.shutdown-screen{z-index:9999;-webkit-backdrop-filter:blur();backdrop-filter:blur();pointer-events:none;opacity:0;background:#0a081000;flex-direction:column;justify-content:center;align-items:center;gap:20px;transition:background .4s,-webkit-backdrop-filter .4s,backdrop-filter .4s,opacity .3s;display:flex;position:fixed;inset:0}.shutdown-screen.active{-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);pointer-events:auto;opacity:1;background:#0a0810eb}.shutdown-status{color:#8276b0;letter-spacing:.04em;font-family:CommitMono,Cascadia Code,Fira Code,Consolas,Menlo,monospace;font-size:12px;transition:color .3s}.shutdown-screen.done .loading-spinner{opacity:.3;border-color:#2a2440;animation:none}.shutdown-screen.done .shutdown-status{color:#4a4268}</style>
|
|
10
|
-
<script type="module" crossorigin src="/assets/index-
|
|
10
|
+
<script type="module" crossorigin src="/assets/index-CUxRHbCS.js"></script>
|
|
11
11
|
<link rel="stylesheet" crossorigin href="/assets/index-DE2GUmqs.css">
|
|
12
12
|
</head>
|
|
13
13
|
<body>
|
package/dist/server/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "glimmervoid",
|
|
3
|
-
"version": "0.35.
|
|
3
|
+
"version": "0.35.1",
|
|
4
4
|
"description": "Mission control for coding agents: run and supervise Claude Code, Codex and Grok sessions in parallel git worktrees from one local browser dashboard",
|
|
5
5
|
"main": "dist/server/index.js",
|
|
6
6
|
"type": "module",
|