@faithfulalabi/agent-lens 0.10.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/db/read.js +2 -1
- package/dist/src/db/schema.js +2 -6
- package/dist/src/project/pipeline.js +5 -3
- package/dist/src/transcript/attachments.js +5 -1
- package/dist/src/transcript/line.js +34 -0
- package/dist/src/transcript/version.js +1 -1
- package/package.json +1 -1
- package/ui/dist/assets/{index-Dt-L4gyy.js → index-De9wOnVP.js} +2 -2
- package/ui/dist/index.html +1 -1
package/dist/src/db/read.js
CHANGED
|
@@ -135,7 +135,8 @@ const EVENT_COLUMNS = `id, turn_id, seq, kind, ts, request_id, block_index, name
|
|
|
135
135
|
wire_input, wire_input_bytes, wire_input_storage,
|
|
136
136
|
text, text_bytes, output_storage, spill_path, spill_bytes,
|
|
137
137
|
model, tokens_in, tokens_out, tokens_cache_read, tokens_cache_write, est_cost,
|
|
138
|
-
child_session_id, agent_type, agent_status, raw_type, raw_subtype, image_count
|
|
138
|
+
child_session_id, agent_type, agent_status, raw_type, raw_subtype, image_count,
|
|
139
|
+
json_extract(attrs, '$.renderedRole') AS rendered_role`;
|
|
139
140
|
export function buildEventPageSql(session_id, query) {
|
|
140
141
|
return {
|
|
141
142
|
sql: `SELECT ${EVENT_COLUMNS} FROM events WHERE session_id = ? AND seq >= ?` +
|
package/dist/src/db/schema.js
CHANGED
|
@@ -197,11 +197,6 @@ CREATE TABLE events (
|
|
|
197
197
|
seq INTEGER NOT NULL, -- thread order; deterministic from the file bytes
|
|
198
198
|
kind TEXT NOT NULL, -- prompt | text | thinking | tool_call
|
|
199
199
|
-- | error | compaction | unknown
|
|
200
|
-
-- MEASURED 2026-09-11 (30,286 events): 'error'
|
|
201
|
-
-- has 0 rows, REACHABLE BUT UNOBSERVED — writer
|
|
202
|
-
-- pipeline.ts:306, gated on the harness line
|
|
203
|
-
-- subtype 'api_error'. Keep the arm; see
|
|
204
|
-
-- task 0.12.
|
|
205
200
|
ts TEXT NOT NULL,
|
|
206
201
|
request_id TEXT, -- groups the N lines of ONE assistant response
|
|
207
202
|
-- (1:1 with message.id; 13,629/13,630 lines = 1 block)
|
|
@@ -276,7 +271,8 @@ CREATE TABLE events (
|
|
|
276
271
|
raw_subtype TEXT,
|
|
277
272
|
attrs TEXT NOT NULL DEFAULT '{}' -- ALLOWLIST ONLY: attributionSkill,
|
|
278
273
|
-- attributionAgent, effort, permissionMode,
|
|
279
|
-
-- compactMetadata, toolDenialKind,
|
|
274
|
+
-- compactMetadata, toolDenialKind, renderedRole,
|
|
275
|
+
-- unknown_fields[]
|
|
280
276
|
);
|
|
281
277
|
CREATE UNIQUE INDEX idx_events_session_seq ON events(session_id, seq);
|
|
282
278
|
CREATE INDEX idx_events_turn ON events(turn_id, seq);
|
|
@@ -2,7 +2,7 @@ import { asyncAgentLaunch, taskNotification } from '../transcript/agents.js';
|
|
|
2
2
|
import { attachmentRecord } from '../transcript/attachments.js';
|
|
3
3
|
import { contentBlocks, imageCount, resultText } from '../transcript/blocks.js';
|
|
4
4
|
import { isHumanPrompt, MACHINERY_TAGS } from '../transcript/human.js';
|
|
5
|
-
import { foldControlLines, foldSessionEnvelope, permissionDecision, promptGroupId, toolDenialKind, turnDurationMs, } from '../transcript/line.js';
|
|
5
|
+
import { apiErrorText, foldControlLines, foldSessionEnvelope, permissionDecision, promptGroupId, toolDenialKind, turnDurationMs, } from '../transcript/line.js';
|
|
6
6
|
import { foldRequestGroup, groupByRequestId, modelOfRequestGroup, requestIdOf, } from '../transcript/usage.js';
|
|
7
7
|
import { joinToolCalls, NO_INPUT, NO_WIRE_INPUT, toolInput, wireInput, } from './tools.js';
|
|
8
8
|
import { wireInputOf } from '../transcript/wire.js';
|
|
@@ -178,7 +178,9 @@ export function runPipeline(lines, ctx) {
|
|
|
178
178
|
const blocks = blocksAt[index];
|
|
179
179
|
const human = humanAt[index];
|
|
180
180
|
const usage = usageAt.get(index);
|
|
181
|
-
const
|
|
181
|
+
const record = blocks.length === 0 ? attachmentRecord(line) : undefined;
|
|
182
|
+
const lineText = blocks.length === 0 ? (record?.text ?? apiErrorText(line)) : undefined;
|
|
183
|
+
const attrs = record?.role === undefined ? '{}' : JSON.stringify({ renderedRole: record.role });
|
|
182
184
|
let stamped = false;
|
|
183
185
|
const emit = (block, blockIndex) => {
|
|
184
186
|
if (block?.kind === 'unknown_block')
|
|
@@ -225,7 +227,7 @@ export function runPipeline(lines, ctx) {
|
|
|
225
227
|
tokens_cache_write: tokens?.cache_creation_input_tokens,
|
|
226
228
|
raw_type: rawTypeOf(line),
|
|
227
229
|
raw_subtype: rawSubtypeOf(line),
|
|
228
|
-
attrs
|
|
230
|
+
attrs,
|
|
229
231
|
});
|
|
230
232
|
ownerOfEvent.push(segmentOf[index]);
|
|
231
233
|
};
|
|
@@ -9,5 +9,9 @@ export function attachmentRecord(line) {
|
|
|
9
9
|
const subtype = str(obj(line.raw.attachment, undefined)?.type, '');
|
|
10
10
|
const first = arr(line.raw.rendered, NO_ELEMENTS)[0];
|
|
11
11
|
const rendered = str(obj(first, undefined)?.content, undefined);
|
|
12
|
-
return {
|
|
12
|
+
return {
|
|
13
|
+
subtype,
|
|
14
|
+
text: rendered ?? placeholder(subtype),
|
|
15
|
+
role: str(line.raw.renderedRole, undefined),
|
|
16
|
+
};
|
|
13
17
|
}
|
|
@@ -107,6 +107,11 @@ const LINE_TYPES = new Map([
|
|
|
107
107
|
'hookAdditionalContext',
|
|
108
108
|
'pendingBackgroundAgentCount',
|
|
109
109
|
'pendingWorkflowCount',
|
|
110
|
+
'error',
|
|
111
|
+
'maxRetries',
|
|
112
|
+
'retryAttempt',
|
|
113
|
+
'retryInMs',
|
|
114
|
+
'source',
|
|
110
115
|
]),
|
|
111
116
|
},
|
|
112
117
|
],
|
|
@@ -118,6 +123,8 @@ const LINE_TYPES = new Map([
|
|
|
118
123
|
'attachment',
|
|
119
124
|
'rendered',
|
|
120
125
|
'renderedInHumanTurn',
|
|
126
|
+
'renderedRole',
|
|
127
|
+
'renderedBesideToolResult',
|
|
121
128
|
]),
|
|
122
129
|
},
|
|
123
130
|
],
|
|
@@ -275,6 +282,33 @@ export function turnDurationMs(line) {
|
|
|
275
282
|
? num(line.raw.durationMs, undefined)
|
|
276
283
|
: undefined;
|
|
277
284
|
}
|
|
285
|
+
function phrase(value) {
|
|
286
|
+
let text = str(value, '').trim();
|
|
287
|
+
while (/[.!?:;,]/.test(text.slice(-1)))
|
|
288
|
+
text = text.slice(0, -1).trimEnd();
|
|
289
|
+
return text === '' ? undefined : text;
|
|
290
|
+
}
|
|
291
|
+
export function apiErrorText(line) {
|
|
292
|
+
if (line.kind !== 'system' || line.subtype !== 'api_error')
|
|
293
|
+
return undefined;
|
|
294
|
+
const error = obj(line.raw.error, undefined);
|
|
295
|
+
const cause = phrase(error?.formatted) ?? phrase(error?.message);
|
|
296
|
+
const code = phrase(obj(error?.connection, undefined)?.code);
|
|
297
|
+
const ceiling = num(line.raw.maxRetries, undefined);
|
|
298
|
+
const delayMs = num(line.raw.retryInMs, undefined);
|
|
299
|
+
const retry = [
|
|
300
|
+
num(line.raw.retryAttempt, undefined),
|
|
301
|
+
ceiling === undefined ? undefined : `of ${ceiling}`,
|
|
302
|
+
delayMs === undefined ? undefined : `in ${delayMs} ms`,
|
|
303
|
+
].filter((part) => part !== undefined);
|
|
304
|
+
const clauses = [];
|
|
305
|
+
const what = cause !== undefined && code !== undefined ? `${cause} (${code})` : (cause ?? code);
|
|
306
|
+
if (what !== undefined)
|
|
307
|
+
clauses.push(`${what}.`);
|
|
308
|
+
if (retry.length > 0)
|
|
309
|
+
clauses.push(`Retry ${retry.join(' ')}.`);
|
|
310
|
+
return clauses.length === 0 ? undefined : clauses.join(' ');
|
|
311
|
+
}
|
|
278
312
|
const SYNTHETIC_MODEL = '<synthetic>';
|
|
279
313
|
export function foldSessionEnvelope(lines) {
|
|
280
314
|
const envelope = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const PROJECTOR_VERSION =
|
|
1
|
+
export const PROJECTOR_VERSION = 18;
|
package/package.json
CHANGED
|
@@ -223,7 +223,7 @@ Error generating stack: `+l.message+`
|
|
|
223
223
|
|
|
224
224
|
`);e=i.pop()??"";const l=[];for(const o of i){const s=Cw(o);s!==void 0&&l.push(s)}return l}}}function Cw(e){const t=[];let n,r,i,l=!1;for(const s of e.split(`
|
|
225
225
|
`)){if(s===""||s.startsWith(":"))continue;const a=s.indexOf(":"),u=a===-1?s:s.slice(0,a),d=a===-1?"":s.slice(a+1),c=d.startsWith(" ")?d.slice(1):d;switch(u){case"event":n=c,l=!0;break;case"data":t.push(c),l=!0;break;case"id":r=c,l=!0;break;case"retry":/^\d+$/.test(c)&&(i=Number(c)),l=!0;break}}if(!l)return;const o={event:n??"message",data:t.join(`
|
|
226
|
-
`)};return r!==void 0&&(o.id=r),i!==void 0&&(o.retry=i),o}function Ew(e={}){const t=e.path??gw,n=e.fetchImpl??globalThis.fetch,r=e.sleepImpl??jw,i=e.now??(()=>Date.now()),l=e.random??(()=>Math.random()),o=e.watchdogMs??kw,s=e.bootstrap??eg(),a=new AbortController;let u=!1,d,c={kind:"connecting"},f,p=0,x=0;function v(I){var E;c.kind==="closed"||c.kind==="auth_error"||(c=I,(E=e.onState)==null||E.call(e,I))}function _(I){var E;(E=e.onError)==null||E.call(e,I)}function m(I){if(!Number.isFinite(o))return;const E=++p;x=i()+o,(async()=>{for(;E===p&&!I.signal.aborted;){const j=x-i();if(j<=0){I.abort(new DOMException("agent-lens: stream went silent","AbortError"));return}await r(j,I.signal)}})()}function g(){Number.isFinite(o)&&(x=i()+o)}function k(){p+=1}function C(I){var j;if(g(),I.event==="heartbeat")return;if(I.event==="error"){_(new Error(`agent-lens: the stream reported an error (${I.data})`));return}if(!Sw.has(I.event))return;let E;try{E=JSON.parse(I.data)}catch(S){_(new Error(`agent-lens: could not decode a "${I.event}" payload (${S instanceof Error?S.message:String(S)})`));return}(j=e.onEvent)==null||j.call(e,{event:I.event,data:E,...I.id===void 0?{}:{id:I.id}})}async function N(){const I=new AbortController;d=I;let E=!1,j,S;try{const z=await n(t,{method:"GET",headers:{[s.tokenHeader]:s.token},signal:I.signal});if(z.status===401||z.status===403)j=new tg(z.status,await Iw(z));else if(!z.ok)S=new Error(`agent-lens: the stream returned HTTP ${z.status}`);else if(z.body===null)S=new Error("agent-lens: the stream response carried no body");else{E=!0,v({kind:"open"}),m(I);const O=z.body.getReader(),U=new TextDecoder,Q=bw();for(;;){const{done:W,value:X}=await O.read();if(W)break;for(const re of Q.push(U.decode(X,{stream:!0})))C(re)}}}catch(z){S=z}finally{k(),d=void 0}return u?{kind:"closed"}:j!==void 0?{kind:"auth",error:j}:(S!==void 0&&!Nw(S)&&_(Tw(S)),{kind:"retry",reachedOpen:E})}async function b(){let I=0;for(;!u;){v({kind:"connecting"});const E=await N();if(E.kind==="closed")break;if(E.kind==="auth"){v({kind:"auth_error",error:E.error});return}E.reachedOpen&&(I=0);const j=_w(I,l);I+=1,v({kind:"reconnecting",attempt:I,nextRetryAt:i()+j}),await r(j,a.signal)}v({kind:"closed"})}return{start(){return f??(f=b()),f},close(){u||(u=!0,v({kind:"closed"}),k(),a.abort(),d==null||d.abort(new DOMException("agent-lens: stream closed","AbortError")))},get state(){return c}}}function _w(e,t){return t()*Math.min(ww,vw*2**e)}async function Iw(e){try{const t=(await e.text()).trim();return t===""?`HTTP ${e.status}`:t}catch{return`HTTP ${e.status}`}}function Nw(e){return typeof e=="object"&&e!==null&&e.name==="AbortError"}function Tw(e){return e instanceof Error?e:new Error(String(e))}function jw(e,t){return new Promise(n=>{if((t==null?void 0:t.aborted)===!0){n();return}const r=()=>{clearTimeout(i),t==null||t.removeEventListener("abort",r),n()},i=setTimeout(r,e);t==null||t.addEventListener("abort",r,{once:!0})})}function zw(e,t={}){const n=L.useRef(e);n.current=e;const r=L.useRef(t);r.current=t,L.useEffect(()=>{const l=(r.current.create??Ew)({onEvent:({event:o,data:s})=>{o==="session_changed"?n.current.publish({event:o,data:s}):o==="session_indexed"?n.current.publish({event:o,data:s}):o==="warm_progress"&&n.current.publish({event:o,data:s})},onState:o=>{var s,a;return(a=(s=r.current).onState)==null?void 0:a.call(s,o)}});return l.start(),()=>l.close()},[])}const Pw=/^\d+$/;function qd(e){const t=Aw(e);if(t==="/")return{name:"sessions"};if(t==="/showcase")return{name:"showcase"};if(t==="/search")return{name:"search"};const n=t.slice(1).split("/");if(n[0]==="search"&&n.length===3&&n[1]==="session"){const r=Kd(n[2]);if(r!==void 0&&r!=="")return{name:"search",sessionId:r}}if(n[0]==="session"){const r=Kd(n[1]);if(r!==void 0&&r!==""){if(n.length===2)return{name:"session",sessionId:r};if(n.length===4&&Pw.test(n[3]??"")){if(n[2]==="trace")return{name:"trace",sessionId:r,turnSeq:Number(n[3])};if(n[2]==="event")return{name:"event",sessionId:r,seq:Number(n[3])}}}}return{name:"not_found",path:e}}function Hn(e){switch(e.name){case"sessions":return"/";case"showcase":return"/showcase";case"session":return`/session/${encodeURIComponent(e.sessionId)}`;case"trace":return`/session/${encodeURIComponent(e.sessionId)}/trace/${e.turnSeq}`;case"search":return e.sessionId===void 0?"/search":`/search/session/${encodeURIComponent(e.sessionId)}`;case"event":return`/session/${encodeURIComponent(e.sessionId)}/event/${e.seq}`;case"not_found":return e.path}}function Aw(e){var r;const t=((r=e.split("?")[0])==null?void 0:r.split("#")[0])??"",n=t.startsWith("/")?t:`/${t}`;return n.length>1&&n.endsWith("/")?n.slice(0,-1):n}function Kd(e){if(e!==void 0)try{return decodeURIComponent(e)}catch{return e}}function Lw(){return{path:()=>window.location.pathname,push:e=>{window.history.pushState(null,"",e)},replace:e=>{window.history.replaceState(null,"",e)},onPopState:e=>(window.addEventListener("popstate",e),()=>{window.removeEventListener("popstate",e)})}}function Mw(e=Lw()){const t=new Set;let n=e.path(),r=qd(n);function i(){const l=e.path();if(l!==n){n=l,r=qd(l);for(const o of[...t])o()}}return e.onPopState(i),{getRoute:()=>r,navigate(l,o={}){const s=Hn(l);o.replace===!0?e.replace(s):e.push(s),i()},subscribe(l){return t.add(l),()=>{t.delete(l)}}}}let Gd;function rg(){return Gd??(Gd=Mw()),Gd}function Rw(e=rg()){return L.useSyncExternalStore(e.subscribe,e.getRoute,e.getRoute)}const ig={kind:"loading"};function Ow(){return{requestId:0,state:ig}}function Dw(e,t){return t.type==="start"?{requestId:t.requestId,state:ig}:t.requestId!==e.requestId?e:{requestId:e.requestId,state:t.type==="resolve"?{kind:"ok",value:t.value}:{kind:"error",error:t.error}}}function Wu(e,t,n=0){const[r,i]=L.useReducer(Dw,Ow()),l=L.useRef(0),o=L.useRef(t);return o.current=t,L.useEffect(()=>{const s=++l.current,a=new AbortController;return i({type:"start",requestId:s}),o.current(a.signal).then(u=>i({type:"resolve",requestId:s,value:u}),u=>i({type:"reject",requestId:s,error:u})),()=>a.abort()},[e,n]),r.state}const ms="<mark>",Qd="</mark>";function Fw(e){if(e==null||e==="")return[];const t=[];let n=e;for(;n!=="";){const r=n.indexOf(ms);if(r===-1)break;const i=n.indexOf(Qd,r+ms.length);if(i===-1)break;r>0&&t.push({text:n.slice(0,r),matched:!1});const l=n.slice(r+ms.length,i);l!==""&&t.push({text:l,matched:!0}),n=n.slice(i+Qd.length)}return n!==""&&t.push({text:n,matched:!1}),t}function $w(e){const t=e.trim();return t===""?{kind:"idle"}:{kind:"search",q:t}}function Vw(e){return e==="session"?"Searching this session.":"Searching all projected transcripts, including sub-agent transcripts the session list does not show."}function Bw(e,t,n){if(e.kind==="idle"||t>0)return null;const r=`No matches for ${JSON.stringify(e.q)}.`;return n>0?`${r} ${n} transcripts are not indexed yet, so this answer covers part of the corpus.`:r}function Uw(e){const t=new Map;for(const n of e){const r=t.get(n.session_id);if(r===void 0){t.set(n.session_id,{sessionId:n.session_id,title:n.session_title,projectPath:n.project_path,hits:[n]});continue}r.hits.push(n)}return[...t.values()]}function Hw(e,t){return t===null?`Warm the remaining ${e}`:t.done>=t.total?`Warmed ${t.total} transcripts`:`Warming ${t.done} of ${t.total}`}function Ww(e,t){if(e===null)return{latch:null,revealIndex:void 0};const n=t.findIndex(r=>r.id===e.eventId);return n===-1?{latch:e,revealIndex:void 0}:{latch:null,revealIndex:n,selectedId:e.eventId,focusedIndex:n}}function qw({hit:e}){const t=Fw(e.snippet);return h.jsxs("a",{href:Hn({name:"event",sessionId:e.session_id,seq:e.seq}),"data-slot":"search-hit","data-event-id":e.event_id,className:"flex flex-col gap-0.5 rounded-md px-2 py-1.5 text-xs text-foreground transition-colors hover:bg-surface",children:[h.jsxs("span",{className:"flex items-center gap-2 text-2xs uppercase tracking-widest text-muted",children:[h.jsx("span",{children:e.kind}),e.name===null?null:h.jsx("span",{className:"truncate",children:e.name}),h.jsxs("span",{className:"ml-auto font-mono",children:["#",e.seq]})]}),h.jsx("span",{className:"min-w-0 font-mono text-2xs leading-relaxed text-muted",children:t.map((n,r)=>n.matched?h.jsx("mark",{className:"bg-surface-raised text-foreground",children:n.text},r):h.jsx("span",{children:n.text},r))})]})}function Kw({scope:e,unprojectedCount:t,warm:n=null,onWarm:r}){return e==null?null:h.jsxs("div",{"data-slot":"search-scope",role:"status",className:"flex items-center gap-2 border-b border-border px-3 py-1.5 text-2xs text-muted",children:[h.jsx("span",{className:"min-w-0",children:Vw(e)}),t>0?h.jsx("button",{type:"button","data-slot":"search-warm",onClick:r,className:"ml-auto shrink-0 rounded-md bg-surface px-2 py-0.5 uppercase tracking-widest transition-colors hover:text-foreground",children:Hw(t,n)}):null]})}function Gw({sessionId:e,api:t}={}){const n=L.useMemo(()=>t??Hu(),[t]),[r,i]=L.useState(""),l=$w(r),o=Wu(`${l.kind==="idle"?"":l.q}|${e??""}`,p=>l.kind==="idle"?Promise.resolve(null):n.search(l.q,e===void 0?{}:{session:e},{signal:p})),s=o.kind==="ok"?o.value:null,[a,u]=L.useState(null),d=(s==null?void 0:s.unprojected_count)??0,c=Uw((s==null?void 0:s.items)??[]),f=o.kind==="ok"?Bw(l,(s==null?void 0:s.items.length)??0,d):null;return h.jsxs("main",{"data-slot":"search-view",className:"flex h-full min-h-0 flex-col",children:[h.jsx("div",{className:"flex h-12 shrink-0 items-center gap-3 border-b border-border px-3",children:h.jsx("input",{"data-slot":"search-input",type:"search",value:r,onChange:p=>{i(p.target.value)},placeholder:"Search transcripts","aria-label":"Search transcripts",className:"min-w-0 flex-1 bg-transparent text-sm text-foreground outline-none placeholder:text-muted"})}),h.jsx(Kw,{scope:(s==null?void 0:s.scope)??null,unprojectedCount:d,warm:a,onWarm:()=>{n.warm().then(({queued:p})=>{u({done:0,total:p})}).catch(()=>{})}}),h.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 py-2",children:o.kind==="error"?h.jsx("p",{className:"text-sm text-error",children:o.error.message}):f!==null?h.jsx("p",{"data-slot":"search-empty",className:"text-xs text-muted",children:f}):c.map(p=>h.jsxs("section",{className:"mb-3 flex flex-col gap-0.5",children:[h.jsx("h2",{className:"truncate px-2 text-2xs uppercase tracking-widest text-muted",children:p.title??p.projectPath}),p.hits.map(x=>h.jsx(qw,{hit:x},x.event_id))]},p.sessionId))})]})}function lg(e,t){const[n,r]=L.useState(null),i=t!==null&&t.image_count>0?t.id:null,l=(t==null?void 0:t.image_count)??0;return L.useEffect(()=>{if(e===void 0||i===null)return;const o=new AbortController,s=[],a=u=>e.getEventImage(i,u,{signal:o.signal}).then(d=>{if(o.signal.aborted)return{status:null};const c=URL.createObjectURL(d);return s.push(c),{url:c}},d=>({status:d instanceof Uu?d.status:null}));return Promise.all(Array.from({length:l},(u,d)=>a(d))).then(u=>{o.signal.aborted||r({eventId:i,outcomes:u})}),()=>{o.abort();for(const u of s)URL.revokeObjectURL(u);r(u=>(u==null?void 0:u.eventId)===i?null:u)}},[e,i,l]),n}function Yd(e=new Set){return{selectedId:void 0,expandedIds:e,focusedIndex:0}}function qu(e,t){return t<=0?0:Math.min(Math.max(e,0),t-1)}function Qw(e,t){const n=new Set(e);return n.add(t),n}function Yw(e,t){const n=new Set(e);return n.delete(t),n}function Xd(e,t){const n=e[t];if(n===void 0)return t;for(let r=t-1;r>=0;r-=1){const i=e[r];if(i!==void 0&&i.depth<n.depth)return r}return t}function Lt(e,t,n){const r=qu(t,n.length);return r===e.focusedIndex?e:{...e,focusedIndex:r}}function Xw(e,t,n){const r=qu(e.focusedIndex,t.length),i=e.selectedId!==void 0&&n.has(e.selectedId)?e.selectedId:void 0;return r===e.focusedIndex&&i===e.selectedId?e:{...e,focusedIndex:r,selectedId:i}}function Jd(e,t){const n=new Set(e.expandedIds);for(const r of t)n.add(r);return n.size===e.expandedIds.size?e:{...e,expandedIds:n}}function Jw(e,t,n){const r=qu(e.focusedIndex,n.length),i=n[r];switch(t){case"j":case"ArrowDown":return Lt(e,r+1,n);case"k":case"ArrowUp":return Lt(e,r-1,n);case"Home":return Lt(e,0,n);case"End":return Lt(e,n.length-1,n);case"Enter":return i===void 0||i.id===e.selectedId?Lt(e,r,n):{...e,focusedIndex:r,selectedId:i.id};case"Escape":return Lt(e,Xd(n,r),n);case"ArrowRight":return i===void 0||!i.hasChildren?Lt(e,r,n):i.expanded?Lt(e,r+1,n):{...e,focusedIndex:r,expandedIds:Qw(e.expandedIds,i.id)};case"ArrowLeft":return i!==void 0&&i.hasChildren&&i.expanded?{...e,focusedIndex:r,expandedIds:Yw(e.expandedIds,i.id)}:Lt(e,Xd(n,r),n);default:return Lt(e,r,n)}}function Zw(e,t){return t.type==="rows-changed"?Xw(e,t.rows,t.modelIds):Jw(e,t.key,t.rows)}const eS=["thread","tree"],Zd="reasoning not recorded (signature only)",ef=Bm*5;function tS(e){return[...e].sort((t,n)=>t.seq-n.seq).map(nS)}function nS(e){const t=Km(e.kind);switch(t){case"tool_call":return{kind:"tool",event:e,name:e.name??e.kind,status:Vu(e.status),input:Ri(e.input,ef),output:Ri(e.text,ef)};case"thinking":return rS(e);case"unknown":return iS(e);default:return{kind:"message",event:e,eventKind:t,text:og(e.text)}}}function rS(e){const t=Ri(e.text);return t===null||t===Zd?{kind:"thinking",event:e,text:Zd,recorded:!1}:{kind:"thinking",event:e,text:t,recorded:!0}}function iS(e){const t=og(e.text);return{kind:"unknown",event:e,label:t===null?`unrecognized record (type=${tf(e)})`:tf(e),text:t,record:JSON.stringify(lS(e),null,2)}}function tf(e){const t=e.raw_subtype;return t===null||t===""?e.raw_type:`${e.raw_type}/${t}`}function lS(e){return{id:e.id,seq:e.seq,ts:e.ts,turn_id:e.turn_id,kind:e.kind,raw_type:e.raw_type,raw_subtype:e.raw_subtype}}function og(e){return e===null||e.trim()===""?null:e}function oS(e){const t=[];for(const n of e)if(n.kind==="message")t.push({kind:"message",id:n.event.id,row:n});else{const r=t.at(-1);(r==null?void 0:r.kind)==="activity"?r.rows.push(n):t.push({kind:"activity",id:n.event.id,rows:[n]})}return t}function sS(e){const t=e.filter(l=>l.kind==="tool"),n=t.filter(l=>l.event.child_session_id!==null).length,r=e.filter(l=>l.kind==="thinking").length,i=e.filter(l=>l.kind==="unknown").length;return[t.length>0?`${t.length} tool ${t.length===1?"call":"calls"}`:"",n>0?`${n} ${n===1?"subagent":"subagents"}`:"",r>0?"reasoning":"",i>0?`${i} ${i===1?"record":"records"}`:""].filter(Boolean).join(" · ")}function aS(){const e=new Set,t=new Set;return{isDismissed:n=>e.has(n),dismiss(n){if(!e.has(n)){e.add(n);for(const r of t)r()}},subscribe(n){return t.add(n),()=>{t.delete(n)}}}}const gs=aS();function sg(e){return{dismissed:L.useSyncExternalStore(gs.subscribe,()=>gs.isDismissed(e),()=>!1),dismiss:()=>gs.dismiss(e)}}function uS(e){const t=q0(e),{dismissed:n,dismiss:r}=sg(`drift:${e.sessionId}`);return t===null||n?null:h.jsxs("div",{"data-slot":"drift-banner",role:"alert",className:"flex items-center gap-2 border-b border-border bg-surface px-3 py-1.5 text-2xs text-error",children:[h.jsx(Yk,{size:12,"aria-hidden":"true",className:"shrink-0"}),h.jsx("span",{className:"min-w-0",children:t}),h.jsx("button",{type:"button","aria-label":"Dismiss unrecognized records notice",title:"Dismiss until reload",onClick:r,className:"ml-auto flex size-6 shrink-0 items-center justify-center rounded-md text-muted hover:bg-surface-raised hover:text-foreground",children:h.jsx(bm,{size:14,"aria-hidden":"true"})})]})}const cS=["inline","line_ref","spill","missing"];function dS(e){return cS.find(t=>t===e)??"unclassified"}const fS="Nothing was recorded for this half.",pS="Full output no longer on disk.",ag="Showing the stored head of a larger body.",hS="The body was written to a file beside the transcript.";function ug(e,t,n){const r=mS(e,t,n),i=r===null?gS(e,t):r.content,l=dS(r===null?xS(e,t):r.storage),o=i!==null&&i!=="";switch(l){case"missing":return Yr("missing",pS,o?i:null,!1,!1);case"spill":return Yr("spill",o?null:hS,o?i:null,!1,!o);case"line_ref":{const s=r===null||r.truncated;return Yr("line_ref",s?ag:null,i,s,s)}default:return o?Yr(l,null,i,!1,!1):Yr("empty",fS,null,!1,!1)}}function Yr(e,t,n,r,i){return{kind:e,note:t,body:n,truncated:r,canRefetch:i}}function mS(e,t,n){return n===null?null:n.id===e.id&&n.field===t?n:null}function gS(e,t){return t==="input"?e.input:e.text}function xS(e,t){return t==="input"?e.input_storage:e.output_storage}function cg(e){const t=e.wire_input;return t===null||t===""?null:{body:t,note:e.wire_input_storage==="line_ref"?ag:null}}const yS=new Map([[410,"Image no longer on disk."],[413,"Image too large to serve."],[415,"Image type not displayable."]]),kS="Image could not be read.";function vS(e,t){const n=(t==null?void 0:t.eventId)===e.id?t.outcomes:[];return Array.from({length:e.image_count},(r,i)=>wS(n[i]))}function wS(e){return e===void 0?{url:null,note:null}:"url"in e?{url:e.url,note:null}:{url:null,note:(e.status===null?void 0:yS.get(e.status))??kS}}function SS(e,t){return t===null||t.id!==e.id||t.fields.length===0?null:t.fields}function dg({event:e,images:t}){const n=vS(e,t);return n.length===0?null:h.jsx("section",{"data-slot":"event-images",className:"flex flex-col gap-2 pt-2",children:n.map((r,i)=>h.jsxs("figure",{"data-slot":"event-image",children:[r.url===null?null:h.jsx("a",{href:r.url,target:"_blank",rel:"noreferrer",children:h.jsx("img",{src:r.url,alt:`image ${i+1} of ${n.length}`,className:"max-h-96 max-w-full rounded-md border border-border object-contain"})}),r.note===null?null:h.jsx("figcaption",{"data-slot":"event-image-note",className:"text-2xs text-faint",children:r.note})]},i))})}const bS="No event is selected.";function CS({event:e,fetched:t,images:n=null,onShowFull:r,unrecognised:i}){return h.jsx("aside",{"data-slot":"span-detail",...e===null?{}:{"data-event-id":e.id},className:"w-96 shrink-0 overflow-y-auto p-3 text-xs text-foreground",children:e===null?h.jsx("p",{className:"text-faint",children:bS}):h.jsxs(h.Fragment,{children:[h.jsx(ES,{event:e}),h.jsx(nf,{event:e,field:"input",title:"INPUT",fetched:t,onShowFull:r}),h.jsx(_S,{event:e}),h.jsx(nf,{event:e,field:"text",title:"OUTPUT",fetched:t,onShowFull:r}),h.jsx(dg,{event:e,images:n}),h.jsx(jS,{event:e,body:i??null}),h.jsx(zS,{event:e})]})})}function ES({event:e}){return h.jsxs("header",{"data-slot":"detail-heading",className:"border-b border-border pb-2",children:[h.jsx("p",{className:"truncate font-mono text-sm",children:e.name??e.kind}),h.jsx("p",{className:"truncate font-mono text-2xs text-faint",children:e.ts})]})}function nf({event:e,field:t,title:n,fetched:r,onShowFull:i}){const l=ug(e,t,r);return h.jsxs("section",{"data-slot":`detail-${t}`,"data-content-state":l.kind,className:"pt-3",children:[h.jsxs("div",{className:"flex items-baseline gap-2",children:[h.jsx("h2",{className:"text-2xs tracking-widest text-muted",children:n}),h.jsx(NS,{content:l})]}),h.jsx(TS,{content:l}),l.canRefetch&&i!==void 0?h.jsx("button",{type:"button","data-slot":"detail-show-full",onClick:()=>i(e.id,t),className:"mt-1 font-mono text-2xs text-accent",children:"Show full"}):null]})}function _S({event:e}){const t=cg(e);return t===null?null:h.jsxs("section",{"data-slot":"detail-wire-input",className:"pt-3",children:[h.jsxs("div",{className:"flex items-baseline gap-2",children:[h.jsx("h2",{className:"text-2xs tracking-widest text-muted",children:"WHAT RAN"}),h.jsx("span",{"data-slot":"detail-wire-label",className:"rounded-md bg-surface-raised px-1.5 py-0.5 font-mono text-2xs text-muted",children:"differs from input"})]}),h.jsx(IS,{wire:t})]})}function IS({wire:e}){return h.jsxs(h.Fragment,{children:[e.note===null?null:h.jsx("p",{"data-slot":"detail-wire-note",className:"pt-1 text-2xs text-faint",children:e.note}),h.jsx("pre",{"data-slot":"detail-wire-body",className:"mt-1 whitespace-pre-wrap break-words font-mono text-2xs text-foreground",children:e.body})]})}function NS({content:e}){return h.jsx("span",{"data-slot":"detail-storage",className:"rounded-md bg-surface-raised px-1.5 py-0.5 font-mono text-2xs text-muted",children:e.kind})}function TS({content:e}){return h.jsxs(h.Fragment,{children:[e.note===null?null:h.jsx("p",{"data-slot":"detail-note",className:"pt-1 text-2xs text-faint",children:e.note}),e.body===null?null:h.jsx("pre",{"data-slot":"detail-body",className:"mt-1 whitespace-pre-wrap break-words font-mono text-2xs text-foreground",children:e.body})]})}function jS({event:e,body:t}){const n=SS(e,t);return n===null?null:h.jsxs("details",{"data-slot":"detail-unrecognised",className:"mt-3 border-t border-border pt-2",children:[h.jsx("summary",{className:"cursor-pointer text-2xs text-muted",children:`Unrecognized fields (${n.length})`}),n.map(r=>h.jsxs("div",{className:"pt-1",children:[h.jsxs("p",{className:"font-mono text-2xs text-muted",children:[r.name,r.line==="result"?h.jsx("span",{className:"text-faint",children:" (on the tool result)"}):null]}),h.jsx("pre",{className:"mt-1 whitespace-pre-wrap break-words font-mono text-2xs text-foreground",children:r.value})]},`${r.line}:${r.name}`))]})}function zS({event:e}){return h.jsxs("details",{"data-slot":"detail-raw",className:"mt-3 border-t border-border pt-2",children:[h.jsx("summary",{className:"cursor-pointer text-2xs text-muted",children:"Raw record"}),h.jsx("pre",{className:"mt-1 whitespace-pre-wrap break-words font-mono text-2xs text-muted",children:JSON.stringify(e,null,2)})]})}function PS({label:e,onResume:t}){return e===null?null:h.jsxs("button",{type:"button","data-slot":"follow-pill",onClick:t,className:"flex items-center gap-1.5 rounded-full border border-border bg-surface px-3 py-1 text-2xs text-fg shadow-sm",children:[h.jsxs("span",{children:["Following paused — ",e]}),h.jsx(To,{size:12,"aria-hidden":"true",className:"shrink-0"})]})}function Ku({duration:e,tokens:t,cost:n,costUnknown:r,className:i}){return h.jsxs("span",{"data-slot":"metric-chips",className:fe("inline-flex items-center gap-1",i),children:[h.jsx(xs,{slot:"metric-duration",children:e}),h.jsx(xs,{slot:"metric-tokens",children:t}),h.jsx(xs,{slot:"metric-cost",unknown:r,children:n})]})}function xs({slot:e,unknown:t,children:n}){return n===void 0?null:h.jsx("span",{"data-slot":e,title:t,"aria-label":t,className:fe("rounded-md bg-surface-raised px-1.5 py-0.5 font-mono text-2xs",t===void 0?"text-muted":"text-faint"),children:n})}const fg={live:{badge:"text-running",dot:"bg-running animate-live-pulse",label:"live"},complete:{badge:"text-muted",dot:"bg-success",label:"complete"},interrupted:{badge:"text-warning",dot:"bg-warning",label:"interrupted"}},Te={type:{llm_call:{tint:"text-span-llm",Icon:qk,label:"model call"},tool_call:{tint:"text-span-tool",Icon:ev,label:"tool call"},thinking:{tint:"text-span-thinking",Icon:xk,label:"thinking"},subagent:{tint:"text-span-subagent",Icon:Du,label:"sub-agent"},generic:{tint:"text-span-generic",Icon:mk,label:"activity"}},status:{running:{row:"",tint:"text-running animate-live-pulse",Icon:Dk,label:"running"},ok:{row:"",tint:"text-success",Icon:Ek,label:"ok"},error:{row:"bg-error/8",tint:"text-error",Icon:Ik,label:"error"},denied:{row:"bg-error/8",tint:"text-error",Icon:fk,label:"denied"},unknown:{row:"",tint:"text-faint",Icon:Vk,label:"unknown"}},trace:{tint:"text-span-turn",Icon:wm,label:"turn"},triggerBadge:"rounded-md bg-surface-raised px-1.5 py-0.5 font-mono text-2xs text-muted",payloadChip:"rounded-md bg-surface-raised px-1.5 py-0.5 font-mono text-2xs text-muted",errorChip:"font-mono text-2xs text-error"},AS={tool_call:Te.type.tool_call,thinking:Te.type.thinking,text:Te.type.llm_call,prompt:Te.type.generic,error:Te.type.generic,compaction:Te.type.generic,unknown:Te.type.generic};function LS({session:e,now:t,view:n,onViewChange:r,parentSessionId:i}){var d;const l=((d=e.agent_description)==null?void 0:d.trim())||qm(e),o=fg[e.live?"live":"complete"],s=e.tokens_in+e.tokens_out,a=e.live?void 0:e.last_activity_at,u=e.est_cost;return h.jsxs("header",{"data-slot":"session-header",className:"flex shrink-0 flex-wrap items-center gap-x-5 gap-y-3 border-b border-border bg-surface/50 px-5 py-4 text-sm text-foreground",children:[h.jsxs("a",{href:Hn(i?{name:"session",sessionId:i}:{name:"sessions"}),"data-slot":"back-to-sessions","aria-label":i?"Back to parent session":"Back to sessions",className:"flex shrink-0 items-center gap-1 text-2xs uppercase tracking-widest text-muted transition-colors hover:text-foreground",children:[h.jsx(vk,{size:12,"aria-hidden":"true"}),i?"Parent session":"Sessions"]}),h.jsxs("div",{className:"min-w-0 flex-1 basis-60",children:[h.jsx("h1",{className:"truncate text-lg font-semibold",title:l,children:l}),h.jsx("p",{"data-slot":"session-project",className:"mt-1 truncate font-mono text-2xs text-muted",title:e.project_path,children:e.project_path})]}),h.jsxs("a",{href:Hn({name:"search",sessionId:e.id}),"data-slot":"in-session-search",className:"shrink-0 text-2xs uppercase tracking-widest text-muted transition-colors hover:text-foreground",children:[h.jsx(Sm,{size:14,className:"mr-1 inline-block","aria-hidden":"true"})," Search"]}),n===void 0||r===void 0?null:h.jsx(MS,{view:n,onViewChange:r}),h.jsxs("span",{className:fe("flex shrink-0 items-center gap-1 text-xs",o.badge),children:[h.jsx("span",{"aria-hidden":"true",className:fe("size-1.5 rounded-md",o.dot)}),o.label]}),h.jsxs("span",{"data-slot":"session-turns",className:"shrink-0 font-mono text-2xs text-muted",children:[qt(e.turn_count)," turns"]}),e.error_count>0?h.jsxs("span",{"data-slot":"session-errors",className:Te.errorChip,children:[e.error_count," err"]}):null,h.jsx(Ku,{className:"shrink-0",duration:Vm(e.started_at,a,t),tokens:`${qt(s)} tok`,cost:Mi(u),costUnknown:Rr(u,e.model)})]})}function MS({view:e,onViewChange:t}){return h.jsx("div",{role:"group","aria-label":"Session view",className:"inline-flex shrink-0 items-center gap-0.5 rounded-md bg-surface p-0.5",children:eS.map(n=>h.jsxs("button",{type:"button",...n==="thread"?{"data-slot":"thread-toggle"}:{},"aria-pressed":n===e,onClick:()=>{t(n)},className:fe("flex items-center gap-1.5 rounded-md px-3 py-2 text-xs transition-colors",n===e?"bg-surface-raised text-foreground":"text-muted"),children:[n==="thread"?h.jsx(wm,{size:13,"aria-hidden":"true"}):h.jsx(zk,{size:13,"aria-hidden":"true"}),n==="thread"?"Thread":"Tree"]},n))})}function RS(e,t,n){const r=new Array(e);return new Proxy(r,{get(i,l,o){if(typeof l=="string"){const s=l.charCodeAt(0);if(s>=48&&s<=57){const a=+l;if(Number.isInteger(a)&&a>=0&&a<e){let u=i[a];if(!u){const d=t[a*2];u=i[a]={index:a,key:n(a),start:d,size:t[a*2+1],end:d+t[a*2+1],lane:0}}return u}}if(l==="length")return e}return Reflect.get(i,l,o)}})}function lr(e,t,n){let r=n.initialDeps??[],i,l=!0;function o(){const s=e();return(s.length!==r.length||s.some((u,d)=>r[d]!==u))&&(r=s,i=t(...s),n!=null&&n.onChange&&!(l&&n.skipInitialOnChange)&&n.onChange(i),l=!1),i}return o.updateDeps=s=>{r=s},o}function rf(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const OS=(e,t)=>Math.abs(e-t)<1.01,DS=(e,t,n)=>{let r;return function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)}};let Xr;const ys=()=>{if(Xr!==void 0)return Xr;if(typeof navigator>"u")return Xr=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return Xr=!0;const e=navigator.maxTouchPoints;return Xr=navigator.platform==="MacIntel"&&e!==void 0&&e>0},lf=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},FS=e=>e,$S=e=>{const t=Math.max(e.startIndex-e.overscan,0),r=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,i=new Array(r);for(let l=0;l<r;l++)i[l]=t+l;return i},VS=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const i=o=>{const{width:s,height:a}=o;t({width:Math.round(s),height:Math.round(a)})};if(i(lf(n)),!r.ResizeObserver)return()=>{};const l=new r.ResizeObserver(o=>{const s=()=>{const a=o[0];if(a!=null&&a.borderBoxSize){const u=a.borderBoxSize[0];if(u){i({width:u.inlineSize,height:u.blockSize});return}}i(lf(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(s):s()});return l.observe(n,{box:"border-box"}),()=>{l.unobserve(n)}},so={passive:!0},BS=typeof window>"u"?!0:"onscrollend"in window,US=(e,t,n)=>{const r=e.scrollElement;if(!r)return;const i=e.targetWindow;if(!i)return;const l=e.options.useScrollendEvent&&BS;let o=0;const s=l?null:DS(i,()=>t(o,!1),e.options.isScrollingResetDelay),a=c=>()=>{o=n(r),s==null||s(),t(o,c)},u=a(!0),d=a(!1);return r.addEventListener("scroll",u,so),l&&r.addEventListener("scrollend",d,so),()=>{r.removeEventListener("scroll",u),l&&r.removeEventListener("scrollend",d)}},HS=(e,t)=>US(e,t,n=>{const{horizontal:r,isRtl:i}=e.options;return r?n.scrollLeft*(i&&-1||1):n.scrollTop}),WS=(e,t,n)=>{if(n.options.useCachedMeasurements){const r=n.indexFromElement(e),i=n.options.getItemKey(r);return n.itemSizeCache.get(i)??n.options.estimateSize(r)}if(t!=null&&t.borderBoxSize){const r=t.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}if(!t){const r=n.indexFromElement(e),i=n.options.getItemKey(r),l=n.itemSizeCache.get(i);if(l!==void 0)return l}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},qS=(e,{adjustments:t=0,behavior:n},r)=>{var i,l;(l=(i=r.scrollElement)==null?void 0:i.scrollTo)==null||l.call(i,{[r.options.horizontal?"left":"top"]:e+t,behavior:n})},KS=qS;class GS{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var n,r,i;return((i=(r=(n=this.targetWindow)==null?void 0:n.performance)==null?void 0:r.now)==null?void 0:i.call(r))??Date.now()},this.observer=(()=>{let n=null;const r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(i=>{i.forEach(l=>{const o=()=>{const s=l.target,a=this.indexFromElement(s);if(!s.isConnected){this.observer.unobserve(s);for(const[u,d]of this.elementsCache)if(d===s){this.elementsCache.delete(u);break}return}this.shouldMeasureDuringScroll(a)&&this.resizeItem(a,this.options.measureElement(s,l,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()})}));return{disconnect:()=>{var i;(i=r())==null||i.disconnect(),n=null},observe:i=>{var l;return(l=r())==null?void 0:l.observe(i,{box:"border-box"})},unobserve:i=>{var l;return(l=r())==null?void 0:l.unobserve(i)}}})(),this.range=null,this.setOptions=n=>{var r,i;const l={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:FS,rangeExtractor:$S,onChange:()=>{},measureElement:WS,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(const f in n){const p=n[f];p!==void 0&&(l[f]=p)}const o=this.options;let s=null,a=null,u=!1;if(o!==void 0&&o.enabled&&l.enabled&&l.anchorTo==="end"&&this.scrollElement!==null){const f=o.count,p=l.count,x=this.getMeasurements(),v=f>0?((r=x[0])==null?void 0:r.key)??o.getItemKey(0):null,_=f>0?((i=x[f-1])==null?void 0:i.key)??o.getItemKey(f-1):null;if(p!==f||f>0&&p>0&&(l.getItemKey(0)!==v||l.getItemKey(p-1)!==_)){u=!0;const k=f>0?this.getVirtualItemForOffset(this.getScrollOffset())??x[0]:null;k&&(s=[k.key,this.getScrollOffset()-k.start]);const C=l.followOnAppend===!0?"auto":l.followOnAppend||null;C&&p>f&&this.isAtEnd(o.scrollEndThreshold)&&(f===0||l.getItemKey(p-1)!==_)&&(a=C)}}this.options=l,u&&(this.pendingMin=0,this.itemSizeCacheVersion++);let d=!1,c=0;if(s&&this.scrollOffset!==null){const[f,p]=s,x=this.getMeasurements(),{count:v,getItemKey:_}=this.options;let m=0;for(;m<v&&_(m)!==f;)m++;if(m<v){const g=x[m];if(g){const k=Math.max(0,g.start+p);k!==this.scrollOffset&&(c=k-this.scrollOffset,this.scrollOffset=k,d=!0)}}}(d||a)&&(this.pendingScrollAnchor=[d?s[0]:null,d?s[1]:0,a,c])},this.notify=n=>{var r,i;(i=(r=this.options).onChange)==null||i.call(r,this,n)},this.maybeNotify=lr(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}if(this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(l=>{this.observer.observe(l)}),this.unsubs.push(this.options.observeElementRect(this,l=>{this.scrollRect=l,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(l,o)=>{if(o&&this._intendedScrollOffset===null&&l===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(l-this._intendedScrollOffset)<1.5&&(l=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0;const s=this.getScrollOffset();this.scrollDirection=o?s===l?this.scrollDirection:s<l?"forward":"backward":null,this.scrollOffset=l,this.isScrolling=o,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){const l=this.scrollElement,o=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},s=()=>{this._iosTouching=!1,!(!ys()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};l.addEventListener("touchstart",o,so),l.addEventListener("touchend",s,so),this.unsubs.push(()=>{l.removeEventListener("touchstart",o),l.removeEventListener("touchend",s),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const i=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,i&&this.scrollElement&&this.options.enabled){const[l,o,s,a]=i;l!==null&&!s&&(ys()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?a!==0&&(this._iosDeferredAdjustment+=a):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),s&&this.scrollToEnd({behavior:s})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const n=this.getScrollOffset(),r=this.getMaxScrollOffset();if(n<0||n>r)return;if(this._iosDeferredAdjustment<0&&n>=r-1){this._iosDeferredAdjustment=0;return}const i=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(n,{adjustments:this.scrollAdjustments+=i,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=lr(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(n,r,i,l,o,s,a,u)=>(this.prevLanes!==void 0&&this.prevLanes!==s&&(this.lanesChangedFlag=!0),this.prevLanes=s,this.pendingMin=null,{count:n,paddingStart:r,scrollMargin:i,getItemKey:l,enabled:o,lanes:s,laneAssignmentMode:a,gap:u}),{key:!1}),this.getMeasurements=lr(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:n,paddingStart:r,scrollMargin:i,getItemKey:l,enabled:o,lanes:s,laneAssignmentMode:a,gap:u},d)=>{const c=this.itemSizeCache;if(!o)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>n)for(const m of this.laneAssignments.keys())m>=n&&this.laneAssignments.delete(m);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(m=>{this.itemSizeCache.set(m.key,m.size)}));const f=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===n&&(this.lanesSettling=!1),s===1){const m=n*2;let g=this._flatMeasurements;if(!g||g.length<m){const N=new Float64Array(m);g&&f>0&&N.set(g.subarray(0,f*2)),g=N,this._flatMeasurements=g}let k;if(f===0)k=r+i;else{const N=f-1;k=g[N*2]+g[N*2+1]+u}for(let N=f;N<n;N++){const b=l(N),I=c.get(b),E=typeof I=="number"?I:this.options.estimateSize(N);g[N*2]=k,g[N*2+1]=E,k+=E+u}const C=RS(n,g,l);return this.measurementsCache=C,C}const p=this.measurementsCache.slice(0,f),x=new Array(s).fill(void 0),v=new Float64Array(s);let _=0;for(let m=0;m<f;m++){const g=p[m];g&&(x[g.lane]===void 0&&_++,x[g.lane]=m,v[g.lane]=g.end)}for(let m=f;m<n;m++){const g=l(m),k=this.laneAssignments.get(m);let C,N;const b=a==="estimate"||c.has(g);if(k!==void 0&&this.options.lanes>1){C=k;const S=x[C],z=S!==void 0?p[S]:void 0;N=z?z.end+u:r+i}else if(_===s){let S=0,z=v[0],O=x[0];for(let U=1;U<s;U++){const Q=v[U];(Q<z||Q===z&&x[U]<O)&&(S=U,z=Q,O=x[U])}C=S,N=z+u,b&&this.laneAssignments.set(m,C)}else C=m%this.options.lanes,N=r+i,b&&this.laneAssignments.set(m,C);const I=c.get(g),E=typeof I=="number"?I:this.options.estimateSize(m),j=N+E;p[m]={index:m,start:N,size:E,end:j,key:g,lane:C},x[C]===void 0&&_++,x[C]=m,v[C]=j}return this.measurementsCache=p,p},{key:!1,debug:()=>this.options.debug}),this.calculateRange=lr(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,i,l)=>n.length===0||r===0?(this.range=null,null):(this.range=YS(n,r,i,l,l===1&&this._flatMeasurements!=null?this._flatMeasurements:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=lr(()=>{let n=null,r=null;const i=this.calculateRange();return i&&(n=i.startIndex,r=i.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,r]},(n,r,i,l,o)=>l===null||o===null?[]:n({startIndex:l,endIndex:o,overscan:r,count:i}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const r=this.options.indexAttribute,i=n.getAttribute(r);return i?parseInt(i,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=n=>{var r;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const i=this.scrollState.index??((r=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:r.index);if(i!==void 0&&this.range){const l=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),o=Math.max(0,i-l),s=Math.min(this.options.count-1,i+l);return n>=o&&n<=s}return!0},this.measureElement=n=>{if(!n){this.elementsCache.forEach((o,s)=>{o.isConnected||(this.observer.unobserve(o),this.elementsCache.delete(s))});return}const r=this.indexFromElement(n),i=this.options.getItemKey(r),l=this.elementsCache.get(i);l!==n&&(l&&this.observer.unobserve(l),this.observer.observe(n),this.elementsCache.set(i,n)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(r)&&this.resizeItem(r,this.options.measureElement(n,void 0,this))},this.resizeItem=(n,r)=>{var i,l;if(n<0||n>=this.options.count)return;let o,s,a;const u=this._flatMeasurements;if(this.options.lanes===1&&u!==null)a=this.options.getItemKey(n),s=u[n*2],o=u[n*2+1];else{const f=this.measurementsCache[n];if(!f)return;a=f.key,s=f.start,o=f.size}const d=this.itemSizeCache.get(a)??o,c=r-d;if(c!==0){const f=this.options.anchorTo==="end"&&((i=this.scrollState)==null?void 0:i.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,p=f?this.getTotalSize():0,x=this.getScrollOffset()+this.scrollAdjustments,_=!this.itemSizeCache.has(a)?s<x:s+d<=x&&this.scrollDirection!=="backward",m=((l=this.scrollState)==null?void 0:l.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[n]??{index:n,key:a,start:s,size:o,end:s+o,lane:0},c,this):_);(this.pendingMin===null||n<this.pendingMin)&&(this.pendingMin=n),this.itemSizeCache.set(a,r),this.itemSizeCacheVersion++;let g=!1;f?g=this.applyScrollAdjustment(this.getTotalSize()-p):m&&(g=this.applyScrollAdjustment(c)),this.notify(g)}},this.getVirtualItems=lr(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const i=[];for(let l=0,o=n.length;l<o;l++){const s=n[l],a=r[s];i.push(a)}return i},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length===0)return;const i=this._flatMeasurements,l=this.options.lanes===1&&i!=null,o=pg(0,r.length-1,l?s=>i[s*2]:s=>rf(r[s]).start,n);return rf(r[o])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const n=this.scrollElement.document.documentElement;return this.options.horizontal?n.scrollWidth-this.scrollElement.innerWidth:n.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(n=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=n,this.getOffsetForAlignment=(n,r,i=0)=>{if(!this.scrollElement)return 0;const l=this.getSize(),o=this.getScrollOffset();r==="auto"&&(r=n>=o+l?"end":"start"),r==="center"?n+=(i-l)/2:r==="end"&&(n-=l);const s=this.getMaxScrollOffset();return Math.max(Math.min(s,n),0)},this.getOffsetForIndex=(n,r="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const i=this.getSize(),l=this.getScrollOffset(),o=this.measurementsCache[n];if(!o)return;if(r==="auto")if(o.end>=l+i-this.options.scrollPaddingEnd)r="end";else if(o.start<=l+this.options.scrollPaddingStart)r="start";else return[l,r];if(r==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),r];const s=r==="end"?o.end+this.options.scrollPaddingEnd:o.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(s,r,o.size),r]},this.scrollToOffset=(n,{align:r="start",behavior:i="auto"}={})=>{this._iosDeferredAdjustment=0;const l=this.getOffsetForAlignment(n,r),o=this.now();this.scrollState={index:null,align:r,behavior:i,startedAt:o,lastTargetOffset:l,stableFrames:0},this._scrollToOffset(l,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollToIndex=(n,{align:r="auto",behavior:i="auto"}={})=>{this._iosDeferredAdjustment=0,n=Math.max(0,Math.min(n,this.options.count-1));const l=this.getOffsetForIndex(n,r);if(!l)return;const[o,s]=l,a=this.now();this.scrollState={index:n,align:s,behavior:i,startedAt:a,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollBy=(n,{behavior:r="auto"}={})=>{const i=this.getScrollOffset()+n,l=this.now();this.scrollState={index:null,align:"start",behavior:r,startedAt:l,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:n="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:n});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:n})},this.getTotalSize=()=>{var n;const r=this.getMeasurements();let i;if(r.length===0)i=this.options.paddingStart;else if(this.options.lanes===1){const l=r.length-1,o=this._flatMeasurements;o!=null?i=o[l*2]+o[l*2+1]:i=((n=r[l])==null?void 0:n.end)??0}else{const l=Array(this.options.lanes).fill(null);let o=r.length-1;for(;o>=0&&l.some(s=>s===null);){const s=r[o];l[s.lane]===null&&(l[s.lane]=s.end),o--}i=Math.max(...l.filter(s=>s!==null))}return Math.max(i-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const n=[];if(this.itemSizeCache.size===0)return n;const r=this.getMeasurements();for(const i of r)i&&this.itemSizeCache.has(i.key)&&n.push({index:i.index,key:i.key,start:i.start,size:i.size,end:i.end,lane:i.lane});return n},this._scrollToOffset=(n,{adjustments:r,behavior:i})=>{this._intendedScrollOffset=n+(r??0),this.options.scrollToFn(n,{behavior:i,adjustments:r},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(t)}applyScrollAdjustment(t,n){return t===0?!1:ys()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?(this._iosDeferredAdjustment+=t,!1):(this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=t,behavior:n}),this.scrollOffset!==null&&(this.scrollOffset+=this.scrollAdjustments,this.scrollOffset<0&&(this.scrollOffset=0),this.scrollAdjustments=0),!0)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const r=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,i=r?r[0]:this.scrollState.lastTargetOffset,l=1,o=i!==this.scrollState.lastTargetOffset;if(!o&&OS(i,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=l){this.getScrollOffset()!==i&&this._scrollToOffset(i,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,o){const s=this.getSize()||600,a=Math.abs(i-this.getScrollOffset()),u=this.scrollState.behavior==="smooth"&&a>s;this.scrollState.lastTargetOffset=i,u||(this.scrollState.behavior="auto"),this._scrollToOffset(i,{adjustments:void 0,behavior:u?"smooth":"auto"})}this.scheduleScrollReconcile()}}const pg=(e,t,n,r)=>{for(;e<=t;){const i=(e+t)/2|0,l=n(i);if(l<r)e=i+1;else if(l>r)t=i-1;else return i}return e>0?e-1:0};function QS(e,t,n){let r=0;for(;r<=t;){const i=(r+t)/2|0,l=e[i*2];if(l<n)r=i+1;else if(l>n)t=i-1;else return i}return r>0?r-1:0}function YS(e,t,n,r,i){const l=e.length-1;if(e.length<=r)return{startIndex:0,endIndex:l};if(r===1&&i!==null){const u=QS(i,l,n);let d=u;const c=n+t;for(;d<l&&i[d*2]+i[d*2+1]<c;)d++;return{startIndex:u,endIndex:d}}let s=pg(0,l,u=>e[u].start,n),a=s;if(r===1)for(;a<l&&e[a].end<n+t;)a++;else if(r>1){const u=Array(r).fill(0);for(;a<l&&u.some(c=>c<n+t);){const c=e[a];u[c.lane]=c.end,a++}const d=Array(r).fill(n+t);for(;s>=0&&d.some(c=>c>=n);){const c=e[s];d[c.lane]=c.start,s--}s=Math.max(0,s-s%r),a=Math.min(l,a+(r-1-a%r))}return{startIndex:s,endIndex:a}}const ks=typeof document<"u"?L.useLayoutEffect:L.useEffect;function XS({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:n="transform",...r}){const i=L.useReducer(d=>d+1,0)[1],l=L.useRef({enabled:t,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});l.current.enabled=t,l.current.mode=n;const o=d=>{const c=l.current;if(!c.enabled||!c.container)return;const f=d.getTotalSize();if(f!==c.lastSize){c.lastSize=f;const p=d.options.horizontal?"width":"height";c.container.style[p]=`${f}px`}},s=d=>{const c=l.current;if(!c.enabled||!c.container)return;o(d);const f=!!d.options.horizontal,p=c.mode==="transform",x=f?"left":"top",v=d.options.scrollMargin,_=d.getVirtualItems();for(const m of _){const g=m.start-v,k=d.elementsCache.get(m.key);k&&c.lastPositions.get(k)!==g&&(c.lastPositions.set(k,g),p?k.style.transform=f?`translate3d(${g}px, 0, 0)`:`translate3d(0, ${g}px, 0)`:k.style[x]=`${g}px`)}},a={...r,onChange:(d,c)=>{var f;const p=l.current;let x=!0;if(p.enabled){s(d);const v=d.range,_=p.prevRange;x=!_||_.isScrolling!==d.isScrolling||_.startIndex!==(v==null?void 0:v.startIndex)||_.endIndex!==(v==null?void 0:v.endIndex),x&&(p.prevRange=v?{startIndex:v.startIndex,endIndex:v.endIndex,isScrolling:d.isScrolling}:null)}x&&(e&&c?xm.flushSync(i):i()),(f=r.onChange)==null||f.call(r,d,c)}},[u]=L.useState(()=>{const d=new GS(a);return Object.assign(d,{containerRef:c=>{const f=l.current;if(f.container=c,f.lastSize=null,c&&f.enabled){const p=d.getTotalSize();f.lastSize=p;const x=d.options.horizontal?"width":"height";c.style[x]=`${p}px`}}})});return u.setOptions(a),ks(()=>u._didMount(),[]),ks(()=>(o(u),u._willUpdate())),ks(()=>{s(u)}),u}function JS(e){return XS({observeElementRect:VS,observeElementOffset:HS,scrollToFn:KS,...e})}const hg=14,of=Te.type.subagent,ZS={elapsed:"elapsed, approval wait included",sidecar_span:"measured by the sub-agent span",reported:"reported by the harness",none:"not measured"};function eb({row:e,selected:t,focused:n,onSelect:r,onToggle:i}){const{event:l,kind:o,status:s}=e.node,a=AS[o],u=Te.status[s],d=l.name??l.kind,c=P0(l.duration_source),f=ZS[c],p=Ri(l.input),x=Ri(l.text),v=cg(l)!==null,_=l.child_session_id,m=_===null?null:{type:l.agent_type??Te.type.subagent.label,status:F0(l.agent_status)};return h.jsxs("div",{role:"treeitem","data-slot":"span-row","data-span-status":s,"data-event-kind":o,"data-event-id":l.id,"data-session-id":e.sessionId,..._===null?{}:{"data-child-session-id":_},"aria-level":e.depth+1,"aria-setsize":e.setSize,"aria-posinset":e.posInSet,"aria-selected":t,...e.hasChildren?{"aria-expanded":e.expanded}:{},"aria-label":[`${a.label} ${d}`,...m===null?[]:[`sub-agent ${m.type}, ${m.status}`],u.label,f].join(", "),tabIndex:n?0:-1,onClick:()=>r==null?void 0:r(e.id),className:fe("border-l-2 text-xs text-foreground",u.row,t?"border-l-accent bg-accent-muted":"border-l-background"),style:{paddingLeft:e.depth*hg},children:[h.jsxs("div",{className:"flex h-7 items-center gap-2 pr-2",children:[h.jsx(tb,{row:e,name:d,onToggle:i}),h.jsx("span",{"data-slot":"span-type",className:fe("shrink-0",a.tint),children:h.jsx(a.Icon,{size:12,"aria-hidden":"true"})}),h.jsx("span",{"data-slot":"span-name",className:"min-w-0 flex-1 truncate",children:d}),m===null?null:h.jsxs("span",{"data-slot":"span-subagent",className:fe("flex shrink-0 items-center gap-1",of.tint),children:[h.jsx(of.Icon,{size:12,"aria-hidden":"true"}),h.jsx("span",{className:"font-mono text-2xs",children:m.type}),h.jsx("span",{className:Te.triggerBadge,children:m.status})]}),h.jsx("span",{"data-slot":"span-status",role:"img",title:u.label,"aria-label":u.label,className:fe("shrink-0",u.tint),children:h.jsx(u.Icon,{size:12,"aria-hidden":"true"})}),h.jsx("span",{"data-slot":"span-metrics","data-duration-source":c,title:f,className:"shrink-0",children:h.jsx(Gu,{values:Qm(l),showErrors:!1})})]}),p===null&&x===null&&!v?null:h.jsxs("div",{"data-slot":"span-payload",className:"flex items-center gap-2 pb-1 pl-6 pr-2",children:[v?h.jsx("span",{"data-slot":"span-wire",title:"The harness rewrote this call; the executed form is in the detail pane",className:fe("shrink-0",Te.payloadChip),children:"≠ what ran"}):null,p===null?null:h.jsx("span",{"data-slot":"span-input",className:fe("min-w-0 truncate",Te.payloadChip),children:p}),x===null?null:h.jsx("span",{"data-slot":"span-output",className:fe("min-w-0 truncate",Te.payloadChip),children:x})]})]})}function tb({row:e,name:t,onToggle:n}){if(!e.hasChildren)return h.jsx("span",{"data-slot":"span-expand-space","aria-hidden":"true",className:"w-3.5 shrink-0"});const r=e.expanded?To:Li;return h.jsx("button",{type:"button","data-slot":"span-expand",tabIndex:-1,"aria-label":e.expanded?`collapse ${t}`:`expand ${t}`,onClick:i=>{i.stopPropagation(),n==null||n(e.id)},className:"shrink-0 text-faint",children:h.jsx(r,{size:14,"aria-hidden":"true"})})}function Gu({values:e,showErrors:t}){return h.jsxs(h.Fragment,{children:[t&&e.errorCount>0?h.jsxs("span",{"data-slot":"row-errors",className:Te.errorChip,children:[e.errorCount," err"]}):null,h.jsx(Ku,{className:"shrink-0",duration:d0(e.durationMs),...e.tokens>0?{tokens:`${qt(e.tokens)} tok`}:{},...e.costUnknown!==void 0?{cost:Mi(e.cost),costUnknown:e.costUnknown}:e.cost!==null&&e.cost>0?{cost:Mi(e.cost)}:{}})]})}function nb({row:e,selected:t,focused:n,onSelect:r,onToggle:i}){const{turn:l}=e,{Icon:o,tint:s,label:a}=Te.trace,u=e.expanded?To:Li,d=O0(l);return h.jsxs("div",{role:"treeitem","data-slot":"trace-group","data-turn-kind":l.kind,"data-session-id":e.sessionId,"aria-level":e.depth+1,"aria-setsize":e.setSize,"aria-posinset":e.posInSet,"aria-selected":t,...e.hasChildren?{"aria-expanded":e.expanded}:{},"aria-label":`${a} ${l.seq}: ${d}`,tabIndex:n?0:-1,onClick:()=>r==null?void 0:r(e.id),className:fe("flex h-9 items-center gap-2 border-l-2 border-b border-b-border bg-surface pr-2 text-xs text-foreground",t?"border-l-accent bg-accent-muted":"border-l-background"),style:{paddingLeft:e.depth*hg},children:[h.jsx("button",{type:"button","data-slot":"trace-expand",tabIndex:-1,"aria-label":e.expanded?`collapse turn ${l.seq}`:`expand turn ${l.seq}`,onClick:c=>{c.stopPropagation(),i==null||i(e.id)},className:"shrink-0 pl-1 text-faint",children:h.jsx(u,{size:14,"aria-hidden":"true"})}),h.jsx("span",{"data-slot":"trace-icon",className:fe("shrink-0",s),children:h.jsx(o,{size:12,"aria-hidden":"true"})}),h.jsx("span",{"data-slot":"trace-preview",className:"min-w-0 flex-1 truncate font-medium",children:d}),e.subagent===void 0?null:h.jsxs("span",{"data-slot":"trace-subagent",className:"flex min-w-0 items-center gap-2",children:[h.jsx("span",{"data-slot":"trace-agent-description",className:"min-w-0 truncate font-mono text-2xs text-muted",children:e.subagent.header.agent_description??""}),h.jsx(Ku,{className:"shrink-0",tokens:`${qt(e.subagent.header.tokens_in+e.subagent.header.tokens_out)} tok`,cost:Mi(e.subagent.header.est_cost),costUnknown:Rr(e.subagent.header.est_cost,e.subagent.header.model)})]}),l.kind==="human"?null:h.jsx("span",{"data-slot":"trace-trigger",title:`started by ${l.kind}`,"aria-label":`started by ${l.kind}`,className:Te.triggerBadge,children:l.kind}),h.jsx(Gu,{values:M0(l),showErrors:!0})]})}const rb=28,ib=8;function lb({rows:e,selectedId:t,focusedIndex:n,initialRect:r,estimateSize:i=rb,overscan:l=ib,followIndex:o,revealIndex:s,onScrollMetrics:a,onKeyDown:u,onSelect:d,onToggle:c}){const f=L.useRef(null),p=L.useRef(!1),x=JS({count:e.length,getScrollElement:()=>f.current,estimateSize:()=>i,overscan:l,getItemKey:_=>{var m;return((m=e[_])==null?void 0:m.id)??_},...r===void 0?{}:{initialRect:r}});L.useEffect(()=>{o!==void 0&&(p.current=!0,x.scrollToIndex(o,{align:"end"}))},[o,x]),L.useEffect(()=>{s!==void 0&&(p.current=!0,x.scrollToIndex(s,{align:"center"}))},[s,x]);const v=_=>{if(p.current){p.current=!1;return}const m=_.currentTarget;a==null||a({scrollTop:m.scrollTop,scrollHeight:m.scrollHeight,clientHeight:m.clientHeight})};return h.jsx("div",{ref:f,"data-slot":"span-tree-scroller",className:"h-full overflow-y-auto",onKeyDown:u,onScroll:v,children:h.jsx("div",{role:"tree","aria-label":"span tree","data-slot":"span-tree",className:"relative w-full",style:{height:x.getTotalSize()},children:x.getVirtualItems().map(_=>{const m=e[_.index];return m===void 0?null:h.jsx("div",{role:"presentation","data-index":_.index,ref:x.measureElement,className:"absolute left-0 w-full",style:{top:_.start},children:m.kind==="turn"?h.jsx(nb,{row:m,selected:m.id===t,focused:_.index===n,...d===void 0?{}:{onSelect:d},...c===void 0?{}:{onToggle:c}}):h.jsx(eb,{row:m,selected:m.id===t,focused:_.index===n,...d===void 0?{}:{onSelect:d},...c===void 0?{}:{onToggle:c}})},_.key)})})})}function ob(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const sb=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ab=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ub={};function sf(e,t){return(ub.jsx?ab:sb).test(e)}const cb=/[ \t\n\f\r]/g;function db(e){return typeof e=="object"?e.type==="text"?af(e.value):!1:af(e)}function af(e){return e.replace(cb,"")===""}class Hi{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Hi.prototype.normal={};Hi.prototype.property={};Hi.prototype.space=void 0;function mg(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new Hi(n,r,t)}function za(e){return e.toLowerCase()}class tt{constructor(t,n){this.attribute=n,this.property=t}}tt.prototype.attribute="";tt.prototype.booleanish=!1;tt.prototype.boolean=!1;tt.prototype.commaOrSpaceSeparated=!1;tt.prototype.commaSeparated=!1;tt.prototype.defined=!1;tt.prototype.mustUseProperty=!1;tt.prototype.number=!1;tt.prototype.overloadedBoolean=!1;tt.prototype.property="";tt.prototype.spaceSeparated=!1;tt.prototype.space=void 0;let fb=0;const q=tr(),Ee=tr(),Pa=tr(),A=tr(),de=tr(),Wn=tr(),it=tr();function tr(){return 2**++fb}const Aa=Object.freeze(Object.defineProperty({__proto__:null,boolean:q,booleanish:Ee,commaOrSpaceSeparated:it,commaSeparated:Wn,number:A,overloadedBoolean:Pa,spaceSeparated:de},Symbol.toStringTag,{value:"Module"})),vs=Object.keys(Aa);class Qu extends tt{constructor(t,n,r,i){let l=-1;if(super(t,n),uf(this,"space",i),typeof r=="number")for(;++l<vs.length;){const o=vs[l];uf(this,vs[l],(r&Aa[o])===Aa[o])}}}Qu.prototype.defined=!0;function uf(e,t,n){n&&(e[t]=n)}function Or(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const l=new Qu(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(l.mustUseProperty=!0),t[r]=l,n[za(r)]=r,n[za(l.attribute)]=r}return new Hi(t,n,e.space)}const gg=Or({properties:{ariaActiveDescendant:null,ariaAtomic:Ee,ariaAutoComplete:null,ariaBusy:Ee,ariaChecked:Ee,ariaColCount:A,ariaColIndex:A,ariaColSpan:A,ariaControls:de,ariaCurrent:null,ariaDescribedBy:de,ariaDetails:null,ariaDisabled:Ee,ariaDropEffect:de,ariaErrorMessage:null,ariaExpanded:Ee,ariaFlowTo:de,ariaGrabbed:Ee,ariaHasPopup:null,ariaHidden:Ee,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:de,ariaLevel:A,ariaLive:null,ariaModal:Ee,ariaMultiLine:Ee,ariaMultiSelectable:Ee,ariaOrientation:null,ariaOwns:de,ariaPlaceholder:null,ariaPosInSet:A,ariaPressed:Ee,ariaReadOnly:Ee,ariaRelevant:null,ariaRequired:Ee,ariaRoleDescription:de,ariaRowCount:A,ariaRowIndex:A,ariaRowSpan:A,ariaSelected:Ee,ariaSetSize:A,ariaSort:null,ariaValueMax:A,ariaValueMin:A,ariaValueNow:A,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function xg(e,t){return t in e?e[t]:t}function yg(e,t){return xg(e,t.toLowerCase())}const pb=Or({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Wn,acceptCharset:de,accessKey:de,action:null,allow:null,allowFullScreen:q,allowPaymentRequest:q,allowUserMedia:q,alpha:q,alt:null,as:null,async:q,autoCapitalize:null,autoComplete:de,autoFocus:q,autoPlay:q,blocking:de,capture:null,charSet:null,checked:q,cite:null,className:de,closedBy:null,colorSpace:null,cols:A,colSpan:A,command:null,commandFor:null,content:null,contentEditable:Ee,controls:q,controlsList:de,coords:A|Wn,crossOrigin:null,data:null,dateTime:null,decoding:null,default:q,defer:q,dir:null,dirName:null,disabled:q,download:Pa,draggable:Ee,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:q,formTarget:null,headers:de,height:A,hidden:Pa,high:A,href:null,hrefLang:null,htmlFor:de,httpEquiv:de,id:null,imageSizes:null,imageSrcSet:null,inert:q,inputMode:null,integrity:null,is:null,isMap:q,itemId:null,itemProp:de,itemRef:de,itemScope:q,itemType:de,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:q,low:A,manifest:null,max:null,maxLength:A,media:null,method:null,min:null,minLength:A,multiple:q,muted:q,name:null,nonce:null,noModule:q,noValidate:q,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:q,optimum:A,pattern:null,ping:de,placeholder:null,playsInline:q,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:q,referrerPolicy:null,rel:de,required:q,reversed:q,rows:A,rowSpan:A,sandbox:de,scope:null,scoped:q,seamless:q,selected:q,shadowRootClonable:q,shadowRootCustomElementRegistry:q,shadowRootDelegatesFocus:q,shadowRootMode:null,shadowRootSerializable:q,shape:null,size:A,sizes:null,slot:null,span:A,spellCheck:Ee,src:null,srcDoc:null,srcLang:null,srcSet:null,start:A,step:null,style:null,tabIndex:A,target:null,title:null,translate:null,type:null,typeMustMatch:q,useMap:null,value:Ee,width:A,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:de,axis:null,background:null,bgColor:null,border:A,borderColor:null,bottomMargin:A,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:q,declare:q,event:null,face:null,frame:null,frameBorder:null,hSpace:A,leftMargin:A,link:null,longDesc:null,lowSrc:null,marginHeight:A,marginWidth:A,noResize:q,noHref:q,noShade:q,noWrap:q,object:null,profile:null,prompt:null,rev:null,rightMargin:A,rules:null,scheme:null,scrolling:Ee,standby:null,summary:null,text:null,topMargin:A,valueType:null,version:null,vAlign:null,vLink:null,vSpace:A,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:q,disablePictureInPicture:q,disableRemotePlayback:q,exportParts:Wn,part:de,prefix:null,property:null,results:A,security:null,unselectable:null},space:"html",transform:yg}),hb=Or({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:it,accentHeight:A,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:A,amplitude:A,arabicForm:null,ascent:A,attributeName:null,attributeType:null,azimuth:A,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:A,by:null,calcMode:null,capHeight:A,className:de,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:A,diffuseConstant:A,direction:null,display:null,dur:null,divisor:A,dominantBaseline:null,download:q,dx:null,dy:null,edgeMode:null,editable:null,elevation:A,enableBackground:null,end:null,event:null,exponent:A,externalResourcesRequired:null,fill:null,fillOpacity:A,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Wn,g2:Wn,glyphName:Wn,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:A,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:A,horizOriginX:A,horizOriginY:A,id:null,ideographic:A,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:A,k:A,k1:A,k2:A,k3:A,k4:A,kernelMatrix:it,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:A,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:A,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:A,overlineThickness:A,paintOrder:null,panose1:null,path:null,pathLength:A,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:de,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:A,pointsAtY:A,pointsAtZ:A,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:it,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:it,rev:it,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:it,requiredFeatures:it,requiredFonts:it,requiredFormats:it,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:A,specularExponent:A,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:A,strikethroughThickness:A,string:null,stroke:null,strokeDashArray:it,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:A,strokeOpacity:A,strokeWidth:null,style:null,surfaceScale:A,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:it,tabIndex:A,tableValues:null,target:null,targetX:A,targetY:A,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:it,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:A,underlineThickness:A,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:A,values:null,vAlphabetic:A,vMathematical:A,vectorEffect:null,vHanging:A,vIdeographic:A,version:null,vertAdvY:A,vertOriginX:A,vertOriginY:A,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:A,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:xg}),kg=Or({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),vg=Or({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:yg}),wg=Or({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),mb={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},gb=/[A-Z]/g,cf=/-[a-z]/g,xb=/^data[-\w.:]+$/i;function yb(e,t){const n=za(t);let r=t,i=tt;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&xb.test(t)){if(t.charAt(4)==="-"){const l=t.slice(5).replace(cf,vb);r="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=t.slice(4);if(!cf.test(l)){let o=l.replace(gb,kb);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}i=Qu}return new i(r,t)}function kb(e){return"-"+e.toLowerCase()}function vb(e){return e.charAt(1).toUpperCase()}const wb=mg([gg,pb,kg,vg,wg],"html"),Yu=mg([gg,hb,kg,vg,wg],"svg");function Sb(e){return e.join(" ").trim()}var Xu={},df=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,bb=/\n/g,Cb=/^\s*/,Eb=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,_b=/^:\s*/,Ib=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,Nb=/^[;\s]*/,Tb=/^\s+|\s+$/g,jb=`
|
|
226
|
+
`)};return r!==void 0&&(o.id=r),i!==void 0&&(o.retry=i),o}function Ew(e={}){const t=e.path??gw,n=e.fetchImpl??globalThis.fetch,r=e.sleepImpl??jw,i=e.now??(()=>Date.now()),l=e.random??(()=>Math.random()),o=e.watchdogMs??kw,s=e.bootstrap??eg(),a=new AbortController;let u=!1,d,c={kind:"connecting"},f,p=0,x=0;function v(I){var E;c.kind==="closed"||c.kind==="auth_error"||(c=I,(E=e.onState)==null||E.call(e,I))}function _(I){var E;(E=e.onError)==null||E.call(e,I)}function m(I){if(!Number.isFinite(o))return;const E=++p;x=i()+o,(async()=>{for(;E===p&&!I.signal.aborted;){const j=x-i();if(j<=0){I.abort(new DOMException("agent-lens: stream went silent","AbortError"));return}await r(j,I.signal)}})()}function g(){Number.isFinite(o)&&(x=i()+o)}function k(){p+=1}function C(I){var j;if(g(),I.event==="heartbeat")return;if(I.event==="error"){_(new Error(`agent-lens: the stream reported an error (${I.data})`));return}if(!Sw.has(I.event))return;let E;try{E=JSON.parse(I.data)}catch(S){_(new Error(`agent-lens: could not decode a "${I.event}" payload (${S instanceof Error?S.message:String(S)})`));return}(j=e.onEvent)==null||j.call(e,{event:I.event,data:E,...I.id===void 0?{}:{id:I.id}})}async function N(){const I=new AbortController;d=I;let E=!1,j,S;try{const z=await n(t,{method:"GET",headers:{[s.tokenHeader]:s.token},signal:I.signal});if(z.status===401||z.status===403)j=new tg(z.status,await Iw(z));else if(!z.ok)S=new Error(`agent-lens: the stream returned HTTP ${z.status}`);else if(z.body===null)S=new Error("agent-lens: the stream response carried no body");else{E=!0,v({kind:"open"}),m(I);const O=z.body.getReader(),U=new TextDecoder,Q=bw();for(;;){const{done:W,value:X}=await O.read();if(W)break;for(const re of Q.push(U.decode(X,{stream:!0})))C(re)}}}catch(z){S=z}finally{k(),d=void 0}return u?{kind:"closed"}:j!==void 0?{kind:"auth",error:j}:(S!==void 0&&!Nw(S)&&_(Tw(S)),{kind:"retry",reachedOpen:E})}async function b(){let I=0;for(;!u;){v({kind:"connecting"});const E=await N();if(E.kind==="closed")break;if(E.kind==="auth"){v({kind:"auth_error",error:E.error});return}E.reachedOpen&&(I=0);const j=_w(I,l);I+=1,v({kind:"reconnecting",attempt:I,nextRetryAt:i()+j}),await r(j,a.signal)}v({kind:"closed"})}return{start(){return f??(f=b()),f},close(){u||(u=!0,v({kind:"closed"}),k(),a.abort(),d==null||d.abort(new DOMException("agent-lens: stream closed","AbortError")))},get state(){return c}}}function _w(e,t){return t()*Math.min(ww,vw*2**e)}async function Iw(e){try{const t=(await e.text()).trim();return t===""?`HTTP ${e.status}`:t}catch{return`HTTP ${e.status}`}}function Nw(e){return typeof e=="object"&&e!==null&&e.name==="AbortError"}function Tw(e){return e instanceof Error?e:new Error(String(e))}function jw(e,t){return new Promise(n=>{if((t==null?void 0:t.aborted)===!0){n();return}const r=()=>{clearTimeout(i),t==null||t.removeEventListener("abort",r),n()},i=setTimeout(r,e);t==null||t.addEventListener("abort",r,{once:!0})})}function zw(e,t={}){const n=L.useRef(e);n.current=e;const r=L.useRef(t);r.current=t,L.useEffect(()=>{const l=(r.current.create??Ew)({onEvent:({event:o,data:s})=>{o==="session_changed"?n.current.publish({event:o,data:s}):o==="session_indexed"?n.current.publish({event:o,data:s}):o==="warm_progress"&&n.current.publish({event:o,data:s})},onState:o=>{var s,a;return(a=(s=r.current).onState)==null?void 0:a.call(s,o)}});return l.start(),()=>l.close()},[])}const Pw=/^\d+$/;function qd(e){const t=Aw(e);if(t==="/")return{name:"sessions"};if(t==="/showcase")return{name:"showcase"};if(t==="/search")return{name:"search"};const n=t.slice(1).split("/");if(n[0]==="search"&&n.length===3&&n[1]==="session"){const r=Kd(n[2]);if(r!==void 0&&r!=="")return{name:"search",sessionId:r}}if(n[0]==="session"){const r=Kd(n[1]);if(r!==void 0&&r!==""){if(n.length===2)return{name:"session",sessionId:r};if(n.length===4&&Pw.test(n[3]??"")){if(n[2]==="trace")return{name:"trace",sessionId:r,turnSeq:Number(n[3])};if(n[2]==="event")return{name:"event",sessionId:r,seq:Number(n[3])}}}}return{name:"not_found",path:e}}function Hn(e){switch(e.name){case"sessions":return"/";case"showcase":return"/showcase";case"session":return`/session/${encodeURIComponent(e.sessionId)}`;case"trace":return`/session/${encodeURIComponent(e.sessionId)}/trace/${e.turnSeq}`;case"search":return e.sessionId===void 0?"/search":`/search/session/${encodeURIComponent(e.sessionId)}`;case"event":return`/session/${encodeURIComponent(e.sessionId)}/event/${e.seq}`;case"not_found":return e.path}}function Aw(e){var r;const t=((r=e.split("?")[0])==null?void 0:r.split("#")[0])??"",n=t.startsWith("/")?t:`/${t}`;return n.length>1&&n.endsWith("/")?n.slice(0,-1):n}function Kd(e){if(e!==void 0)try{return decodeURIComponent(e)}catch{return e}}function Lw(){return{path:()=>window.location.pathname,push:e=>{window.history.pushState(null,"",e)},replace:e=>{window.history.replaceState(null,"",e)},onPopState:e=>(window.addEventListener("popstate",e),()=>{window.removeEventListener("popstate",e)})}}function Mw(e=Lw()){const t=new Set;let n=e.path(),r=qd(n);function i(){const l=e.path();if(l!==n){n=l,r=qd(l);for(const o of[...t])o()}}return e.onPopState(i),{getRoute:()=>r,navigate(l,o={}){const s=Hn(l);o.replace===!0?e.replace(s):e.push(s),i()},subscribe(l){return t.add(l),()=>{t.delete(l)}}}}let Gd;function rg(){return Gd??(Gd=Mw()),Gd}function Rw(e=rg()){return L.useSyncExternalStore(e.subscribe,e.getRoute,e.getRoute)}const ig={kind:"loading"};function Ow(){return{requestId:0,state:ig}}function Dw(e,t){return t.type==="start"?{requestId:t.requestId,state:ig}:t.requestId!==e.requestId?e:{requestId:e.requestId,state:t.type==="resolve"?{kind:"ok",value:t.value}:{kind:"error",error:t.error}}}function Wu(e,t,n=0){const[r,i]=L.useReducer(Dw,Ow()),l=L.useRef(0),o=L.useRef(t);return o.current=t,L.useEffect(()=>{const s=++l.current,a=new AbortController;return i({type:"start",requestId:s}),o.current(a.signal).then(u=>i({type:"resolve",requestId:s,value:u}),u=>i({type:"reject",requestId:s,error:u})),()=>a.abort()},[e,n]),r.state}const ms="<mark>",Qd="</mark>";function Fw(e){if(e==null||e==="")return[];const t=[];let n=e;for(;n!=="";){const r=n.indexOf(ms);if(r===-1)break;const i=n.indexOf(Qd,r+ms.length);if(i===-1)break;r>0&&t.push({text:n.slice(0,r),matched:!1});const l=n.slice(r+ms.length,i);l!==""&&t.push({text:l,matched:!0}),n=n.slice(i+Qd.length)}return n!==""&&t.push({text:n,matched:!1}),t}function $w(e){const t=e.trim();return t===""?{kind:"idle"}:{kind:"search",q:t}}function Vw(e){return e==="session"?"Searching this session.":"Searching all projected transcripts, including sub-agent transcripts the session list does not show."}function Bw(e,t,n){if(e.kind==="idle"||t>0)return null;const r=`No matches for ${JSON.stringify(e.q)}.`;return n>0?`${r} ${n} transcripts are not indexed yet, so this answer covers part of the corpus.`:r}function Uw(e){const t=new Map;for(const n of e){const r=t.get(n.session_id);if(r===void 0){t.set(n.session_id,{sessionId:n.session_id,title:n.session_title,projectPath:n.project_path,hits:[n]});continue}r.hits.push(n)}return[...t.values()]}function Hw(e,t){return t===null?`Warm the remaining ${e}`:t.done>=t.total?`Warmed ${t.total} transcripts`:`Warming ${t.done} of ${t.total}`}function Ww(e,t){if(e===null)return{latch:null,revealIndex:void 0};const n=t.findIndex(r=>r.id===e.eventId);return n===-1?{latch:e,revealIndex:void 0}:{latch:null,revealIndex:n,selectedId:e.eventId,focusedIndex:n}}function qw({hit:e}){const t=Fw(e.snippet);return h.jsxs("a",{href:Hn({name:"event",sessionId:e.session_id,seq:e.seq}),"data-slot":"search-hit","data-event-id":e.event_id,className:"flex flex-col gap-0.5 rounded-md px-2 py-1.5 text-xs text-foreground transition-colors hover:bg-surface",children:[h.jsxs("span",{className:"flex items-center gap-2 text-2xs uppercase tracking-widest text-muted",children:[h.jsx("span",{children:e.kind}),e.name===null?null:h.jsx("span",{className:"truncate",children:e.name}),h.jsxs("span",{className:"ml-auto font-mono",children:["#",e.seq]})]}),h.jsx("span",{className:"min-w-0 font-mono text-2xs leading-relaxed text-muted",children:t.map((n,r)=>n.matched?h.jsx("mark",{className:"bg-surface-raised text-foreground",children:n.text},r):h.jsx("span",{children:n.text},r))})]})}function Kw({scope:e,unprojectedCount:t,warm:n=null,onWarm:r}){return e==null?null:h.jsxs("div",{"data-slot":"search-scope",role:"status",className:"flex items-center gap-2 border-b border-border px-3 py-1.5 text-2xs text-muted",children:[h.jsx("span",{className:"min-w-0",children:Vw(e)}),t>0?h.jsx("button",{type:"button","data-slot":"search-warm",onClick:r,className:"ml-auto shrink-0 rounded-md bg-surface px-2 py-0.5 uppercase tracking-widest transition-colors hover:text-foreground",children:Hw(t,n)}):null]})}function Gw({sessionId:e,api:t}={}){const n=L.useMemo(()=>t??Hu(),[t]),[r,i]=L.useState(""),l=$w(r),o=Wu(`${l.kind==="idle"?"":l.q}|${e??""}`,p=>l.kind==="idle"?Promise.resolve(null):n.search(l.q,e===void 0?{}:{session:e},{signal:p})),s=o.kind==="ok"?o.value:null,[a,u]=L.useState(null),d=(s==null?void 0:s.unprojected_count)??0,c=Uw((s==null?void 0:s.items)??[]),f=o.kind==="ok"?Bw(l,(s==null?void 0:s.items.length)??0,d):null;return h.jsxs("main",{"data-slot":"search-view",className:"flex h-full min-h-0 flex-col",children:[h.jsx("div",{className:"flex h-12 shrink-0 items-center gap-3 border-b border-border px-3",children:h.jsx("input",{"data-slot":"search-input",type:"search",value:r,onChange:p=>{i(p.target.value)},placeholder:"Search transcripts","aria-label":"Search transcripts",className:"min-w-0 flex-1 bg-transparent text-sm text-foreground outline-none placeholder:text-muted"})}),h.jsx(Kw,{scope:(s==null?void 0:s.scope)??null,unprojectedCount:d,warm:a,onWarm:()=>{n.warm().then(({queued:p})=>{u({done:0,total:p})}).catch(()=>{})}}),h.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 py-2",children:o.kind==="error"?h.jsx("p",{className:"text-sm text-error",children:o.error.message}):f!==null?h.jsx("p",{"data-slot":"search-empty",className:"text-xs text-muted",children:f}):c.map(p=>h.jsxs("section",{className:"mb-3 flex flex-col gap-0.5",children:[h.jsx("h2",{className:"truncate px-2 text-2xs uppercase tracking-widest text-muted",children:p.title??p.projectPath}),p.hits.map(x=>h.jsx(qw,{hit:x},x.event_id))]},p.sessionId))})]})}function lg(e,t){const[n,r]=L.useState(null),i=t!==null&&t.image_count>0?t.id:null,l=(t==null?void 0:t.image_count)??0;return L.useEffect(()=>{if(e===void 0||i===null)return;const o=new AbortController,s=[],a=u=>e.getEventImage(i,u,{signal:o.signal}).then(d=>{if(o.signal.aborted)return{status:null};const c=URL.createObjectURL(d);return s.push(c),{url:c}},d=>({status:d instanceof Uu?d.status:null}));return Promise.all(Array.from({length:l},(u,d)=>a(d))).then(u=>{o.signal.aborted||r({eventId:i,outcomes:u})}),()=>{o.abort();for(const u of s)URL.revokeObjectURL(u);r(u=>(u==null?void 0:u.eventId)===i?null:u)}},[e,i,l]),n}function Yd(e=new Set){return{selectedId:void 0,expandedIds:e,focusedIndex:0}}function qu(e,t){return t<=0?0:Math.min(Math.max(e,0),t-1)}function Qw(e,t){const n=new Set(e);return n.add(t),n}function Yw(e,t){const n=new Set(e);return n.delete(t),n}function Xd(e,t){const n=e[t];if(n===void 0)return t;for(let r=t-1;r>=0;r-=1){const i=e[r];if(i!==void 0&&i.depth<n.depth)return r}return t}function Lt(e,t,n){const r=qu(t,n.length);return r===e.focusedIndex?e:{...e,focusedIndex:r}}function Xw(e,t,n){const r=qu(e.focusedIndex,t.length),i=e.selectedId!==void 0&&n.has(e.selectedId)?e.selectedId:void 0;return r===e.focusedIndex&&i===e.selectedId?e:{...e,focusedIndex:r,selectedId:i}}function Jd(e,t){const n=new Set(e.expandedIds);for(const r of t)n.add(r);return n.size===e.expandedIds.size?e:{...e,expandedIds:n}}function Jw(e,t,n){const r=qu(e.focusedIndex,n.length),i=n[r];switch(t){case"j":case"ArrowDown":return Lt(e,r+1,n);case"k":case"ArrowUp":return Lt(e,r-1,n);case"Home":return Lt(e,0,n);case"End":return Lt(e,n.length-1,n);case"Enter":return i===void 0||i.id===e.selectedId?Lt(e,r,n):{...e,focusedIndex:r,selectedId:i.id};case"Escape":return Lt(e,Xd(n,r),n);case"ArrowRight":return i===void 0||!i.hasChildren?Lt(e,r,n):i.expanded?Lt(e,r+1,n):{...e,focusedIndex:r,expandedIds:Qw(e.expandedIds,i.id)};case"ArrowLeft":return i!==void 0&&i.hasChildren&&i.expanded?{...e,focusedIndex:r,expandedIds:Yw(e.expandedIds,i.id)}:Lt(e,Xd(n,r),n);default:return Lt(e,r,n)}}function Zw(e,t){return t.type==="rows-changed"?Xw(e,t.rows,t.modelIds):Jw(e,t.key,t.rows)}const eS=["thread","tree"],Zd="reasoning not recorded (signature only)",ef=Bm*5;function tS(e){return[...e].sort((t,n)=>t.seq-n.seq).map(nS)}function nS(e){const t=Km(e.kind);switch(t){case"tool_call":return{kind:"tool",event:e,name:e.name??e.kind,status:Vu(e.status),input:Ri(e.input,ef),output:Ri(e.text,ef)};case"thinking":return rS(e);case"unknown":return iS(e);default:return{kind:"message",event:e,eventKind:t,text:og(e.text)}}}function rS(e){const t=Ri(e.text);return t===null||t===Zd?{kind:"thinking",event:e,text:Zd,recorded:!1}:{kind:"thinking",event:e,text:t,recorded:!0}}function iS(e){const t=og(e.text);return{kind:"unknown",event:e,label:t===null?`unrecognized record (type=${tf(e)})`:tf(e),text:t,role:e.rendered_role,record:JSON.stringify(lS(e),null,2)}}function tf(e){const t=e.raw_subtype;return t===null||t===""?e.raw_type:`${e.raw_type}/${t}`}function lS(e){return{id:e.id,seq:e.seq,ts:e.ts,turn_id:e.turn_id,kind:e.kind,raw_type:e.raw_type,raw_subtype:e.raw_subtype,rendered_role:e.rendered_role}}function og(e){return e===null||e.trim()===""?null:e}function oS(e){const t=[];for(const n of e)if(n.kind==="message")t.push({kind:"message",id:n.event.id,row:n});else{const r=t.at(-1);(r==null?void 0:r.kind)==="activity"?r.rows.push(n):t.push({kind:"activity",id:n.event.id,rows:[n]})}return t}function sS(e){const t=e.filter(l=>l.kind==="tool"),n=t.filter(l=>l.event.child_session_id!==null).length,r=e.filter(l=>l.kind==="thinking").length,i=e.filter(l=>l.kind==="unknown").length;return[t.length>0?`${t.length} tool ${t.length===1?"call":"calls"}`:"",n>0?`${n} ${n===1?"subagent":"subagents"}`:"",r>0?"reasoning":"",i>0?`${i} ${i===1?"record":"records"}`:""].filter(Boolean).join(" · ")}function aS(){const e=new Set,t=new Set;return{isDismissed:n=>e.has(n),dismiss(n){if(!e.has(n)){e.add(n);for(const r of t)r()}},subscribe(n){return t.add(n),()=>{t.delete(n)}}}}const gs=aS();function sg(e){return{dismissed:L.useSyncExternalStore(gs.subscribe,()=>gs.isDismissed(e),()=>!1),dismiss:()=>gs.dismiss(e)}}function uS(e){const t=q0(e),{dismissed:n,dismiss:r}=sg(`drift:${e.sessionId}`);return t===null||n?null:h.jsxs("div",{"data-slot":"drift-banner",role:"alert",className:"flex items-center gap-2 border-b border-border bg-surface px-3 py-1.5 text-2xs text-error",children:[h.jsx(Yk,{size:12,"aria-hidden":"true",className:"shrink-0"}),h.jsx("span",{className:"min-w-0",children:t}),h.jsx("button",{type:"button","aria-label":"Dismiss unrecognized records notice",title:"Dismiss until reload",onClick:r,className:"ml-auto flex size-6 shrink-0 items-center justify-center rounded-md text-muted hover:bg-surface-raised hover:text-foreground",children:h.jsx(bm,{size:14,"aria-hidden":"true"})})]})}const cS=["inline","line_ref","spill","missing"];function dS(e){return cS.find(t=>t===e)??"unclassified"}const fS="Nothing was recorded for this half.",pS="Full output no longer on disk.",ag="Showing the stored head of a larger body.",hS="The body was written to a file beside the transcript.";function ug(e,t,n){const r=mS(e,t,n),i=r===null?gS(e,t):r.content,l=dS(r===null?xS(e,t):r.storage),o=i!==null&&i!=="";switch(l){case"missing":return Yr("missing",pS,o?i:null,!1,!1);case"spill":return Yr("spill",o?null:hS,o?i:null,!1,!o);case"line_ref":{const s=r===null||r.truncated;return Yr("line_ref",s?ag:null,i,s,s)}default:return o?Yr(l,null,i,!1,!1):Yr("empty",fS,null,!1,!1)}}function Yr(e,t,n,r,i){return{kind:e,note:t,body:n,truncated:r,canRefetch:i}}function mS(e,t,n){return n===null?null:n.id===e.id&&n.field===t?n:null}function gS(e,t){return t==="input"?e.input:e.text}function xS(e,t){return t==="input"?e.input_storage:e.output_storage}function cg(e){const t=e.wire_input;return t===null||t===""?null:{body:t,note:e.wire_input_storage==="line_ref"?ag:null}}const yS=new Map([[410,"Image no longer on disk."],[413,"Image too large to serve."],[415,"Image type not displayable."]]),kS="Image could not be read.";function vS(e,t){const n=(t==null?void 0:t.eventId)===e.id?t.outcomes:[];return Array.from({length:e.image_count},(r,i)=>wS(n[i]))}function wS(e){return e===void 0?{url:null,note:null}:"url"in e?{url:e.url,note:null}:{url:null,note:(e.status===null?void 0:yS.get(e.status))??kS}}function SS(e,t){return t===null||t.id!==e.id||t.fields.length===0?null:t.fields}function dg({event:e,images:t}){const n=vS(e,t);return n.length===0?null:h.jsx("section",{"data-slot":"event-images",className:"flex flex-col gap-2 pt-2",children:n.map((r,i)=>h.jsxs("figure",{"data-slot":"event-image",children:[r.url===null?null:h.jsx("a",{href:r.url,target:"_blank",rel:"noreferrer",children:h.jsx("img",{src:r.url,alt:`image ${i+1} of ${n.length}`,className:"max-h-96 max-w-full rounded-md border border-border object-contain"})}),r.note===null?null:h.jsx("figcaption",{"data-slot":"event-image-note",className:"text-2xs text-faint",children:r.note})]},i))})}const bS="No event is selected.";function CS({event:e,fetched:t,images:n=null,onShowFull:r,unrecognised:i}){return h.jsx("aside",{"data-slot":"span-detail",...e===null?{}:{"data-event-id":e.id},className:"w-96 shrink-0 overflow-y-auto p-3 text-xs text-foreground",children:e===null?h.jsx("p",{className:"text-faint",children:bS}):h.jsxs(h.Fragment,{children:[h.jsx(ES,{event:e}),h.jsx(nf,{event:e,field:"input",title:"INPUT",fetched:t,onShowFull:r}),h.jsx(_S,{event:e}),h.jsx(nf,{event:e,field:"text",title:"OUTPUT",fetched:t,onShowFull:r}),h.jsx(dg,{event:e,images:n}),h.jsx(jS,{event:e,body:i??null}),h.jsx(zS,{event:e})]})})}function ES({event:e}){return h.jsxs("header",{"data-slot":"detail-heading",className:"border-b border-border pb-2",children:[h.jsx("p",{className:"truncate font-mono text-sm",children:e.name??e.kind}),h.jsx("p",{className:"truncate font-mono text-2xs text-faint",children:e.ts})]})}function nf({event:e,field:t,title:n,fetched:r,onShowFull:i}){const l=ug(e,t,r);return h.jsxs("section",{"data-slot":`detail-${t}`,"data-content-state":l.kind,className:"pt-3",children:[h.jsxs("div",{className:"flex items-baseline gap-2",children:[h.jsx("h2",{className:"text-2xs tracking-widest text-muted",children:n}),h.jsx(NS,{content:l})]}),h.jsx(TS,{content:l}),l.canRefetch&&i!==void 0?h.jsx("button",{type:"button","data-slot":"detail-show-full",onClick:()=>i(e.id,t),className:"mt-1 font-mono text-2xs text-accent",children:"Show full"}):null]})}function _S({event:e}){const t=cg(e);return t===null?null:h.jsxs("section",{"data-slot":"detail-wire-input",className:"pt-3",children:[h.jsxs("div",{className:"flex items-baseline gap-2",children:[h.jsx("h2",{className:"text-2xs tracking-widest text-muted",children:"WHAT RAN"}),h.jsx("span",{"data-slot":"detail-wire-label",className:"rounded-md bg-surface-raised px-1.5 py-0.5 font-mono text-2xs text-muted",children:"differs from input"})]}),h.jsx(IS,{wire:t})]})}function IS({wire:e}){return h.jsxs(h.Fragment,{children:[e.note===null?null:h.jsx("p",{"data-slot":"detail-wire-note",className:"pt-1 text-2xs text-faint",children:e.note}),h.jsx("pre",{"data-slot":"detail-wire-body",className:"mt-1 whitespace-pre-wrap break-words font-mono text-2xs text-foreground",children:e.body})]})}function NS({content:e}){return h.jsx("span",{"data-slot":"detail-storage",className:"rounded-md bg-surface-raised px-1.5 py-0.5 font-mono text-2xs text-muted",children:e.kind})}function TS({content:e}){return h.jsxs(h.Fragment,{children:[e.note===null?null:h.jsx("p",{"data-slot":"detail-note",className:"pt-1 text-2xs text-faint",children:e.note}),e.body===null?null:h.jsx("pre",{"data-slot":"detail-body",className:"mt-1 whitespace-pre-wrap break-words font-mono text-2xs text-foreground",children:e.body})]})}function jS({event:e,body:t}){const n=SS(e,t);return n===null?null:h.jsxs("details",{"data-slot":"detail-unrecognised",className:"mt-3 border-t border-border pt-2",children:[h.jsx("summary",{className:"cursor-pointer text-2xs text-muted",children:`Unrecognized fields (${n.length})`}),n.map(r=>h.jsxs("div",{className:"pt-1",children:[h.jsxs("p",{className:"font-mono text-2xs text-muted",children:[r.name,r.line==="result"?h.jsx("span",{className:"text-faint",children:" (on the tool result)"}):null]}),h.jsx("pre",{className:"mt-1 whitespace-pre-wrap break-words font-mono text-2xs text-foreground",children:r.value})]},`${r.line}:${r.name}`))]})}function zS({event:e}){return h.jsxs("details",{"data-slot":"detail-raw",className:"mt-3 border-t border-border pt-2",children:[h.jsx("summary",{className:"cursor-pointer text-2xs text-muted",children:"Raw record"}),h.jsx("pre",{className:"mt-1 whitespace-pre-wrap break-words font-mono text-2xs text-muted",children:JSON.stringify(e,null,2)})]})}function PS({label:e,onResume:t}){return e===null?null:h.jsxs("button",{type:"button","data-slot":"follow-pill",onClick:t,className:"flex items-center gap-1.5 rounded-full border border-border bg-surface px-3 py-1 text-2xs text-fg shadow-sm",children:[h.jsxs("span",{children:["Following paused — ",e]}),h.jsx(To,{size:12,"aria-hidden":"true",className:"shrink-0"})]})}function Ku({duration:e,tokens:t,cost:n,costUnknown:r,className:i}){return h.jsxs("span",{"data-slot":"metric-chips",className:fe("inline-flex items-center gap-1",i),children:[h.jsx(xs,{slot:"metric-duration",children:e}),h.jsx(xs,{slot:"metric-tokens",children:t}),h.jsx(xs,{slot:"metric-cost",unknown:r,children:n})]})}function xs({slot:e,unknown:t,children:n}){return n===void 0?null:h.jsx("span",{"data-slot":e,title:t,"aria-label":t,className:fe("rounded-md bg-surface-raised px-1.5 py-0.5 font-mono text-2xs",t===void 0?"text-muted":"text-faint"),children:n})}const fg={live:{badge:"text-running",dot:"bg-running animate-live-pulse",label:"live"},complete:{badge:"text-muted",dot:"bg-success",label:"complete"},interrupted:{badge:"text-warning",dot:"bg-warning",label:"interrupted"}},Te={type:{llm_call:{tint:"text-span-llm",Icon:qk,label:"model call"},tool_call:{tint:"text-span-tool",Icon:ev,label:"tool call"},thinking:{tint:"text-span-thinking",Icon:xk,label:"thinking"},subagent:{tint:"text-span-subagent",Icon:Du,label:"sub-agent"},generic:{tint:"text-span-generic",Icon:mk,label:"activity"}},status:{running:{row:"",tint:"text-running animate-live-pulse",Icon:Dk,label:"running"},ok:{row:"",tint:"text-success",Icon:Ek,label:"ok"},error:{row:"bg-error/8",tint:"text-error",Icon:Ik,label:"error"},denied:{row:"bg-error/8",tint:"text-error",Icon:fk,label:"denied"},unknown:{row:"",tint:"text-faint",Icon:Vk,label:"unknown"}},trace:{tint:"text-span-turn",Icon:wm,label:"turn"},triggerBadge:"rounded-md bg-surface-raised px-1.5 py-0.5 font-mono text-2xs text-muted",payloadChip:"rounded-md bg-surface-raised px-1.5 py-0.5 font-mono text-2xs text-muted",errorChip:"font-mono text-2xs text-error"},AS={tool_call:Te.type.tool_call,thinking:Te.type.thinking,text:Te.type.llm_call,prompt:Te.type.generic,error:Te.type.generic,compaction:Te.type.generic,unknown:Te.type.generic};function LS({session:e,now:t,view:n,onViewChange:r,parentSessionId:i}){var d;const l=((d=e.agent_description)==null?void 0:d.trim())||qm(e),o=fg[e.live?"live":"complete"],s=e.tokens_in+e.tokens_out,a=e.live?void 0:e.last_activity_at,u=e.est_cost;return h.jsxs("header",{"data-slot":"session-header",className:"flex shrink-0 flex-wrap items-center gap-x-5 gap-y-3 border-b border-border bg-surface/50 px-5 py-4 text-sm text-foreground",children:[h.jsxs("a",{href:Hn(i?{name:"session",sessionId:i}:{name:"sessions"}),"data-slot":"back-to-sessions","aria-label":i?"Back to parent session":"Back to sessions",className:"flex shrink-0 items-center gap-1 text-2xs uppercase tracking-widest text-muted transition-colors hover:text-foreground",children:[h.jsx(vk,{size:12,"aria-hidden":"true"}),i?"Parent session":"Sessions"]}),h.jsxs("div",{className:"min-w-0 flex-1 basis-60",children:[h.jsx("h1",{className:"truncate text-lg font-semibold",title:l,children:l}),h.jsx("p",{"data-slot":"session-project",className:"mt-1 truncate font-mono text-2xs text-muted",title:e.project_path,children:e.project_path})]}),h.jsxs("a",{href:Hn({name:"search",sessionId:e.id}),"data-slot":"in-session-search",className:"shrink-0 text-2xs uppercase tracking-widest text-muted transition-colors hover:text-foreground",children:[h.jsx(Sm,{size:14,className:"mr-1 inline-block","aria-hidden":"true"})," Search"]}),n===void 0||r===void 0?null:h.jsx(MS,{view:n,onViewChange:r}),h.jsxs("span",{className:fe("flex shrink-0 items-center gap-1 text-xs",o.badge),children:[h.jsx("span",{"aria-hidden":"true",className:fe("size-1.5 rounded-md",o.dot)}),o.label]}),h.jsxs("span",{"data-slot":"session-turns",className:"shrink-0 font-mono text-2xs text-muted",children:[qt(e.turn_count)," turns"]}),e.error_count>0?h.jsxs("span",{"data-slot":"session-errors",className:Te.errorChip,children:[e.error_count," err"]}):null,h.jsx(Ku,{className:"shrink-0",duration:Vm(e.started_at,a,t),tokens:`${qt(s)} tok`,cost:Mi(u),costUnknown:Rr(u,e.model)})]})}function MS({view:e,onViewChange:t}){return h.jsx("div",{role:"group","aria-label":"Session view",className:"inline-flex shrink-0 items-center gap-0.5 rounded-md bg-surface p-0.5",children:eS.map(n=>h.jsxs("button",{type:"button",...n==="thread"?{"data-slot":"thread-toggle"}:{},"aria-pressed":n===e,onClick:()=>{t(n)},className:fe("flex items-center gap-1.5 rounded-md px-3 py-2 text-xs transition-colors",n===e?"bg-surface-raised text-foreground":"text-muted"),children:[n==="thread"?h.jsx(wm,{size:13,"aria-hidden":"true"}):h.jsx(zk,{size:13,"aria-hidden":"true"}),n==="thread"?"Thread":"Tree"]},n))})}function RS(e,t,n){const r=new Array(e);return new Proxy(r,{get(i,l,o){if(typeof l=="string"){const s=l.charCodeAt(0);if(s>=48&&s<=57){const a=+l;if(Number.isInteger(a)&&a>=0&&a<e){let u=i[a];if(!u){const d=t[a*2];u=i[a]={index:a,key:n(a),start:d,size:t[a*2+1],end:d+t[a*2+1],lane:0}}return u}}if(l==="length")return e}return Reflect.get(i,l,o)}})}function lr(e,t,n){let r=n.initialDeps??[],i,l=!0;function o(){const s=e();return(s.length!==r.length||s.some((u,d)=>r[d]!==u))&&(r=s,i=t(...s),n!=null&&n.onChange&&!(l&&n.skipInitialOnChange)&&n.onChange(i),l=!1),i}return o.updateDeps=s=>{r=s},o}function rf(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const OS=(e,t)=>Math.abs(e-t)<1.01,DS=(e,t,n)=>{let r;return function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)}};let Xr;const ys=()=>{if(Xr!==void 0)return Xr;if(typeof navigator>"u")return Xr=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return Xr=!0;const e=navigator.maxTouchPoints;return Xr=navigator.platform==="MacIntel"&&e!==void 0&&e>0},lf=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},FS=e=>e,$S=e=>{const t=Math.max(e.startIndex-e.overscan,0),r=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,i=new Array(r);for(let l=0;l<r;l++)i[l]=t+l;return i},VS=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const i=o=>{const{width:s,height:a}=o;t({width:Math.round(s),height:Math.round(a)})};if(i(lf(n)),!r.ResizeObserver)return()=>{};const l=new r.ResizeObserver(o=>{const s=()=>{const a=o[0];if(a!=null&&a.borderBoxSize){const u=a.borderBoxSize[0];if(u){i({width:u.inlineSize,height:u.blockSize});return}}i(lf(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(s):s()});return l.observe(n,{box:"border-box"}),()=>{l.unobserve(n)}},so={passive:!0},BS=typeof window>"u"?!0:"onscrollend"in window,US=(e,t,n)=>{const r=e.scrollElement;if(!r)return;const i=e.targetWindow;if(!i)return;const l=e.options.useScrollendEvent&&BS;let o=0;const s=l?null:DS(i,()=>t(o,!1),e.options.isScrollingResetDelay),a=c=>()=>{o=n(r),s==null||s(),t(o,c)},u=a(!0),d=a(!1);return r.addEventListener("scroll",u,so),l&&r.addEventListener("scrollend",d,so),()=>{r.removeEventListener("scroll",u),l&&r.removeEventListener("scrollend",d)}},HS=(e,t)=>US(e,t,n=>{const{horizontal:r,isRtl:i}=e.options;return r?n.scrollLeft*(i&&-1||1):n.scrollTop}),WS=(e,t,n)=>{if(n.options.useCachedMeasurements){const r=n.indexFromElement(e),i=n.options.getItemKey(r);return n.itemSizeCache.get(i)??n.options.estimateSize(r)}if(t!=null&&t.borderBoxSize){const r=t.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}if(!t){const r=n.indexFromElement(e),i=n.options.getItemKey(r),l=n.itemSizeCache.get(i);if(l!==void 0)return l}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},qS=(e,{adjustments:t=0,behavior:n},r)=>{var i,l;(l=(i=r.scrollElement)==null?void 0:i.scrollTo)==null||l.call(i,{[r.options.horizontal?"left":"top"]:e+t,behavior:n})},KS=qS;class GS{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var n,r,i;return((i=(r=(n=this.targetWindow)==null?void 0:n.performance)==null?void 0:r.now)==null?void 0:i.call(r))??Date.now()},this.observer=(()=>{let n=null;const r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(i=>{i.forEach(l=>{const o=()=>{const s=l.target,a=this.indexFromElement(s);if(!s.isConnected){this.observer.unobserve(s);for(const[u,d]of this.elementsCache)if(d===s){this.elementsCache.delete(u);break}return}this.shouldMeasureDuringScroll(a)&&this.resizeItem(a,this.options.measureElement(s,l,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()})}));return{disconnect:()=>{var i;(i=r())==null||i.disconnect(),n=null},observe:i=>{var l;return(l=r())==null?void 0:l.observe(i,{box:"border-box"})},unobserve:i=>{var l;return(l=r())==null?void 0:l.unobserve(i)}}})(),this.range=null,this.setOptions=n=>{var r,i;const l={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:FS,rangeExtractor:$S,onChange:()=>{},measureElement:WS,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(const f in n){const p=n[f];p!==void 0&&(l[f]=p)}const o=this.options;let s=null,a=null,u=!1;if(o!==void 0&&o.enabled&&l.enabled&&l.anchorTo==="end"&&this.scrollElement!==null){const f=o.count,p=l.count,x=this.getMeasurements(),v=f>0?((r=x[0])==null?void 0:r.key)??o.getItemKey(0):null,_=f>0?((i=x[f-1])==null?void 0:i.key)??o.getItemKey(f-1):null;if(p!==f||f>0&&p>0&&(l.getItemKey(0)!==v||l.getItemKey(p-1)!==_)){u=!0;const k=f>0?this.getVirtualItemForOffset(this.getScrollOffset())??x[0]:null;k&&(s=[k.key,this.getScrollOffset()-k.start]);const C=l.followOnAppend===!0?"auto":l.followOnAppend||null;C&&p>f&&this.isAtEnd(o.scrollEndThreshold)&&(f===0||l.getItemKey(p-1)!==_)&&(a=C)}}this.options=l,u&&(this.pendingMin=0,this.itemSizeCacheVersion++);let d=!1,c=0;if(s&&this.scrollOffset!==null){const[f,p]=s,x=this.getMeasurements(),{count:v,getItemKey:_}=this.options;let m=0;for(;m<v&&_(m)!==f;)m++;if(m<v){const g=x[m];if(g){const k=Math.max(0,g.start+p);k!==this.scrollOffset&&(c=k-this.scrollOffset,this.scrollOffset=k,d=!0)}}}(d||a)&&(this.pendingScrollAnchor=[d?s[0]:null,d?s[1]:0,a,c])},this.notify=n=>{var r,i;(i=(r=this.options).onChange)==null||i.call(r,this,n)},this.maybeNotify=lr(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}if(this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(l=>{this.observer.observe(l)}),this.unsubs.push(this.options.observeElementRect(this,l=>{this.scrollRect=l,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(l,o)=>{if(o&&this._intendedScrollOffset===null&&l===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(l-this._intendedScrollOffset)<1.5&&(l=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0;const s=this.getScrollOffset();this.scrollDirection=o?s===l?this.scrollDirection:s<l?"forward":"backward":null,this.scrollOffset=l,this.isScrolling=o,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){const l=this.scrollElement,o=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},s=()=>{this._iosTouching=!1,!(!ys()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};l.addEventListener("touchstart",o,so),l.addEventListener("touchend",s,so),this.unsubs.push(()=>{l.removeEventListener("touchstart",o),l.removeEventListener("touchend",s),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const i=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,i&&this.scrollElement&&this.options.enabled){const[l,o,s,a]=i;l!==null&&!s&&(ys()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?a!==0&&(this._iosDeferredAdjustment+=a):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),s&&this.scrollToEnd({behavior:s})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const n=this.getScrollOffset(),r=this.getMaxScrollOffset();if(n<0||n>r)return;if(this._iosDeferredAdjustment<0&&n>=r-1){this._iosDeferredAdjustment=0;return}const i=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(n,{adjustments:this.scrollAdjustments+=i,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=lr(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(n,r,i,l,o,s,a,u)=>(this.prevLanes!==void 0&&this.prevLanes!==s&&(this.lanesChangedFlag=!0),this.prevLanes=s,this.pendingMin=null,{count:n,paddingStart:r,scrollMargin:i,getItemKey:l,enabled:o,lanes:s,laneAssignmentMode:a,gap:u}),{key:!1}),this.getMeasurements=lr(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:n,paddingStart:r,scrollMargin:i,getItemKey:l,enabled:o,lanes:s,laneAssignmentMode:a,gap:u},d)=>{const c=this.itemSizeCache;if(!o)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>n)for(const m of this.laneAssignments.keys())m>=n&&this.laneAssignments.delete(m);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(m=>{this.itemSizeCache.set(m.key,m.size)}));const f=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===n&&(this.lanesSettling=!1),s===1){const m=n*2;let g=this._flatMeasurements;if(!g||g.length<m){const N=new Float64Array(m);g&&f>0&&N.set(g.subarray(0,f*2)),g=N,this._flatMeasurements=g}let k;if(f===0)k=r+i;else{const N=f-1;k=g[N*2]+g[N*2+1]+u}for(let N=f;N<n;N++){const b=l(N),I=c.get(b),E=typeof I=="number"?I:this.options.estimateSize(N);g[N*2]=k,g[N*2+1]=E,k+=E+u}const C=RS(n,g,l);return this.measurementsCache=C,C}const p=this.measurementsCache.slice(0,f),x=new Array(s).fill(void 0),v=new Float64Array(s);let _=0;for(let m=0;m<f;m++){const g=p[m];g&&(x[g.lane]===void 0&&_++,x[g.lane]=m,v[g.lane]=g.end)}for(let m=f;m<n;m++){const g=l(m),k=this.laneAssignments.get(m);let C,N;const b=a==="estimate"||c.has(g);if(k!==void 0&&this.options.lanes>1){C=k;const S=x[C],z=S!==void 0?p[S]:void 0;N=z?z.end+u:r+i}else if(_===s){let S=0,z=v[0],O=x[0];for(let U=1;U<s;U++){const Q=v[U];(Q<z||Q===z&&x[U]<O)&&(S=U,z=Q,O=x[U])}C=S,N=z+u,b&&this.laneAssignments.set(m,C)}else C=m%this.options.lanes,N=r+i,b&&this.laneAssignments.set(m,C);const I=c.get(g),E=typeof I=="number"?I:this.options.estimateSize(m),j=N+E;p[m]={index:m,start:N,size:E,end:j,key:g,lane:C},x[C]===void 0&&_++,x[C]=m,v[C]=j}return this.measurementsCache=p,p},{key:!1,debug:()=>this.options.debug}),this.calculateRange=lr(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,i,l)=>n.length===0||r===0?(this.range=null,null):(this.range=YS(n,r,i,l,l===1&&this._flatMeasurements!=null?this._flatMeasurements:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=lr(()=>{let n=null,r=null;const i=this.calculateRange();return i&&(n=i.startIndex,r=i.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,r]},(n,r,i,l,o)=>l===null||o===null?[]:n({startIndex:l,endIndex:o,overscan:r,count:i}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const r=this.options.indexAttribute,i=n.getAttribute(r);return i?parseInt(i,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=n=>{var r;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const i=this.scrollState.index??((r=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:r.index);if(i!==void 0&&this.range){const l=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),o=Math.max(0,i-l),s=Math.min(this.options.count-1,i+l);return n>=o&&n<=s}return!0},this.measureElement=n=>{if(!n){this.elementsCache.forEach((o,s)=>{o.isConnected||(this.observer.unobserve(o),this.elementsCache.delete(s))});return}const r=this.indexFromElement(n),i=this.options.getItemKey(r),l=this.elementsCache.get(i);l!==n&&(l&&this.observer.unobserve(l),this.observer.observe(n),this.elementsCache.set(i,n)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(r)&&this.resizeItem(r,this.options.measureElement(n,void 0,this))},this.resizeItem=(n,r)=>{var i,l;if(n<0||n>=this.options.count)return;let o,s,a;const u=this._flatMeasurements;if(this.options.lanes===1&&u!==null)a=this.options.getItemKey(n),s=u[n*2],o=u[n*2+1];else{const f=this.measurementsCache[n];if(!f)return;a=f.key,s=f.start,o=f.size}const d=this.itemSizeCache.get(a)??o,c=r-d;if(c!==0){const f=this.options.anchorTo==="end"&&((i=this.scrollState)==null?void 0:i.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,p=f?this.getTotalSize():0,x=this.getScrollOffset()+this.scrollAdjustments,_=!this.itemSizeCache.has(a)?s<x:s+d<=x&&this.scrollDirection!=="backward",m=((l=this.scrollState)==null?void 0:l.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[n]??{index:n,key:a,start:s,size:o,end:s+o,lane:0},c,this):_);(this.pendingMin===null||n<this.pendingMin)&&(this.pendingMin=n),this.itemSizeCache.set(a,r),this.itemSizeCacheVersion++;let g=!1;f?g=this.applyScrollAdjustment(this.getTotalSize()-p):m&&(g=this.applyScrollAdjustment(c)),this.notify(g)}},this.getVirtualItems=lr(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const i=[];for(let l=0,o=n.length;l<o;l++){const s=n[l],a=r[s];i.push(a)}return i},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length===0)return;const i=this._flatMeasurements,l=this.options.lanes===1&&i!=null,o=pg(0,r.length-1,l?s=>i[s*2]:s=>rf(r[s]).start,n);return rf(r[o])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const n=this.scrollElement.document.documentElement;return this.options.horizontal?n.scrollWidth-this.scrollElement.innerWidth:n.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(n=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=n,this.getOffsetForAlignment=(n,r,i=0)=>{if(!this.scrollElement)return 0;const l=this.getSize(),o=this.getScrollOffset();r==="auto"&&(r=n>=o+l?"end":"start"),r==="center"?n+=(i-l)/2:r==="end"&&(n-=l);const s=this.getMaxScrollOffset();return Math.max(Math.min(s,n),0)},this.getOffsetForIndex=(n,r="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const i=this.getSize(),l=this.getScrollOffset(),o=this.measurementsCache[n];if(!o)return;if(r==="auto")if(o.end>=l+i-this.options.scrollPaddingEnd)r="end";else if(o.start<=l+this.options.scrollPaddingStart)r="start";else return[l,r];if(r==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),r];const s=r==="end"?o.end+this.options.scrollPaddingEnd:o.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(s,r,o.size),r]},this.scrollToOffset=(n,{align:r="start",behavior:i="auto"}={})=>{this._iosDeferredAdjustment=0;const l=this.getOffsetForAlignment(n,r),o=this.now();this.scrollState={index:null,align:r,behavior:i,startedAt:o,lastTargetOffset:l,stableFrames:0},this._scrollToOffset(l,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollToIndex=(n,{align:r="auto",behavior:i="auto"}={})=>{this._iosDeferredAdjustment=0,n=Math.max(0,Math.min(n,this.options.count-1));const l=this.getOffsetForIndex(n,r);if(!l)return;const[o,s]=l,a=this.now();this.scrollState={index:n,align:s,behavior:i,startedAt:a,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollBy=(n,{behavior:r="auto"}={})=>{const i=this.getScrollOffset()+n,l=this.now();this.scrollState={index:null,align:"start",behavior:r,startedAt:l,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:n="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:n});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:n})},this.getTotalSize=()=>{var n;const r=this.getMeasurements();let i;if(r.length===0)i=this.options.paddingStart;else if(this.options.lanes===1){const l=r.length-1,o=this._flatMeasurements;o!=null?i=o[l*2]+o[l*2+1]:i=((n=r[l])==null?void 0:n.end)??0}else{const l=Array(this.options.lanes).fill(null);let o=r.length-1;for(;o>=0&&l.some(s=>s===null);){const s=r[o];l[s.lane]===null&&(l[s.lane]=s.end),o--}i=Math.max(...l.filter(s=>s!==null))}return Math.max(i-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const n=[];if(this.itemSizeCache.size===0)return n;const r=this.getMeasurements();for(const i of r)i&&this.itemSizeCache.has(i.key)&&n.push({index:i.index,key:i.key,start:i.start,size:i.size,end:i.end,lane:i.lane});return n},this._scrollToOffset=(n,{adjustments:r,behavior:i})=>{this._intendedScrollOffset=n+(r??0),this.options.scrollToFn(n,{behavior:i,adjustments:r},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(t)}applyScrollAdjustment(t,n){return t===0?!1:ys()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?(this._iosDeferredAdjustment+=t,!1):(this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=t,behavior:n}),this.scrollOffset!==null&&(this.scrollOffset+=this.scrollAdjustments,this.scrollOffset<0&&(this.scrollOffset=0),this.scrollAdjustments=0),!0)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const r=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,i=r?r[0]:this.scrollState.lastTargetOffset,l=1,o=i!==this.scrollState.lastTargetOffset;if(!o&&OS(i,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=l){this.getScrollOffset()!==i&&this._scrollToOffset(i,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,o){const s=this.getSize()||600,a=Math.abs(i-this.getScrollOffset()),u=this.scrollState.behavior==="smooth"&&a>s;this.scrollState.lastTargetOffset=i,u||(this.scrollState.behavior="auto"),this._scrollToOffset(i,{adjustments:void 0,behavior:u?"smooth":"auto"})}this.scheduleScrollReconcile()}}const pg=(e,t,n,r)=>{for(;e<=t;){const i=(e+t)/2|0,l=n(i);if(l<r)e=i+1;else if(l>r)t=i-1;else return i}return e>0?e-1:0};function QS(e,t,n){let r=0;for(;r<=t;){const i=(r+t)/2|0,l=e[i*2];if(l<n)r=i+1;else if(l>n)t=i-1;else return i}return r>0?r-1:0}function YS(e,t,n,r,i){const l=e.length-1;if(e.length<=r)return{startIndex:0,endIndex:l};if(r===1&&i!==null){const u=QS(i,l,n);let d=u;const c=n+t;for(;d<l&&i[d*2]+i[d*2+1]<c;)d++;return{startIndex:u,endIndex:d}}let s=pg(0,l,u=>e[u].start,n),a=s;if(r===1)for(;a<l&&e[a].end<n+t;)a++;else if(r>1){const u=Array(r).fill(0);for(;a<l&&u.some(c=>c<n+t);){const c=e[a];u[c.lane]=c.end,a++}const d=Array(r).fill(n+t);for(;s>=0&&d.some(c=>c>=n);){const c=e[s];d[c.lane]=c.start,s--}s=Math.max(0,s-s%r),a=Math.min(l,a+(r-1-a%r))}return{startIndex:s,endIndex:a}}const ks=typeof document<"u"?L.useLayoutEffect:L.useEffect;function XS({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:n="transform",...r}){const i=L.useReducer(d=>d+1,0)[1],l=L.useRef({enabled:t,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});l.current.enabled=t,l.current.mode=n;const o=d=>{const c=l.current;if(!c.enabled||!c.container)return;const f=d.getTotalSize();if(f!==c.lastSize){c.lastSize=f;const p=d.options.horizontal?"width":"height";c.container.style[p]=`${f}px`}},s=d=>{const c=l.current;if(!c.enabled||!c.container)return;o(d);const f=!!d.options.horizontal,p=c.mode==="transform",x=f?"left":"top",v=d.options.scrollMargin,_=d.getVirtualItems();for(const m of _){const g=m.start-v,k=d.elementsCache.get(m.key);k&&c.lastPositions.get(k)!==g&&(c.lastPositions.set(k,g),p?k.style.transform=f?`translate3d(${g}px, 0, 0)`:`translate3d(0, ${g}px, 0)`:k.style[x]=`${g}px`)}},a={...r,onChange:(d,c)=>{var f;const p=l.current;let x=!0;if(p.enabled){s(d);const v=d.range,_=p.prevRange;x=!_||_.isScrolling!==d.isScrolling||_.startIndex!==(v==null?void 0:v.startIndex)||_.endIndex!==(v==null?void 0:v.endIndex),x&&(p.prevRange=v?{startIndex:v.startIndex,endIndex:v.endIndex,isScrolling:d.isScrolling}:null)}x&&(e&&c?xm.flushSync(i):i()),(f=r.onChange)==null||f.call(r,d,c)}},[u]=L.useState(()=>{const d=new GS(a);return Object.assign(d,{containerRef:c=>{const f=l.current;if(f.container=c,f.lastSize=null,c&&f.enabled){const p=d.getTotalSize();f.lastSize=p;const x=d.options.horizontal?"width":"height";c.style[x]=`${p}px`}}})});return u.setOptions(a),ks(()=>u._didMount(),[]),ks(()=>(o(u),u._willUpdate())),ks(()=>{s(u)}),u}function JS(e){return XS({observeElementRect:VS,observeElementOffset:HS,scrollToFn:KS,...e})}const hg=14,of=Te.type.subagent,ZS={elapsed:"elapsed, approval wait included",sidecar_span:"measured by the sub-agent span",reported:"reported by the harness",none:"not measured"};function eb({row:e,selected:t,focused:n,onSelect:r,onToggle:i}){const{event:l,kind:o,status:s}=e.node,a=AS[o],u=Te.status[s],d=l.name??l.kind,c=P0(l.duration_source),f=ZS[c],p=Ri(l.input),x=Ri(l.text),v=cg(l)!==null,_=l.child_session_id,m=_===null?null:{type:l.agent_type??Te.type.subagent.label,status:F0(l.agent_status)};return h.jsxs("div",{role:"treeitem","data-slot":"span-row","data-span-status":s,"data-event-kind":o,"data-event-id":l.id,"data-session-id":e.sessionId,..._===null?{}:{"data-child-session-id":_},"aria-level":e.depth+1,"aria-setsize":e.setSize,"aria-posinset":e.posInSet,"aria-selected":t,...e.hasChildren?{"aria-expanded":e.expanded}:{},"aria-label":[`${a.label} ${d}`,...m===null?[]:[`sub-agent ${m.type}, ${m.status}`],u.label,f].join(", "),tabIndex:n?0:-1,onClick:()=>r==null?void 0:r(e.id),className:fe("border-l-2 text-xs text-foreground",u.row,t?"border-l-accent bg-accent-muted":"border-l-background"),style:{paddingLeft:e.depth*hg},children:[h.jsxs("div",{className:"flex h-7 items-center gap-2 pr-2",children:[h.jsx(tb,{row:e,name:d,onToggle:i}),h.jsx("span",{"data-slot":"span-type",className:fe("shrink-0",a.tint),children:h.jsx(a.Icon,{size:12,"aria-hidden":"true"})}),h.jsx("span",{"data-slot":"span-name",className:"min-w-0 flex-1 truncate",children:d}),m===null?null:h.jsxs("span",{"data-slot":"span-subagent",className:fe("flex shrink-0 items-center gap-1",of.tint),children:[h.jsx(of.Icon,{size:12,"aria-hidden":"true"}),h.jsx("span",{className:"font-mono text-2xs",children:m.type}),h.jsx("span",{className:Te.triggerBadge,children:m.status})]}),h.jsx("span",{"data-slot":"span-status",role:"img",title:u.label,"aria-label":u.label,className:fe("shrink-0",u.tint),children:h.jsx(u.Icon,{size:12,"aria-hidden":"true"})}),h.jsx("span",{"data-slot":"span-metrics","data-duration-source":c,title:f,className:"shrink-0",children:h.jsx(Gu,{values:Qm(l),showErrors:!1})})]}),p===null&&x===null&&!v?null:h.jsxs("div",{"data-slot":"span-payload",className:"flex items-center gap-2 pb-1 pl-6 pr-2",children:[v?h.jsx("span",{"data-slot":"span-wire",title:"The harness rewrote this call; the executed form is in the detail pane",className:fe("shrink-0",Te.payloadChip),children:"≠ what ran"}):null,p===null?null:h.jsx("span",{"data-slot":"span-input",className:fe("min-w-0 truncate",Te.payloadChip),children:p}),x===null?null:h.jsx("span",{"data-slot":"span-output",className:fe("min-w-0 truncate",Te.payloadChip),children:x})]})]})}function tb({row:e,name:t,onToggle:n}){if(!e.hasChildren)return h.jsx("span",{"data-slot":"span-expand-space","aria-hidden":"true",className:"w-3.5 shrink-0"});const r=e.expanded?To:Li;return h.jsx("button",{type:"button","data-slot":"span-expand",tabIndex:-1,"aria-label":e.expanded?`collapse ${t}`:`expand ${t}`,onClick:i=>{i.stopPropagation(),n==null||n(e.id)},className:"shrink-0 text-faint",children:h.jsx(r,{size:14,"aria-hidden":"true"})})}function Gu({values:e,showErrors:t}){return h.jsxs(h.Fragment,{children:[t&&e.errorCount>0?h.jsxs("span",{"data-slot":"row-errors",className:Te.errorChip,children:[e.errorCount," err"]}):null,h.jsx(Ku,{className:"shrink-0",duration:d0(e.durationMs),...e.tokens>0?{tokens:`${qt(e.tokens)} tok`}:{},...e.costUnknown!==void 0?{cost:Mi(e.cost),costUnknown:e.costUnknown}:e.cost!==null&&e.cost>0?{cost:Mi(e.cost)}:{}})]})}function nb({row:e,selected:t,focused:n,onSelect:r,onToggle:i}){const{turn:l}=e,{Icon:o,tint:s,label:a}=Te.trace,u=e.expanded?To:Li,d=O0(l);return h.jsxs("div",{role:"treeitem","data-slot":"trace-group","data-turn-kind":l.kind,"data-session-id":e.sessionId,"aria-level":e.depth+1,"aria-setsize":e.setSize,"aria-posinset":e.posInSet,"aria-selected":t,...e.hasChildren?{"aria-expanded":e.expanded}:{},"aria-label":`${a} ${l.seq}: ${d}`,tabIndex:n?0:-1,onClick:()=>r==null?void 0:r(e.id),className:fe("flex h-9 items-center gap-2 border-l-2 border-b border-b-border bg-surface pr-2 text-xs text-foreground",t?"border-l-accent bg-accent-muted":"border-l-background"),style:{paddingLeft:e.depth*hg},children:[h.jsx("button",{type:"button","data-slot":"trace-expand",tabIndex:-1,"aria-label":e.expanded?`collapse turn ${l.seq}`:`expand turn ${l.seq}`,onClick:c=>{c.stopPropagation(),i==null||i(e.id)},className:"shrink-0 pl-1 text-faint",children:h.jsx(u,{size:14,"aria-hidden":"true"})}),h.jsx("span",{"data-slot":"trace-icon",className:fe("shrink-0",s),children:h.jsx(o,{size:12,"aria-hidden":"true"})}),h.jsx("span",{"data-slot":"trace-preview",className:"min-w-0 flex-1 truncate font-medium",children:d}),e.subagent===void 0?null:h.jsxs("span",{"data-slot":"trace-subagent",className:"flex min-w-0 items-center gap-2",children:[h.jsx("span",{"data-slot":"trace-agent-description",className:"min-w-0 truncate font-mono text-2xs text-muted",children:e.subagent.header.agent_description??""}),h.jsx(Ku,{className:"shrink-0",tokens:`${qt(e.subagent.header.tokens_in+e.subagent.header.tokens_out)} tok`,cost:Mi(e.subagent.header.est_cost),costUnknown:Rr(e.subagent.header.est_cost,e.subagent.header.model)})]}),l.kind==="human"?null:h.jsx("span",{"data-slot":"trace-trigger",title:`started by ${l.kind}`,"aria-label":`started by ${l.kind}`,className:Te.triggerBadge,children:l.kind}),h.jsx(Gu,{values:M0(l),showErrors:!0})]})}const rb=28,ib=8;function lb({rows:e,selectedId:t,focusedIndex:n,initialRect:r,estimateSize:i=rb,overscan:l=ib,followIndex:o,revealIndex:s,onScrollMetrics:a,onKeyDown:u,onSelect:d,onToggle:c}){const f=L.useRef(null),p=L.useRef(!1),x=JS({count:e.length,getScrollElement:()=>f.current,estimateSize:()=>i,overscan:l,getItemKey:_=>{var m;return((m=e[_])==null?void 0:m.id)??_},...r===void 0?{}:{initialRect:r}});L.useEffect(()=>{o!==void 0&&(p.current=!0,x.scrollToIndex(o,{align:"end"}))},[o,x]),L.useEffect(()=>{s!==void 0&&(p.current=!0,x.scrollToIndex(s,{align:"center"}))},[s,x]);const v=_=>{if(p.current){p.current=!1;return}const m=_.currentTarget;a==null||a({scrollTop:m.scrollTop,scrollHeight:m.scrollHeight,clientHeight:m.clientHeight})};return h.jsx("div",{ref:f,"data-slot":"span-tree-scroller",className:"h-full overflow-y-auto",onKeyDown:u,onScroll:v,children:h.jsx("div",{role:"tree","aria-label":"span tree","data-slot":"span-tree",className:"relative w-full",style:{height:x.getTotalSize()},children:x.getVirtualItems().map(_=>{const m=e[_.index];return m===void 0?null:h.jsx("div",{role:"presentation","data-index":_.index,ref:x.measureElement,className:"absolute left-0 w-full",style:{top:_.start},children:m.kind==="turn"?h.jsx(nb,{row:m,selected:m.id===t,focused:_.index===n,...d===void 0?{}:{onSelect:d},...c===void 0?{}:{onToggle:c}}):h.jsx(eb,{row:m,selected:m.id===t,focused:_.index===n,...d===void 0?{}:{onSelect:d},...c===void 0?{}:{onToggle:c}})},_.key)})})})}function ob(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const sb=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ab=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ub={};function sf(e,t){return(ub.jsx?ab:sb).test(e)}const cb=/[ \t\n\f\r]/g;function db(e){return typeof e=="object"?e.type==="text"?af(e.value):!1:af(e)}function af(e){return e.replace(cb,"")===""}class Hi{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Hi.prototype.normal={};Hi.prototype.property={};Hi.prototype.space=void 0;function mg(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new Hi(n,r,t)}function za(e){return e.toLowerCase()}class tt{constructor(t,n){this.attribute=n,this.property=t}}tt.prototype.attribute="";tt.prototype.booleanish=!1;tt.prototype.boolean=!1;tt.prototype.commaOrSpaceSeparated=!1;tt.prototype.commaSeparated=!1;tt.prototype.defined=!1;tt.prototype.mustUseProperty=!1;tt.prototype.number=!1;tt.prototype.overloadedBoolean=!1;tt.prototype.property="";tt.prototype.spaceSeparated=!1;tt.prototype.space=void 0;let fb=0;const q=tr(),Ee=tr(),Pa=tr(),A=tr(),de=tr(),Wn=tr(),it=tr();function tr(){return 2**++fb}const Aa=Object.freeze(Object.defineProperty({__proto__:null,boolean:q,booleanish:Ee,commaOrSpaceSeparated:it,commaSeparated:Wn,number:A,overloadedBoolean:Pa,spaceSeparated:de},Symbol.toStringTag,{value:"Module"})),vs=Object.keys(Aa);class Qu extends tt{constructor(t,n,r,i){let l=-1;if(super(t,n),uf(this,"space",i),typeof r=="number")for(;++l<vs.length;){const o=vs[l];uf(this,vs[l],(r&Aa[o])===Aa[o])}}}Qu.prototype.defined=!0;function uf(e,t,n){n&&(e[t]=n)}function Or(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const l=new Qu(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(l.mustUseProperty=!0),t[r]=l,n[za(r)]=r,n[za(l.attribute)]=r}return new Hi(t,n,e.space)}const gg=Or({properties:{ariaActiveDescendant:null,ariaAtomic:Ee,ariaAutoComplete:null,ariaBusy:Ee,ariaChecked:Ee,ariaColCount:A,ariaColIndex:A,ariaColSpan:A,ariaControls:de,ariaCurrent:null,ariaDescribedBy:de,ariaDetails:null,ariaDisabled:Ee,ariaDropEffect:de,ariaErrorMessage:null,ariaExpanded:Ee,ariaFlowTo:de,ariaGrabbed:Ee,ariaHasPopup:null,ariaHidden:Ee,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:de,ariaLevel:A,ariaLive:null,ariaModal:Ee,ariaMultiLine:Ee,ariaMultiSelectable:Ee,ariaOrientation:null,ariaOwns:de,ariaPlaceholder:null,ariaPosInSet:A,ariaPressed:Ee,ariaReadOnly:Ee,ariaRelevant:null,ariaRequired:Ee,ariaRoleDescription:de,ariaRowCount:A,ariaRowIndex:A,ariaRowSpan:A,ariaSelected:Ee,ariaSetSize:A,ariaSort:null,ariaValueMax:A,ariaValueMin:A,ariaValueNow:A,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function xg(e,t){return t in e?e[t]:t}function yg(e,t){return xg(e,t.toLowerCase())}const pb=Or({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Wn,acceptCharset:de,accessKey:de,action:null,allow:null,allowFullScreen:q,allowPaymentRequest:q,allowUserMedia:q,alpha:q,alt:null,as:null,async:q,autoCapitalize:null,autoComplete:de,autoFocus:q,autoPlay:q,blocking:de,capture:null,charSet:null,checked:q,cite:null,className:de,closedBy:null,colorSpace:null,cols:A,colSpan:A,command:null,commandFor:null,content:null,contentEditable:Ee,controls:q,controlsList:de,coords:A|Wn,crossOrigin:null,data:null,dateTime:null,decoding:null,default:q,defer:q,dir:null,dirName:null,disabled:q,download:Pa,draggable:Ee,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:q,formTarget:null,headers:de,height:A,hidden:Pa,high:A,href:null,hrefLang:null,htmlFor:de,httpEquiv:de,id:null,imageSizes:null,imageSrcSet:null,inert:q,inputMode:null,integrity:null,is:null,isMap:q,itemId:null,itemProp:de,itemRef:de,itemScope:q,itemType:de,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:q,low:A,manifest:null,max:null,maxLength:A,media:null,method:null,min:null,minLength:A,multiple:q,muted:q,name:null,nonce:null,noModule:q,noValidate:q,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:q,optimum:A,pattern:null,ping:de,placeholder:null,playsInline:q,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:q,referrerPolicy:null,rel:de,required:q,reversed:q,rows:A,rowSpan:A,sandbox:de,scope:null,scoped:q,seamless:q,selected:q,shadowRootClonable:q,shadowRootCustomElementRegistry:q,shadowRootDelegatesFocus:q,shadowRootMode:null,shadowRootSerializable:q,shape:null,size:A,sizes:null,slot:null,span:A,spellCheck:Ee,src:null,srcDoc:null,srcLang:null,srcSet:null,start:A,step:null,style:null,tabIndex:A,target:null,title:null,translate:null,type:null,typeMustMatch:q,useMap:null,value:Ee,width:A,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:de,axis:null,background:null,bgColor:null,border:A,borderColor:null,bottomMargin:A,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:q,declare:q,event:null,face:null,frame:null,frameBorder:null,hSpace:A,leftMargin:A,link:null,longDesc:null,lowSrc:null,marginHeight:A,marginWidth:A,noResize:q,noHref:q,noShade:q,noWrap:q,object:null,profile:null,prompt:null,rev:null,rightMargin:A,rules:null,scheme:null,scrolling:Ee,standby:null,summary:null,text:null,topMargin:A,valueType:null,version:null,vAlign:null,vLink:null,vSpace:A,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:q,disablePictureInPicture:q,disableRemotePlayback:q,exportParts:Wn,part:de,prefix:null,property:null,results:A,security:null,unselectable:null},space:"html",transform:yg}),hb=Or({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:it,accentHeight:A,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:A,amplitude:A,arabicForm:null,ascent:A,attributeName:null,attributeType:null,azimuth:A,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:A,by:null,calcMode:null,capHeight:A,className:de,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:A,diffuseConstant:A,direction:null,display:null,dur:null,divisor:A,dominantBaseline:null,download:q,dx:null,dy:null,edgeMode:null,editable:null,elevation:A,enableBackground:null,end:null,event:null,exponent:A,externalResourcesRequired:null,fill:null,fillOpacity:A,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Wn,g2:Wn,glyphName:Wn,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:A,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:A,horizOriginX:A,horizOriginY:A,id:null,ideographic:A,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:A,k:A,k1:A,k2:A,k3:A,k4:A,kernelMatrix:it,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:A,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:A,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:A,overlineThickness:A,paintOrder:null,panose1:null,path:null,pathLength:A,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:de,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:A,pointsAtY:A,pointsAtZ:A,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:it,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:it,rev:it,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:it,requiredFeatures:it,requiredFonts:it,requiredFormats:it,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:A,specularExponent:A,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:A,strikethroughThickness:A,string:null,stroke:null,strokeDashArray:it,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:A,strokeOpacity:A,strokeWidth:null,style:null,surfaceScale:A,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:it,tabIndex:A,tableValues:null,target:null,targetX:A,targetY:A,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:it,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:A,underlineThickness:A,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:A,values:null,vAlphabetic:A,vMathematical:A,vectorEffect:null,vHanging:A,vIdeographic:A,version:null,vertAdvY:A,vertOriginX:A,vertOriginY:A,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:A,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:xg}),kg=Or({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),vg=Or({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:yg}),wg=Or({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),mb={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},gb=/[A-Z]/g,cf=/-[a-z]/g,xb=/^data[-\w.:]+$/i;function yb(e,t){const n=za(t);let r=t,i=tt;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&xb.test(t)){if(t.charAt(4)==="-"){const l=t.slice(5).replace(cf,vb);r="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=t.slice(4);if(!cf.test(l)){let o=l.replace(gb,kb);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}i=Qu}return new i(r,t)}function kb(e){return"-"+e.toLowerCase()}function vb(e){return e.charAt(1).toUpperCase()}const wb=mg([gg,pb,kg,vg,wg],"html"),Yu=mg([gg,hb,kg,vg,wg],"svg");function Sb(e){return e.join(" ").trim()}var Xu={},df=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,bb=/\n/g,Cb=/^\s*/,Eb=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,_b=/^:\s*/,Ib=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,Nb=/^[;\s]*/,Tb=/^\s+|\s+$/g,jb=`
|
|
227
227
|
`,ff="/",pf="*",Dn="",zb="comment",Pb="declaration";function Ab(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function i(x){var v=x.match(bb);v&&(n+=v.length);var _=x.lastIndexOf(jb);r=~_?x.length-_:r+x.length}function l(){var x={line:n,column:r};return function(v){return v.position=new o(x),u(),v}}function o(x){this.start=x,this.end={line:n,column:r},this.source=t.source}o.prototype.content=e;function s(x){var v=new Error(t.source+":"+n+":"+r+": "+x);if(v.reason=x,v.filename=t.source,v.line=n,v.column=r,v.source=e,!t.silent)throw v}function a(x){var v=x.exec(e);if(v){var _=v[0];return i(_),e=e.slice(_.length),v}}function u(){a(Cb)}function d(x){var v;for(x=x||[];v=c();)v!==!1&&x.push(v);return x}function c(){var x=l();if(!(ff!=e.charAt(0)||pf!=e.charAt(1))){for(var v=2;Dn!=e.charAt(v)&&(pf!=e.charAt(v)||ff!=e.charAt(v+1));)++v;if(v+=2,Dn===e.charAt(v-1))return s("End of comment missing");var _=e.slice(2,v-2);return r+=2,i(_),e=e.slice(v),r+=2,x({type:zb,comment:_})}}function f(){var x=l(),v=a(Eb);if(v){if(c(),!a(_b))return s("property missing ':'");var _=a(Ib),m=x({type:Pb,property:hf(v[0].replace(df,Dn)),value:_?hf(_[0].replace(df,Dn)):Dn});return a(Nb),m}}function p(){var x=[];d(x);for(var v;v=f();)v!==!1&&(x.push(v),d(x));return x}return u(),p()}function hf(e){return e?e.replace(Tb,Dn):Dn}var Lb=Ab,Mb=Ml&&Ml.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Xu,"__esModule",{value:!0});Xu.default=Ob;const Rb=Mb(Lb);function Ob(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,Rb.default)(e),i=typeof t=="function";return r.forEach(l=>{if(l.type!=="declaration")return;const{property:o,value:s}=l;i?t(o,s,l):s&&(n=n||{},n[o]=s)}),n}var zo={};Object.defineProperty(zo,"__esModule",{value:!0});zo.camelCase=void 0;var Db=/^--[a-zA-Z0-9_-]+$/,Fb=/-([a-z])/g,$b=/^[^-]+$/,Vb=/^-(webkit|moz|ms|o|khtml)-/,Bb=/^-(ms)-/,Ub=function(e){return!e||$b.test(e)||Db.test(e)},Hb=function(e,t){return t.toUpperCase()},mf=function(e,t){return"".concat(t,"-")},Wb=function(e,t){return t===void 0&&(t={}),Ub(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(Bb,mf):e=e.replace(Vb,mf),e.replace(Fb,Hb))};zo.camelCase=Wb;var qb=Ml&&Ml.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},Kb=qb(Xu),Gb=zo;function La(e,t){var n={};return!e||typeof e!="string"||(0,Kb.default)(e,function(r,i){r&&i&&(n[(0,Gb.camelCase)(r,t)]=i)}),n}La.default=La;var Qb=La;const Yb=ip(Qb),Sg=bg("end"),Ju=bg("start");function bg(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function Xb(e){const t=Ju(e),n=Sg(e);if(t&&n)return{start:t,end:n}}function hi(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?gf(e.position):"start"in e||"end"in e?gf(e):"line"in e||"column"in e?Ma(e):""}function Ma(e){return xf(e&&e.line)+":"+xf(e&&e.column)}function gf(e){return Ma(e&&e.start)+"-"+Ma(e&&e.end)}function xf(e){return e&&typeof e=="number"?e:1}class Ue extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",l={},o=!1;if(n&&("line"in n&&"column"in n?l={place:n}:"start"in n&&"end"in n?l={place:n}:"type"in n?l={ancestors:[n],place:n.position}:l={...n}),typeof t=="string"?i=t:!l.cause&&t&&(o=!0,i=t.message,l.cause=t),!l.ruleId&&!l.source&&typeof r=="string"){const a=r.indexOf(":");a===-1?l.ruleId=r:(l.source=r.slice(0,a),l.ruleId=r.slice(a+1))}if(!l.place&&l.ancestors&&l.ancestors){const a=l.ancestors[l.ancestors.length-1];a&&(l.place=a.position)}const s=l.place&&"start"in l.place?l.place.start:l.place;this.ancestors=l.ancestors||void 0,this.cause=l.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=s?s.line:void 0,this.name=hi(l.place)||"1:1",this.place=l.place||void 0,this.reason=this.message,this.ruleId=l.ruleId||void 0,this.source=l.source||void 0,this.stack=o&&l.cause&&typeof l.cause.stack=="string"?l.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Ue.prototype.file="";Ue.prototype.name="";Ue.prototype.reason="";Ue.prototype.message="";Ue.prototype.stack="";Ue.prototype.column=void 0;Ue.prototype.line=void 0;Ue.prototype.ancestors=void 0;Ue.prototype.cause=void 0;Ue.prototype.fatal=void 0;Ue.prototype.place=void 0;Ue.prototype.ruleId=void 0;Ue.prototype.source=void 0;const Zu={}.hasOwnProperty,Jb=new Map,Zb=/[A-Z]/g,eC=new Set(["table","tbody","thead","tfoot","tr"]),tC=new Set(["td","th"]),Cg="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function nC(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=cC(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=uC(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Yu:wb,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},l=Eg(i,e,void 0);return l&&typeof l!="string"?l:i.create(e,i.Fragment,{children:l||void 0},void 0)}function Eg(e,t,n){if(t.type==="element")return rC(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return iC(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return oC(e,t,n);if(t.type==="mdxjsEsm")return lC(e,t);if(t.type==="root")return sC(e,t,n);if(t.type==="text")return aC(e,t)}function rC(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=Yu,e.schema=i),e.ancestors.push(t);const l=Ig(e,t.tagName,!1),o=dC(e,t);let s=tc(e,t);return eC.has(t.tagName)&&(s=s.filter(function(a){return typeof a=="string"?!db(a):!0})),_g(e,o,l,t),ec(o,s),e.ancestors.pop(),e.schema=r,e.create(t,l,o,n)}function iC(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Oi(e,t.position)}function lC(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Oi(e,t.position)}function oC(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=Yu,e.schema=i),e.ancestors.push(t);const l=t.name===null?e.Fragment:Ig(e,t.name,!0),o=fC(e,t),s=tc(e,t);return _g(e,o,l,t),ec(o,s),e.ancestors.pop(),e.schema=r,e.create(t,l,o,n)}function sC(e,t,n){const r={};return ec(r,tc(e,t)),e.create(t,e.Fragment,r,n)}function aC(e,t){return t.value}function _g(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function ec(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function uC(e,t,n){return r;function r(i,l,o,s){const u=Array.isArray(o.children)?n:t;return s?u(l,o,s):u(l,o)}}function cC(e,t){return n;function n(r,i,l,o){const s=Array.isArray(l.children),a=Ju(r);return t(i,l,o,s,{columnNumber:a?a.column-1:void 0,fileName:e,lineNumber:a?a.line:void 0},void 0)}}function dC(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&Zu.call(t.properties,i)){const l=pC(e,i,t.properties[i]);if(l){const[o,s]=l;e.tableCellAlignToStyle&&o==="align"&&typeof s=="string"&&tC.has(t.tagName)?r=s:n[o]=s}}if(r){const l=n.style||(n.style={});l[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function fC(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const l=r.data.estree.body[0];l.type;const o=l.expression;o.type;const s=o.properties[0];s.type,Object.assign(n,e.evaluater.evaluateExpression(s.argument))}else Oi(e,t.position);else{const i=r.name;let l;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const s=r.value.data.estree.body[0];s.type,l=e.evaluater.evaluateExpression(s.expression)}else Oi(e,t.position);else l=r.value===null?!0:r.value;n[i]=l}return n}function tc(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:Jb;for(;++r<t.children.length;){const l=t.children[r];let o;if(e.passKeys){const a=l.type==="element"?l.tagName:l.type==="mdxJsxFlowElement"||l.type==="mdxJsxTextElement"?l.name:void 0;if(a){const u=i.get(a)||0;o=a+"-"+u,i.set(a,u+1)}}const s=Eg(e,l,o);s!==void 0&&n.push(s)}return n}function pC(e,t,n){const r=yb(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?ob(n):Sb(n)),r.property==="style"){let i=typeof n=="object"?n:hC(e,String(n));return e.stylePropertyNameCase==="css"&&(i=mC(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?mb[r.property]||r.property:r.attribute,n]}}function hC(e,t){try{return Yb(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new Ue("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=Cg+"#cannot-parse-style-attribute",i}}function Ig(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let l=-1,o;for(;++l<i.length;){const s=sf(i[l])?{type:"Identifier",name:i[l]}:{type:"Literal",value:i[l]};o=o?{type:"MemberExpression",object:o,property:s,computed:!!(l&&s.type==="Literal"),optional:!1}:s}r=o}else r=sf(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return Zu.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);Oi(e)}function Oi(e,t){const n=new Ue("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=Cg+"#cannot-handle-mdx-estrees-without-createevaluater",n}function mC(e){const t={};let n;for(n in e)Zu.call(e,n)&&(t[gC(n)]=e[n]);return t}function gC(e){let t=e.replace(Zb,xC);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function xC(e){return"-"+e.toLowerCase()}const ws={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},yC={};function nc(e,t){const n=yC,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Ng(e,r,i)}function Ng(e,t,n){if(kC(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return yf(e.children,t,n)}return Array.isArray(e)?yf(e,t,n):""}function yf(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=Ng(e[i],t,n);return r.join("")}function kC(e){return!!(e&&typeof e=="object")}const kf=document.createElement("i");function rc(e){const t="&"+e+";";kf.innerHTML=t;const n=kf.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function at(e,t,n,r){const i=e.length;let l=0,o;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);l<r.length;)o=r.slice(l,l+1e4),o.unshift(t,0),e.splice(...o),l+=1e4,t+=1e4}function mt(e,t){return e.length>0?(at(e,e.length,0,t),e):t}const vf={}.hasOwnProperty;function Tg(e){const t={};let n=-1;for(;++n<e.length;)vC(t,e[n]);return t}function vC(e,t){let n;for(n in t){const i=(vf.call(e,n)?e[n]:void 0)||(e[n]={}),l=t[n];let o;if(l)for(o in l){vf.call(i,o)||(i[o]=[]);const s=l[o];wC(i[o],Array.isArray(s)?s:s?[s]:[])}}}function wC(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);at(e,0,0,r)}function jg(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Tt(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const We=Tn(/[A-Za-z]/),Ve=Tn(/[\dA-Za-z]/),SC=Tn(/[#-'*+\--9=?A-Z^-~]/);function ao(e){return e!==null&&(e<32||e===127)}const Ra=Tn(/\d/),bC=Tn(/[\dA-Fa-f]/),CC=Tn(/[!-/:-@[-`{-~]/);function B(e){return e!==null&&e<-2}function pe(e){return e!==null&&(e<0||e===32)}function Z(e){return e===-2||e===-1||e===32}const Po=Tn(new RegExp("\\p{P}|\\p{S}","u")),Xn=Tn(/\s/);function Tn(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Dr(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const l=e.charCodeAt(n);let o="";if(l===37&&Ve(e.charCodeAt(n+1))&&Ve(e.charCodeAt(n+2)))i=2;else if(l<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(l))||(o=String.fromCharCode(l));else if(l>55295&&l<57344){const s=e.charCodeAt(n+1);l<56320&&s>56319&&s<57344?(o=String.fromCharCode(l,s),i=1):o="�"}else o=String.fromCharCode(l);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,o=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function ne(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let l=0;return o;function o(a){return Z(a)?(e.enter(n),s(a)):t(a)}function s(a){return Z(a)&&l++<i?(e.consume(a),s):(e.exit(n),t(a))}}const EC={tokenize:_C};function _C(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),ne(e,t,"linePrefix")}function i(s){return e.enter("paragraph"),l(s)}function l(s){const a=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=a),n=a,o(s)}function o(s){if(s===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(s);return}return B(s)?(e.consume(s),e.exit("chunkText"),l):(e.consume(s),o)}}const IC={tokenize:NC},wf={tokenize:TC};function NC(e){const t=this,n=[];let r=0,i,l,o;return s;function s(k){if(r<n.length){const C=n[r];return t.containerState=C[1],e.attempt(C[0].continuation,a,u)(k)}return u(k)}function a(k){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&g();const C=t.events.length;let N=C,b;for(;N--;)if(t.events[N][0]==="exit"&&t.events[N][1].type==="chunkFlow"){b=t.events[N][1].end;break}m(r);let I=C;for(;I<t.events.length;)t.events[I][1].end={...b},I++;return at(t.events,N+1,0,t.events.slice(C)),t.events.length=I,u(k)}return s(k)}function u(k){if(r===n.length){if(!i)return f(k);if(i.currentConstruct&&i.currentConstruct.concrete)return x(k);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(wf,d,c)(k)}function d(k){return i&&g(),m(r),f(k)}function c(k){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,x(k)}function f(k){return t.containerState={},e.attempt(wf,p,x)(k)}function p(k){return r++,n.push([t.currentConstruct,t.containerState]),f(k)}function x(k){if(k===null){i&&g(),m(0),e.consume(k);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:l}),v(k)}function v(k){if(k===null){_(e.exit("chunkFlow"),!0),m(0),e.consume(k);return}return B(k)?(e.consume(k),_(e.exit("chunkFlow")),r=0,t.interrupt=void 0,s):(e.consume(k),v)}function _(k,C){const N=t.sliceStream(k);if(C&&N.push(null),k.previous=l,l&&(l.next=k),l=k,i.defineSkip(k.start),i.write(N),t.parser.lazy[k.start.line]){let b=i.events.length;for(;b--;)if(i.events[b][1].start.offset<o&&(!i.events[b][1].end||i.events[b][1].end.offset>o))return;const I=t.events.length;let E=I,j,S;for(;E--;)if(t.events[E][0]==="exit"&&t.events[E][1].type==="chunkFlow"){if(j){S=t.events[E][1].end;break}j=!0}for(m(r),b=I;b<t.events.length;)t.events[b][1].end={...S},b++;at(t.events,E+1,0,t.events.slice(I)),t.events.length=b}}function m(k){let C=n.length;for(;C-- >k;){const N=n[C];t.containerState=N[1],N[0].exit.call(t,e)}n.length=k}function g(){i.write([null]),l=void 0,i=void 0,t.containerState._closeFlow=void 0}}function TC(e,t,n){return ne(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Pr(e){if(e===null||pe(e)||Xn(e))return 1;if(Po(e))return 2}function Ao(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const l=e[i].resolveAll;l&&!r.includes(l)&&(t=l(t,n),r.push(l))}return t}const Oa={name:"attention",resolveAll:jC,tokenize:zC};function jC(e,t){let n=-1,r,i,l,o,s,a,u,d;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;a=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const c={...e[r][1].end},f={...e[n][1].start};Sf(c,-a),Sf(f,a),o={type:a>1?"strongSequence":"emphasisSequence",start:c,end:{...e[r][1].end}},s={type:a>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:f},l={type:a>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:a>1?"strong":"emphasis",start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=mt(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=mt(u,[["enter",i,t],["enter",o,t],["exit",o,t],["enter",l,t]]),u=mt(u,Ao(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=mt(u,[["exit",l,t],["enter",s,t],["exit",s,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=mt(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,at(e,r-1,n-r+3,u),n=r+u.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function zC(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Pr(r);let l;return o;function o(a){return l=a,e.enter("attentionSequence"),s(a)}function s(a){if(a===l)return e.consume(a),s;const u=e.exit("attentionSequence"),d=Pr(a),c=!d||d===2&&i||n.includes(a),f=!i||i===2&&d||n.includes(r);return u._open=!!(l===42?c:c&&(i||!f)),u._close=!!(l===42?f:f&&(d||!c)),t(a)}}function Sf(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const PC={name:"autolink",tokenize:AC};function AC(e,t,n){let r=0;return i;function i(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),l}function l(p){return We(p)?(e.consume(p),o):p===64?n(p):u(p)}function o(p){return p===43||p===45||p===46||Ve(p)?(r=1,s(p)):u(p)}function s(p){return p===58?(e.consume(p),r=0,a):(p===43||p===45||p===46||Ve(p))&&r++<32?(e.consume(p),s):(r=0,u(p))}function a(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||ao(p)?n(p):(e.consume(p),a)}function u(p){return p===64?(e.consume(p),d):SC(p)?(e.consume(p),u):n(p)}function d(p){return Ve(p)?c(p):n(p)}function c(p){return p===46?(e.consume(p),r=0,d):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):f(p)}function f(p){if((p===45||Ve(p))&&r++<63){const x=p===45?f:c;return e.consume(p),x}return n(p)}}const Wi={partial:!0,tokenize:LC};function LC(e,t,n){return r;function r(l){return Z(l)?ne(e,i,"linePrefix")(l):i(l)}function i(l){return l===null||B(l)?t(l):n(l)}}const zg={continuation:{tokenize:RC},exit:OC,name:"blockQuote",tokenize:MC};function MC(e,t,n){const r=this;return i;function i(o){if(o===62){const s=r.containerState;return s.open||(e.enter("blockQuote",{_container:!0}),s.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),l}return n(o)}function l(o){return Z(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function RC(e,t,n){const r=this;return i;function i(o){return Z(o)?ne(e,l,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):l(o)}function l(o){return e.attempt(zg,t,n)(o)}}function OC(e){e.exit("blockQuote")}const Pg={name:"characterEscape",tokenize:DC};function DC(e,t,n){return r;function r(l){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(l),e.exit("escapeMarker"),i}function i(l){return CC(l)?(e.enter("characterEscapeValue"),e.consume(l),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(l)}}const Ag={name:"characterReference",tokenize:FC};function FC(e,t,n){const r=this;let i=0,l,o;return s;function s(c){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(c),e.exit("characterReferenceMarker"),a}function a(c){return c===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(c),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),l=31,o=Ve,d(c))}function u(c){return c===88||c===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(c),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),l=6,o=bC,d):(e.enter("characterReferenceValue"),l=7,o=Ra,d(c))}function d(c){if(c===59&&i){const f=e.exit("characterReferenceValue");return o===Ve&&!rc(r.sliceSerialize(f))?n(c):(e.enter("characterReferenceMarker"),e.consume(c),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(c)&&i++<l?(e.consume(c),d):n(c)}}const bf={partial:!0,tokenize:VC},Cf={concrete:!0,name:"codeFenced",tokenize:$C};function $C(e,t,n){const r=this,i={partial:!0,tokenize:N};let l=0,o=0,s;return a;function a(b){return u(b)}function u(b){const I=r.events[r.events.length-1];return l=I&&I[1].type==="linePrefix"?I[2].sliceSerialize(I[1],!0).length:0,s=b,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(b)}function d(b){return b===s?(o++,e.consume(b),d):o<3?n(b):(e.exit("codeFencedFenceSequence"),Z(b)?ne(e,c,"whitespace")(b):c(b))}function c(b){return b===null||B(b)?(e.exit("codeFencedFence"),r.interrupt?t(b):e.check(bf,v,C)(b)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(b))}function f(b){return b===null||B(b)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),c(b)):Z(b)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),ne(e,p,"whitespace")(b)):b===96&&b===s?n(b):(e.consume(b),f)}function p(b){return b===null||B(b)?c(b):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),x(b))}function x(b){return b===null||B(b)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),c(b)):b===96&&b===s?n(b):(e.consume(b),x)}function v(b){return e.attempt(i,C,_)(b)}function _(b){return e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),m}function m(b){return l>0&&Z(b)?ne(e,g,"linePrefix",l+1)(b):g(b)}function g(b){return b===null||B(b)?e.check(bf,v,C)(b):(e.enter("codeFlowValue"),k(b))}function k(b){return b===null||B(b)?(e.exit("codeFlowValue"),g(b)):(e.consume(b),k)}function C(b){return e.exit("codeFenced"),t(b)}function N(b,I,E){let j=0;return S;function S(W){return b.enter("lineEnding"),b.consume(W),b.exit("lineEnding"),z}function z(W){return b.enter("codeFencedFence"),Z(W)?ne(b,O,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(W):O(W)}function O(W){return W===s?(b.enter("codeFencedFenceSequence"),U(W)):E(W)}function U(W){return W===s?(j++,b.consume(W),U):j>=o?(b.exit("codeFencedFenceSequence"),Z(W)?ne(b,Q,"whitespace")(W):Q(W)):E(W)}function Q(W){return W===null||B(W)?(b.exit("codeFencedFence"),I(W)):E(W)}}}function VC(e,t,n){const r=this;return i;function i(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),l)}function l(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}const Ss={name:"codeIndented",tokenize:UC},BC={partial:!0,tokenize:HC};function UC(e,t,n){const r=this;return i;function i(u){return e.enter("codeIndented"),ne(e,l,"linePrefix",5)(u)}function l(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?o(u):n(u)}function o(u){return u===null?a(u):B(u)?e.attempt(BC,o,a)(u):(e.enter("codeFlowValue"),s(u))}function s(u){return u===null||B(u)?(e.exit("codeFlowValue"),o(u)):(e.consume(u),s)}function a(u){return e.exit("codeIndented"),t(u)}}function HC(e,t,n){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):B(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):ne(e,l,"linePrefix",5)(o)}function l(o){const s=r.events[r.events.length-1];return s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?t(o):B(o)?i(o):n(o)}}const WC={name:"codeText",previous:KC,resolve:qC,tokenize:GC};function qC(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function KC(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function GC(e,t,n){let r=0,i,l;return o;function o(c){return e.enter("codeText"),e.enter("codeTextSequence"),s(c)}function s(c){return c===96?(e.consume(c),r++,s):(e.exit("codeTextSequence"),a(c))}function a(c){return c===null?n(c):c===32?(e.enter("space"),e.consume(c),e.exit("space"),a):c===96?(l=e.enter("codeTextSequence"),i=0,d(c)):B(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),a):(e.enter("codeTextData"),u(c))}function u(c){return c===null||c===32||c===96||B(c)?(e.exit("codeTextData"),a(c)):(e.consume(c),u)}function d(c){return c===96?(e.consume(c),i++,d):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(c)):(l.type="codeTextData",u(c))}}class QC{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const l=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Jr(this.left,r),l.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Jr(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Jr(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Jr(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Jr(this.left,n.reverse())}}}function Jr(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function Lg(e){const t={};let n=-1,r,i,l,o,s,a,u;const d=new QC(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(a=r[1]._tokenizer.events,l=0,l<a.length&&a[l][1].type==="lineEndingBlank"&&(l+=2),l<a.length&&a[l][1].type==="content"))for(;++l<a.length&&a[l][1].type!=="content";)a[l][1].type==="chunkText"&&(a[l][1]._isInFirstContentOfListItem=!0,l++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,YC(d,n)),n=t[n],u=!0);else if(r[1]._container){for(l=n,i=void 0;l--;)if(o=d.get(l),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(i&&(d.get(i)[1].type="lineEndingBlank"),o[1].type="lineEnding",i=l);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;i&&(r[1].end={...d.get(i)[1].start},s=d.slice(i,n),s.unshift(r),d.splice(i,n-i+1,s))}}return at(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function YC(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const l=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const s=o.events,a=[],u={};let d,c,f=-1,p=n,x=0,v=0;const _=[v];for(;p;){for(;e.get(++i)[1]!==p;);l.push(i),p._tokenizer||(d=r.sliceStream(p),p.next||d.push(null),c&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(d),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),c=p,p=p.next}for(p=n;++f<s.length;)s[f][0]==="exit"&&s[f-1][0]==="enter"&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(v=f+1,_.push(v),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):_.pop(),f=_.length;f--;){const m=s.slice(_[f],_[f+1]),g=l.pop();a.push([g,g+m.length-1]),e.splice(g,2,m)}for(a.reverse(),f=-1;++f<a.length;)u[x+a[f][0]]=x+a[f][1],x+=a[f][1]-a[f][0]-1;return u}const XC={resolve:ZC,tokenize:eE},JC={partial:!0,tokenize:tE};function ZC(e){return Lg(e),e}function eE(e,t){let n;return r;function r(s){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(s)}function i(s){return s===null?l(s):B(s)?e.check(JC,o,l)(s):(e.consume(s),i)}function l(s){return e.exit("chunkContent"),e.exit("content"),t(s)}function o(s){return e.consume(s),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function tE(e,t,n){const r=this;return i;function i(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),ne(e,l,"linePrefix")}function l(o){if(o===null||B(o))return n(o);const s=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}function Mg(e,t,n,r,i,l,o,s,a){const u=a||Number.POSITIVE_INFINITY;let d=0;return c;function c(m){return m===60?(e.enter(r),e.enter(i),e.enter(l),e.consume(m),e.exit(l),f):m===null||m===32||m===41||ao(m)?n(m):(e.enter(r),e.enter(o),e.enter(s),e.enter("chunkString",{contentType:"string"}),v(m))}function f(m){return m===62?(e.enter(l),e.consume(m),e.exit(l),e.exit(i),e.exit(r),t):(e.enter(s),e.enter("chunkString",{contentType:"string"}),p(m))}function p(m){return m===62?(e.exit("chunkString"),e.exit(s),f(m)):m===null||m===60||B(m)?n(m):(e.consume(m),m===92?x:p)}function x(m){return m===60||m===62||m===92?(e.consume(m),p):p(m)}function v(m){return!d&&(m===null||m===41||pe(m))?(e.exit("chunkString"),e.exit(s),e.exit(o),e.exit(r),t(m)):d<u&&m===40?(e.consume(m),d++,v):m===41?(e.consume(m),d--,v):m===null||m===32||m===40||ao(m)?n(m):(e.consume(m),m===92?_:v)}function _(m){return m===40||m===41||m===92?(e.consume(m),v):v(m)}}function Rg(e,t,n,r,i,l){const o=this;let s=0,a;return u;function u(p){return e.enter(r),e.enter(i),e.consume(p),e.exit(i),e.enter(l),d}function d(p){return s>999||p===null||p===91||p===93&&!a||p===94&&!s&&"_hiddenFootnoteSupport"in o.parser.constructs?n(p):p===93?(e.exit(l),e.enter(i),e.consume(p),e.exit(i),e.exit(r),t):B(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),c(p))}function c(p){return p===null||p===91||p===93||B(p)||s++>999?(e.exit("chunkString"),d(p)):(e.consume(p),a||(a=!Z(p)),p===92?f:c)}function f(p){return p===91||p===92||p===93?(e.consume(p),s++,c):c(p)}}function Og(e,t,n,r,i,l){let o;return s;function s(f){return f===34||f===39||f===40?(e.enter(r),e.enter(i),e.consume(f),e.exit(i),o=f===40?41:f,a):n(f)}function a(f){return f===o?(e.enter(i),e.consume(f),e.exit(i),e.exit(r),t):(e.enter(l),u(f))}function u(f){return f===o?(e.exit(l),a(o)):f===null?n(f):B(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),ne(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(f))}function d(f){return f===o||f===null||B(f)?(e.exit("chunkString"),u(f)):(e.consume(f),f===92?c:d)}function c(f){return f===o||f===92?(e.consume(f),d):d(f)}}function mi(e,t){let n;return r;function r(i){return B(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):Z(i)?ne(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const nE={name:"definition",tokenize:iE},rE={partial:!0,tokenize:lE};function iE(e,t,n){const r=this;let i;return l;function l(p){return e.enter("definition"),o(p)}function o(p){return Rg.call(r,e,s,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function s(p){return i=Tt(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),a):n(p)}function a(p){return pe(p)?mi(e,u)(p):u(p)}function u(p){return Mg(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(rE,c,c)(p)}function c(p){return Z(p)?ne(e,f,"whitespace")(p):f(p)}function f(p){return p===null||B(p)?(e.exit("definition"),r.parser.defined.push(i),t(p)):n(p)}}function lE(e,t,n){return r;function r(s){return pe(s)?mi(e,i)(s):n(s)}function i(s){return Og(e,l,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(s)}function l(s){return Z(s)?ne(e,o,"whitespace")(s):o(s)}function o(s){return s===null||B(s)?t(s):n(s)}}const oE={name:"hardBreakEscape",tokenize:sE};function sE(e,t,n){return r;function r(l){return e.enter("hardBreakEscape"),e.consume(l),i}function i(l){return B(l)?(e.exit("hardBreakEscape"),t(l)):n(l)}}const aE={name:"headingAtx",resolve:uE,tokenize:cE};function uE(e,t){let n=e.length-2,r=3,i,l;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},l={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},at(e,r,n-r+1,[["enter",i,t],["enter",l,t],["exit",l,t],["exit",i,t]])),e}function cE(e,t,n){let r=0;return i;function i(d){return e.enter("atxHeading"),l(d)}function l(d){return e.enter("atxHeadingSequence"),o(d)}function o(d){return d===35&&r++<6?(e.consume(d),o):d===null||pe(d)?(e.exit("atxHeadingSequence"),s(d)):n(d)}function s(d){return d===35?(e.enter("atxHeadingSequence"),a(d)):d===null||B(d)?(e.exit("atxHeading"),t(d)):Z(d)?ne(e,s,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function a(d){return d===35?(e.consume(d),a):(e.exit("atxHeadingSequence"),s(d))}function u(d){return d===null||d===35||pe(d)?(e.exit("atxHeadingText"),s(d)):(e.consume(d),u)}}const dE=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Ef=["pre","script","style","textarea"],fE={concrete:!0,name:"htmlFlow",resolveTo:mE,tokenize:gE},pE={partial:!0,tokenize:yE},hE={partial:!0,tokenize:xE};function mE(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function gE(e,t,n){const r=this;let i,l,o,s,a;return u;function u(w){return d(w)}function d(w){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(w),c}function c(w){return w===33?(e.consume(w),f):w===47?(e.consume(w),l=!0,v):w===63?(e.consume(w),i=3,r.interrupt?t:y):We(w)?(e.consume(w),o=String.fromCharCode(w),_):n(w)}function f(w){return w===45?(e.consume(w),i=2,p):w===91?(e.consume(w),i=5,s=0,x):We(w)?(e.consume(w),i=4,r.interrupt?t:y):n(w)}function p(w){return w===45?(e.consume(w),r.interrupt?t:y):n(w)}function x(w){const he="CDATA[";return w===he.charCodeAt(s++)?(e.consume(w),s===he.length?r.interrupt?t:O:x):n(w)}function v(w){return We(w)?(e.consume(w),o=String.fromCharCode(w),_):n(w)}function _(w){if(w===null||w===47||w===62||pe(w)){const he=w===47,oe=o.toLowerCase();return!he&&!l&&Ef.includes(oe)?(i=1,r.interrupt?t(w):O(w)):dE.includes(o.toLowerCase())?(i=6,he?(e.consume(w),m):r.interrupt?t(w):O(w)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(w):l?g(w):k(w))}return w===45||Ve(w)?(e.consume(w),o+=String.fromCharCode(w),_):n(w)}function m(w){return w===62?(e.consume(w),r.interrupt?t:O):n(w)}function g(w){return Z(w)?(e.consume(w),g):S(w)}function k(w){return w===47?(e.consume(w),S):w===58||w===95||We(w)?(e.consume(w),C):Z(w)?(e.consume(w),k):S(w)}function C(w){return w===45||w===46||w===58||w===95||Ve(w)?(e.consume(w),C):N(w)}function N(w){return w===61?(e.consume(w),b):Z(w)?(e.consume(w),N):k(w)}function b(w){return w===null||w===60||w===61||w===62||w===96?n(w):w===34||w===39?(e.consume(w),a=w,I):Z(w)?(e.consume(w),b):E(w)}function I(w){return w===a?(e.consume(w),a=null,j):w===null||B(w)?n(w):(e.consume(w),I)}function E(w){return w===null||w===34||w===39||w===47||w===60||w===61||w===62||w===96||pe(w)?N(w):(e.consume(w),E)}function j(w){return w===47||w===62||Z(w)?k(w):n(w)}function S(w){return w===62?(e.consume(w),z):n(w)}function z(w){return w===null||B(w)?O(w):Z(w)?(e.consume(w),z):n(w)}function O(w){return w===45&&i===2?(e.consume(w),X):w===60&&i===1?(e.consume(w),re):w===62&&i===4?(e.consume(w),J):w===63&&i===3?(e.consume(w),y):w===93&&i===5?(e.consume(w),V):B(w)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(pE,ie,U)(w)):w===null||B(w)?(e.exit("htmlFlowData"),U(w)):(e.consume(w),O)}function U(w){return e.check(hE,Q,ie)(w)}function Q(w){return e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),W}function W(w){return w===null||B(w)?U(w):(e.enter("htmlFlowData"),O(w))}function X(w){return w===45?(e.consume(w),y):O(w)}function re(w){return w===47?(e.consume(w),o="",M):O(w)}function M(w){if(w===62){const he=o.toLowerCase();return Ef.includes(he)?(e.consume(w),J):O(w)}return We(w)&&o.length<8?(e.consume(w),o+=String.fromCharCode(w),M):O(w)}function V(w){return w===93?(e.consume(w),y):O(w)}function y(w){return w===62?(e.consume(w),J):w===45&&i===2?(e.consume(w),y):O(w)}function J(w){return w===null||B(w)?(e.exit("htmlFlowData"),ie(w)):(e.consume(w),J)}function ie(w){return e.exit("htmlFlow"),t(w)}}function xE(e,t,n){const r=this;return i;function i(o){return B(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),l):n(o)}function l(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function yE(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Wi,t,n)}}const kE={name:"htmlText",tokenize:vE};function vE(e,t,n){const r=this;let i,l,o;return s;function s(y){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(y),a}function a(y){return y===33?(e.consume(y),u):y===47?(e.consume(y),N):y===63?(e.consume(y),k):We(y)?(e.consume(y),E):n(y)}function u(y){return y===45?(e.consume(y),d):y===91?(e.consume(y),l=0,x):We(y)?(e.consume(y),g):n(y)}function d(y){return y===45?(e.consume(y),p):n(y)}function c(y){return y===null?n(y):y===45?(e.consume(y),f):B(y)?(o=c,re(y)):(e.consume(y),c)}function f(y){return y===45?(e.consume(y),p):c(y)}function p(y){return y===62?X(y):y===45?f(y):c(y)}function x(y){const J="CDATA[";return y===J.charCodeAt(l++)?(e.consume(y),l===J.length?v:x):n(y)}function v(y){return y===null?n(y):y===93?(e.consume(y),_):B(y)?(o=v,re(y)):(e.consume(y),v)}function _(y){return y===93?(e.consume(y),m):v(y)}function m(y){return y===62?X(y):y===93?(e.consume(y),m):v(y)}function g(y){return y===null||y===62?X(y):B(y)?(o=g,re(y)):(e.consume(y),g)}function k(y){return y===null?n(y):y===63?(e.consume(y),C):B(y)?(o=k,re(y)):(e.consume(y),k)}function C(y){return y===62?X(y):k(y)}function N(y){return We(y)?(e.consume(y),b):n(y)}function b(y){return y===45||Ve(y)?(e.consume(y),b):I(y)}function I(y){return B(y)?(o=I,re(y)):Z(y)?(e.consume(y),I):X(y)}function E(y){return y===45||Ve(y)?(e.consume(y),E):y===47||y===62||pe(y)?j(y):n(y)}function j(y){return y===47?(e.consume(y),X):y===58||y===95||We(y)?(e.consume(y),S):B(y)?(o=j,re(y)):Z(y)?(e.consume(y),j):X(y)}function S(y){return y===45||y===46||y===58||y===95||Ve(y)?(e.consume(y),S):z(y)}function z(y){return y===61?(e.consume(y),O):B(y)?(o=z,re(y)):Z(y)?(e.consume(y),z):j(y)}function O(y){return y===null||y===60||y===61||y===62||y===96?n(y):y===34||y===39?(e.consume(y),i=y,U):B(y)?(o=O,re(y)):Z(y)?(e.consume(y),O):(e.consume(y),Q)}function U(y){return y===i?(e.consume(y),i=void 0,W):y===null?n(y):B(y)?(o=U,re(y)):(e.consume(y),U)}function Q(y){return y===null||y===34||y===39||y===60||y===61||y===96?n(y):y===47||y===62||pe(y)?j(y):(e.consume(y),Q)}function W(y){return y===47||y===62||pe(y)?j(y):n(y)}function X(y){return y===62?(e.consume(y),e.exit("htmlTextData"),e.exit("htmlText"),t):n(y)}function re(y){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),M}function M(y){return Z(y)?ne(e,V,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(y):V(y)}function V(y){return e.enter("htmlTextData"),o(y)}}const ic={name:"labelEnd",resolveAll:CE,resolveTo:EE,tokenize:_E},wE={tokenize:IE},SE={tokenize:NE},bE={tokenize:TE};function CE(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&at(e,0,e.length,n),e}function EE(e,t){let n=e.length,r=0,i,l,o,s;for(;n--;)if(i=e[n][1],l){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(l=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(o=n);const a={type:e[l][1].type==="labelLink"?"link":"image",start:{...e[l][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[l][1].start},end:{...e[o][1].end}},d={type:"labelText",start:{...e[l+r+2][1].end},end:{...e[o-2][1].start}};return s=[["enter",a,t],["enter",u,t]],s=mt(s,e.slice(l+1,l+r+3)),s=mt(s,[["enter",d,t]]),s=mt(s,Ao(t.parser.constructs.insideSpan.null,e.slice(l+r+4,o-3),t)),s=mt(s,[["exit",d,t],e[o-2],e[o-1],["exit",u,t]]),s=mt(s,e.slice(o+1)),s=mt(s,[["exit",a,t]]),at(e,l,e.length,s),e}function _E(e,t,n){const r=this;let i=r.events.length,l,o;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){l=r.events[i][1];break}return s;function s(f){return l?l._inactive?c(f):(o=r.parser.defined.includes(Tt(r.sliceSerialize({start:l.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelEnd"),a):n(f)}function a(f){return f===40?e.attempt(wE,d,o?d:c)(f):f===91?e.attempt(SE,d,o?u:c)(f):o?d(f):c(f)}function u(f){return e.attempt(bE,d,c)(f)}function d(f){return t(f)}function c(f){return l._balanced=!0,n(f)}}function IE(e,t,n){return r;function r(c){return e.enter("resource"),e.enter("resourceMarker"),e.consume(c),e.exit("resourceMarker"),i}function i(c){return pe(c)?mi(e,l)(c):l(c)}function l(c){return c===41?d(c):Mg(e,o,s,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(c)}function o(c){return pe(c)?mi(e,a)(c):d(c)}function s(c){return n(c)}function a(c){return c===34||c===39||c===40?Og(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(c):d(c)}function u(c){return pe(c)?mi(e,d)(c):d(c)}function d(c){return c===41?(e.enter("resourceMarker"),e.consume(c),e.exit("resourceMarker"),e.exit("resource"),t):n(c)}}function NE(e,t,n){const r=this;return i;function i(s){return Rg.call(r,e,l,o,"reference","referenceMarker","referenceString")(s)}function l(s){return r.parser.defined.includes(Tt(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(s):n(s)}function o(s){return n(s)}}function TE(e,t,n){return r;function r(l){return e.enter("reference"),e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),i}function i(l){return l===93?(e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),e.exit("reference"),t):n(l)}}const jE={name:"labelStartImage",resolveAll:ic.resolveAll,tokenize:zE};function zE(e,t,n){const r=this;return i;function i(s){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(s),e.exit("labelImageMarker"),l}function l(s){return s===91?(e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelImage"),o):n(s)}function o(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):t(s)}}const PE={name:"labelStartLink",resolveAll:ic.resolveAll,tokenize:AE};function AE(e,t,n){const r=this;return i;function i(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),l}function l(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const bs={name:"lineEnding",tokenize:LE};function LE(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),ne(e,t,"linePrefix")}}const Al={name:"thematicBreak",tokenize:ME};function ME(e,t,n){let r=0,i;return l;function l(u){return e.enter("thematicBreak"),o(u)}function o(u){return i=u,s(u)}function s(u){return u===i?(e.enter("thematicBreakSequence"),a(u)):r>=3&&(u===null||B(u))?(e.exit("thematicBreak"),t(u)):n(u)}function a(u){return u===i?(e.consume(u),r++,a):(e.exit("thematicBreakSequence"),Z(u)?ne(e,s,"whitespace")(u):s(u))}}const Qe={continuation:{tokenize:FE},exit:VE,name:"list",tokenize:DE},RE={partial:!0,tokenize:BE},OE={partial:!0,tokenize:$E};function DE(e,t,n){const r=this,i=r.events[r.events.length-1];let l=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(p){const x=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(x==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:Ra(p)){if(r.containerState.type||(r.containerState.type=x,e.enter(x,{_container:!0})),x==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(Al,n,u)(p):u(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),a(p)}return n(p)}function a(p){return Ra(p)&&++o<10?(e.consume(p),a):(!r.interrupt||o<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):n(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(Wi,r.interrupt?n:d,e.attempt(RE,f,c))}function d(p){return r.containerState.initialBlankLine=!0,l++,f(p)}function c(p){return Z(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),f):n(p)}function f(p){return r.containerState.size=l+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function FE(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Wi,i,l);function i(s){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,ne(e,t,"listItemIndent",r.containerState.size+1)(s)}function l(s){return r.containerState.furtherBlankLines||!Z(s)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(s)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(OE,t,o)(s))}function o(s){return r.containerState._closeFlow=!0,r.interrupt=void 0,ne(e,e.attempt(Qe,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s)}}function $E(e,t,n){const r=this;return ne(e,i,"listItemIndent",r.containerState.size+1);function i(l){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(l):n(l)}}function VE(e){e.exit(this.containerState.type)}function BE(e,t,n){const r=this;return ne(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(l){const o=r.events[r.events.length-1];return!Z(l)&&o&&o[1].type==="listItemPrefixWhitespace"?t(l):n(l)}}const _f={name:"setextUnderline",resolveTo:UE,tokenize:HE};function UE(e,t){let n=e.length,r,i,l;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!l&&e[n][1].type==="definition"&&(l=n);const o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",l?(e.splice(i,0,["enter",o,t]),e.splice(l+1,0,["exit",e[r][1],t]),e[r][1].end={...e[l][1].end}):e[r][1]=o,e.push(["exit",o,t]),e}function HE(e,t,n){const r=this;let i;return l;function l(u){let d=r.events.length,c;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){c=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||c)?(e.enter("setextHeadingLine"),i=u,o(u)):n(u)}function o(u){return e.enter("setextHeadingLineSequence"),s(u)}function s(u){return u===i?(e.consume(u),s):(e.exit("setextHeadingLineSequence"),Z(u)?ne(e,a,"lineSuffix")(u):a(u))}function a(u){return u===null||B(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const WE={tokenize:qE};function qE(e){const t=this,n=e.attempt(Wi,r,e.attempt(this.parser.constructs.flowInitial,i,ne(e,e.attempt(this.parser.constructs.flow,i,e.attempt(XC,i)),"linePrefix")));return n;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEndingBlank"),e.consume(l),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const KE={resolveAll:Fg()},GE=Dg("string"),QE=Dg("text");function Dg(e){return{resolveAll:Fg(e==="text"?YE:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],l=n.attempt(i,o,s);return o;function o(d){return u(d)?l(d):s(d)}function s(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),a}function a(d){return u(d)?(n.exit("data"),l(d)):(n.consume(d),a)}function u(d){if(d===null)return!0;const c=i[d];let f=-1;if(c)for(;++f<c.length;){const p=c[f];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function Fg(e){return t;function t(n,r){let i=-1,l;for(;++i<=n.length;)l===void 0?n[i]&&n[i][1].type==="data"&&(l=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==l+2&&(n[l][1].end=n[i-1][1].end,n.splice(l+2,i-l-2),i=l+2),l=void 0);return e?e(n,r):n}}function YE(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],i=t.sliceStream(r);let l=i.length,o=-1,s=0,a;for(;l--;){const u=i[l];if(typeof u=="string"){for(o=u.length;u.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(u===-2)a=!0,s++;else if(u!==-1){l++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){const u={type:n===e.length||a||s<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:l?o:r.start._bufferIndex+o,_index:r.start._index+l,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...u.start},r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}const XE={42:Qe,43:Qe,45:Qe,48:Qe,49:Qe,50:Qe,51:Qe,52:Qe,53:Qe,54:Qe,55:Qe,56:Qe,57:Qe,62:zg},JE={91:nE},ZE={[-2]:Ss,[-1]:Ss,32:Ss},e2={35:aE,42:Al,45:[_f,Al],60:fE,61:_f,95:Al,96:Cf,126:Cf},t2={38:Ag,92:Pg},n2={[-5]:bs,[-4]:bs,[-3]:bs,33:jE,38:Ag,42:Oa,60:[PC,kE],91:PE,92:[oE,Pg],93:ic,95:Oa,96:WC},r2={null:[Oa,KE]},i2={null:[42,95]},l2={null:[]},o2=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:i2,contentInitial:JE,disable:l2,document:XE,flow:e2,flowInitial:ZE,insideSpan:r2,string:t2,text:n2},Symbol.toStringTag,{value:"Module"}));function s2(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},l=[];let o=[],s=[];const a={attempt:I(N),check:I(b),consume:g,enter:k,exit:C,interrupt:I(b,{interrupt:!0})},u={code:null,containerState:{},defineSkip:v,events:[],now:x,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:c};let d=t.tokenize.call(u,a);return t.resolveAll&&l.push(t),u;function c(z){return o=mt(o,z),_(),o[o.length-1]!==null?[]:(E(t,0),u.events=Ao(l,u.events,u),u.events)}function f(z,O){return u2(p(z),O)}function p(z){return a2(o,z)}function x(){const{_bufferIndex:z,_index:O,line:U,column:Q,offset:W}=r;return{_bufferIndex:z,_index:O,line:U,column:Q,offset:W}}function v(z){i[z.line]=z.column,S()}function _(){let z;for(;r._index<o.length;){const O=o[r._index];if(typeof O=="string")for(z=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===z&&r._bufferIndex<O.length;)m(O.charCodeAt(r._bufferIndex));else m(O)}}function m(z){d=d(z)}function g(z){B(z)?(r.line++,r.column=1,r.offset+=z===-3?2:1,S()):z!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=z}function k(z,O){const U=O||{};return U.type=z,U.start=x(),u.events.push(["enter",U,u]),s.push(U),U}function C(z){const O=s.pop();return O.end=x(),u.events.push(["exit",O,u]),O}function N(z,O){E(z,O.from)}function b(z,O){O.restore()}function I(z,O){return U;function U(Q,W,X){let re,M,V,y;return Array.isArray(Q)?ie(Q):"tokenize"in Q?ie([Q]):J(Q);function J(K){return Ae;function Ae(nt){const ue=nt!==null&&K[nt],vt=nt!==null&&K.null,wt=[...Array.isArray(ue)?ue:ue?[ue]:[],...Array.isArray(vt)?vt:vt?[vt]:[]];return ie(wt)(nt)}}function ie(K){return re=K,M=0,K.length===0?X:w(K[M])}function w(K){return Ae;function Ae(nt){return y=j(),V=K,K.partial||(u.currentConstruct=K),K.name&&u.parser.constructs.disable.null.includes(K.name)?oe():K.tokenize.call(O?Object.assign(Object.create(u),O):u,a,he,oe)(nt)}}function he(K){return z(V,y),W}function oe(K){return y.restore(),++M<re.length?w(re[M]):X}}}function E(z,O){z.resolveAll&&!l.includes(z)&&l.push(z),z.resolve&&at(u.events,O,u.events.length-O,z.resolve(u.events.slice(O),u)),z.resolveTo&&(u.events=z.resolveTo(u.events,u))}function j(){const z=x(),O=u.previous,U=u.currentConstruct,Q=u.events.length,W=Array.from(s);return{from:Q,restore:X};function X(){r=z,u.previous=O,u.currentConstruct=U,u.events.length=Q,s=W,S()}}function S(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function a2(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,l=t.end._bufferIndex;let o;if(n===i)o=[e[n].slice(r,l)];else{if(o=e.slice(n,i),r>-1){const s=o[0];typeof s=="string"?o[0]=s.slice(r):o.shift()}l>0&&o.push(e[i].slice(0,l))}return o}function u2(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const l=e[n];let o;if(typeof l=="string")o=l;else switch(l){case-5:{o="\r";break}case-4:{o=`
|
|
228
228
|
`;break}case-3:{o=`\r
|
|
229
229
|
`;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&i)continue;o=" ";break}default:o=String.fromCharCode(l)}i=l===-2,r.push(o)}return r.join("")}function c2(e){const r={constructs:Tg([o2,...(e||{}).extensions||[]]),content:i(EC),defined:[],document:i(IC),flow:i(WE),lazy:{},string:i(GE),text:i(QE)};return r;function i(l){return o;function o(s){return s2(r,l,s)}}}function d2(e){for(;!Lg(e););return e}const If=/[\0\t\n\r]/g;function f2(){let e=1,t="",n=!0,r;return i;function i(l,o,s){const a=[];let u,d,c,f,p;for(l=t+(typeof l=="string"?l.toString():new TextDecoder(o||void 0).decode(l)),c=0,t="",n&&(l.charCodeAt(0)===65279&&c++,n=void 0);c<l.length;){if(If.lastIndex=c,u=If.exec(l),f=u&&u.index!==void 0?u.index:l.length,p=l.charCodeAt(f),!u){t=l.slice(c);break}if(p===10&&c===f&&r)a.push(-3),r=void 0;else switch(r&&(a.push(-5),r=void 0),c<f&&(a.push(l.slice(c,f)),e+=f-c),p){case 0:{a.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,a.push(-2);e++<d;)a.push(-1);break}case 10:{a.push(-4),e=1;break}default:r=!0,e=1}c=f+1}return s&&(r&&a.push(-5),t&&a.push(t),a.push(null)),a}}const p2=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function h2(e){return e.replace(p2,m2)}function m2(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),l=i===120||i===88;return jg(n.slice(l?2:1),l?16:10)}return rc(n)||e}const $g={}.hasOwnProperty;function g2(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),x2(n)(d2(c2(n).document().write(f2()(e,t,!0))))}function x2(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:l(Se),autolinkProtocol:j,autolinkEmail:j,atxHeading:l(nr),blockQuote:l(vt),characterEscape:j,characterReference:j,codeFenced:l(wt),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:l(wt,o),codeText:l(ft,o),codeTextData:j,data:j,codeFlowValue:j,definition:l(jn),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:l(nn),hardBreakEscape:l(Ki),hardBreakTrailing:l(Ki),htmlFlow:l(Gi,o),htmlFlowData:j,htmlText:l(Gi,o),htmlTextData:j,image:l(H),label:o,link:l(Se),listItem:l(zt),listItemValue:f,listOrdered:l(Le,c),listUnordered:l(Le),paragraph:l(zn),reference:w,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:l(nr),strong:l(Qi),thematicBreak:l(Ex)},exit:{atxHeading:a(),atxHeadingSequence:N,autolink:a(),autolinkEmail:ue,autolinkProtocol:nt,blockQuote:a(),characterEscapeValue:S,characterReferenceMarkerHexadecimal:oe,characterReferenceMarkerNumeric:oe,characterReferenceValue:K,characterReference:Ae,codeFenced:a(_),codeFencedFence:v,codeFencedFenceInfo:p,codeFencedFenceMeta:x,codeFlowValue:S,codeIndented:a(m),codeText:a(W),codeTextData:S,data:S,definition:a(),definitionDestinationString:C,definitionLabelString:g,definitionTitleString:k,emphasis:a(),hardBreakEscape:a(O),hardBreakTrailing:a(O),htmlFlow:a(U),htmlFlowData:S,htmlText:a(Q),htmlTextData:S,image:a(re),label:V,labelText:M,lineEnding:z,link:a(X),listItem:a(),listOrdered:a(),listUnordered:a(),paragraph:a(),referenceString:he,resourceDestinationString:y,resourceTitleString:J,resource:ie,setextHeading:a(E),setextHeadingLineSequence:I,setextHeadingText:b,strong:a(),thematicBreak:a()}};Vg(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(T){let R={type:"root",children:[]};const G={stack:[R],tokenStack:[],config:t,enter:s,exit:u,buffer:o,resume:d,data:n},te=[];let ce=-1;for(;++ce<T.length;)if(T[ce][1].type==="listOrdered"||T[ce][1].type==="listUnordered")if(T[ce][0]==="enter")te.push(ce);else{const St=te.pop();ce=i(T,St,ce)}for(ce=-1;++ce<T.length;){const St=t[T[ce][0]];$g.call(St,T[ce][1].type)&&St[T[ce][1].type].call(Object.assign({sliceSerialize:T[ce][2].sliceSerialize},G),T[ce][1])}if(G.tokenStack.length>0){const St=G.tokenStack[G.tokenStack.length-1];(St[1]||Nf).call(G,void 0,St[0])}for(R.position={start:on(T.length>0?T[0][1].start:{line:1,column:1,offset:0}),end:on(T.length>0?T[T.length-2][1].end:{line:1,column:1,offset:0})},ce=-1;++ce<t.transforms.length;)R=t.transforms[ce](R)||R;return R}function i(T,R,G){let te=R-1,ce=-1,St=!1,Pn,Vt,Fr,$r;for(;++te<=G;){const rt=T[te];switch(rt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{rt[0]==="enter"?ce++:ce--,$r=void 0;break}case"lineEndingBlank":{rt[0]==="enter"&&(Pn&&!$r&&!ce&&!Fr&&(Fr=te),$r=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:$r=void 0}if(!ce&&rt[0]==="enter"&&rt[1].type==="listItemPrefix"||ce===-1&&rt[0]==="exit"&&(rt[1].type==="listUnordered"||rt[1].type==="listOrdered")){if(Pn){let rr=te;for(Vt=void 0;rr--;){const Bt=T[rr];if(Bt[1].type==="lineEnding"||Bt[1].type==="lineEndingBlank"){if(Bt[0]==="exit")continue;Vt&&(T[Vt][1].type="lineEndingBlank",St=!0),Bt[1].type="lineEnding",Vt=rr}else if(!(Bt[1].type==="linePrefix"||Bt[1].type==="blockQuotePrefix"||Bt[1].type==="blockQuotePrefixWhitespace"||Bt[1].type==="blockQuoteMarker"||Bt[1].type==="listItemIndent"))break}Fr&&(!Vt||Fr<Vt)&&(Pn._spread=!0),Pn.end=Object.assign({},Vt?T[Vt][1].start:rt[1].end),T.splice(Vt||te,0,["exit",Pn,rt[2]]),te++,G++}if(rt[1].type==="listItemPrefix"){const rr={type:"listItem",_spread:!1,start:Object.assign({},rt[1].start),end:void 0};Pn=rr,T.splice(te,0,["enter",rr,rt[2]]),te++,G++,Fr=void 0,$r=!0}}}return T[R][1]._spread=St,G}function l(T,R){return G;function G(te){s.call(this,T(te),te),R&&R.call(this,te)}}function o(){this.stack.push({type:"fragment",children:[]})}function s(T,R,G){this.stack[this.stack.length-1].children.push(T),this.stack.push(T),this.tokenStack.push([R,G||void 0]),T.position={start:on(R.start),end:void 0}}function a(T){return R;function R(G){T&&T.call(this,G),u.call(this,G)}}function u(T,R){const G=this.stack.pop(),te=this.tokenStack.pop();if(te)te[0].type!==T.type&&(R?R.call(this,T,te[0]):(te[1]||Nf).call(this,T,te[0]));else throw new Error("Cannot close `"+T.type+"` ("+hi({start:T.start,end:T.end})+"): it’s not open");G.position.end=on(T.end)}function d(){return nc(this.stack.pop())}function c(){this.data.expectingFirstListItemValue=!0}function f(T){if(this.data.expectingFirstListItemValue){const R=this.stack[this.stack.length-2];R.start=Number.parseInt(this.sliceSerialize(T),10),this.data.expectingFirstListItemValue=void 0}}function p(){const T=this.resume(),R=this.stack[this.stack.length-1];R.lang=T}function x(){const T=this.resume(),R=this.stack[this.stack.length-1];R.meta=T}function v(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function _(){const T=this.resume(),R=this.stack[this.stack.length-1];R.value=T.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function m(){const T=this.resume(),R=this.stack[this.stack.length-1];R.value=T.replace(/(\r?\n|\r)$/g,"")}function g(T){const R=this.resume(),G=this.stack[this.stack.length-1];G.label=R,G.identifier=Tt(this.sliceSerialize(T)).toLowerCase()}function k(){const T=this.resume(),R=this.stack[this.stack.length-1];R.title=T}function C(){const T=this.resume(),R=this.stack[this.stack.length-1];R.url=T}function N(T){const R=this.stack[this.stack.length-1];if(!R.depth){const G=this.sliceSerialize(T).length;R.depth=G}}function b(){this.data.setextHeadingSlurpLineEnding=!0}function I(T){const R=this.stack[this.stack.length-1];R.depth=this.sliceSerialize(T).codePointAt(0)===61?1:2}function E(){this.data.setextHeadingSlurpLineEnding=void 0}function j(T){const G=this.stack[this.stack.length-1].children;let te=G[G.length-1];(!te||te.type!=="text")&&(te=Cx(),te.position={start:on(T.start),end:void 0},G.push(te)),this.stack.push(te)}function S(T){const R=this.stack.pop();R.value+=this.sliceSerialize(T),R.position.end=on(T.end)}function z(T){const R=this.stack[this.stack.length-1];if(this.data.atHardBreak){const G=R.children[R.children.length-1];G.position.end=on(T.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(R.type)&&(j.call(this,T),S.call(this,T))}function O(){this.data.atHardBreak=!0}function U(){const T=this.resume(),R=this.stack[this.stack.length-1];R.value=T}function Q(){const T=this.resume(),R=this.stack[this.stack.length-1];R.value=T}function W(){const T=this.resume(),R=this.stack[this.stack.length-1];R.value=T}function X(){const T=this.stack[this.stack.length-1];if(this.data.inReference){const R=this.data.referenceType||"shortcut";T.type+="Reference",T.referenceType=R,delete T.url,delete T.title}else delete T.identifier,delete T.label;this.data.referenceType=void 0}function re(){const T=this.stack[this.stack.length-1];if(this.data.inReference){const R=this.data.referenceType||"shortcut";T.type+="Reference",T.referenceType=R,delete T.url,delete T.title}else delete T.identifier,delete T.label;this.data.referenceType=void 0}function M(T){const R=this.sliceSerialize(T),G=this.stack[this.stack.length-2];G.label=h2(R),G.identifier=Tt(R).toLowerCase()}function V(){const T=this.stack[this.stack.length-1],R=this.resume(),G=this.stack[this.stack.length-1];if(this.data.inReference=!0,G.type==="link"){const te=T.children;G.children=te}else G.alt=R}function y(){const T=this.resume(),R=this.stack[this.stack.length-1];R.url=T}function J(){const T=this.resume(),R=this.stack[this.stack.length-1];R.title=T}function ie(){this.data.inReference=void 0}function w(){this.data.referenceType="collapsed"}function he(T){const R=this.resume(),G=this.stack[this.stack.length-1];G.label=R,G.identifier=Tt(this.sliceSerialize(T)).toLowerCase(),this.data.referenceType="full"}function oe(T){this.data.characterReferenceType=T.type}function K(T){const R=this.sliceSerialize(T),G=this.data.characterReferenceType;let te;G?(te=jg(R,G==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):te=rc(R);const ce=this.stack[this.stack.length-1];ce.value+=te}function Ae(T){const R=this.stack.pop();R.position.end=on(T.end)}function nt(T){S.call(this,T);const R=this.stack[this.stack.length-1];R.url=this.sliceSerialize(T)}function ue(T){S.call(this,T);const R=this.stack[this.stack.length-1];R.url="mailto:"+this.sliceSerialize(T)}function vt(){return{type:"blockquote",children:[]}}function wt(){return{type:"code",lang:null,meta:null,value:""}}function ft(){return{type:"inlineCode",value:""}}function jn(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function nn(){return{type:"emphasis",children:[]}}function nr(){return{type:"heading",depth:0,children:[]}}function Ki(){return{type:"break"}}function Gi(){return{type:"html",value:""}}function H(){return{type:"image",title:null,url:"",alt:null}}function Se(){return{type:"link",title:null,url:"",children:[]}}function Le(T){return{type:"list",ordered:T.type==="listOrdered",start:null,spread:T._spread,children:[]}}function zt(T){return{type:"listItem",spread:T._spread,checked:null,children:[]}}function zn(){return{type:"paragraph",children:[]}}function Qi(){return{type:"strong",children:[]}}function Cx(){return{type:"text",value:""}}function Ex(){return{type:"thematicBreak"}}}function on(e){return{line:e.line,column:e.column,offset:e.offset}}function Vg(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Vg(e,r):y2(e,r)}}function y2(e,t){let n;for(n in t)if($g.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function Nf(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+hi({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+hi({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+hi({start:t.start,end:t.end})+") is still open")}function k2(e){const t=this;t.parser=n;function n(r){return g2(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function v2(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function w2(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
@@ -251,4 +251,4 @@ Error generating stack: `+l.message+`
|
|
|
251
251
|
`))+1))}const o="#".repeat(i),s=n.enter("headingAtx"),a=n.enter("phrasing");l.move(o+" ");let u=n.containerPhrasing(e,{before:"# ",after:`
|
|
252
252
|
`,...l.current()});return/^[\t ]/.test(u)&&(u=Di(u.charCodeAt(0))+u.slice(1)),u=u?o+" "+u:o,n.options.closeAtx&&(u+=" "+o),a(),s(),u}rx.peek=VI;function rx(e){return e.value||""}function VI(){return"<"}ix.peek=BI;function ix(e,t,n,r){const i=dc(n),l=i==='"'?"Quote":"Apostrophe",o=n.enter("image");let s=n.enter("label");const a=n.createTracker(r);let u=a.move("![");return u+=a.move(n.safe(e.alt,{before:u,after:"]",...a.current()})),u+=a.move("]("),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter("destinationLiteral"),u+=a.move("<"),u+=a.move(n.safe(e.url,{before:u,after:">",...a.current()})),u+=a.move(">")):(s=n.enter("destinationRaw"),u+=a.move(n.safe(e.url,{before:u,after:e.title?" ":")",...a.current()}))),s(),e.title&&(s=n.enter(`title${l}`),u+=a.move(" "+i),u+=a.move(n.safe(e.title,{before:u,after:i,...a.current()})),u+=a.move(i),s()),u+=a.move(")"),o(),u}function BI(){return"!"}lx.peek=UI;function lx(e,t,n,r){const i=e.referenceType,l=n.enter("imageReference");let o=n.enter("label");const s=n.createTracker(r);let a=s.move("![");const u=n.safe(e.alt,{before:a,after:"]",...s.current()});a+=s.move(u+"]["),o();const d=n.stack;n.stack=[],o=n.enter("reference");const c=n.safe(n.associationId(e),{before:a,after:"]",...s.current()});return o(),n.stack=d,l(),i==="full"||!u||u!==c?a+=s.move(c+"]"):i==="shortcut"?a=a.slice(0,-1):a+=s.move("]"),a}function UI(){return"!"}ox.peek=HI;function ox(e,t,n){let r=e.value||"",i="`",l=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++l<n.unsafe.length;){const o=n.unsafe[l],s=n.compilePattern(o);let a;if(o.atBreak)for(;a=s.exec(r);){let u=a.index;r.charCodeAt(u)===10&&r.charCodeAt(u-1)===13&&u--,r=r.slice(0,u)+" "+r.slice(a.index+1)}}return i+r+i}function HI(){return"`"}function sx(e,t){const n=nc(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}ax.peek=WI;function ax(e,t,n,r){const i=dc(n),l=i==='"'?"Quote":"Apostrophe",o=n.createTracker(r);let s,a;if(sx(e,n)){const d=n.stack;n.stack=[],s=n.enter("autolink");let c=o.move("<");return c+=o.move(n.containerPhrasing(e,{before:c,after:">",...o.current()})),c+=o.move(">"),s(),n.stack=d,c}s=n.enter("link"),a=n.enter("label");let u=o.move("[");return u+=o.move(n.containerPhrasing(e,{before:u,after:"](",...o.current()})),u+=o.move("]("),a(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),u+=o.move("<"),u+=o.move(n.safe(e.url,{before:u,after:">",...o.current()})),u+=o.move(">")):(a=n.enter("destinationRaw"),u+=o.move(n.safe(e.url,{before:u,after:e.title?" ":")",...o.current()}))),a(),e.title&&(a=n.enter(`title${l}`),u+=o.move(" "+i),u+=o.move(n.safe(e.title,{before:u,after:i,...o.current()})),u+=o.move(i),a()),u+=o.move(")"),s(),u}function WI(e,t,n){return sx(e,n)?"<":"["}ux.peek=qI;function ux(e,t,n,r){const i=e.referenceType,l=n.enter("linkReference");let o=n.enter("label");const s=n.createTracker(r);let a=s.move("[");const u=n.containerPhrasing(e,{before:a,after:"]",...s.current()});a+=s.move(u+"]["),o();const d=n.stack;n.stack=[],o=n.enter("reference");const c=n.safe(n.associationId(e),{before:a,after:"]",...s.current()});return o(),n.stack=d,l(),i==="full"||!u||u!==c?a+=s.move(c+"]"):i==="shortcut"?a=a.slice(0,-1):a+=s.move("]"),a}function qI(){return"["}function fc(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function KI(e){const t=fc(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function GI(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function cx(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function QI(e,t,n,r){const i=n.enter("list"),l=n.bulletCurrent;let o=e.ordered?GI(n):fc(n);const s=e.ordered?o==="."?")":".":KI(n);let a=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){const d=e.children?e.children[0]:void 0;if((o==="*"||o==="-")&&d&&(!d.children||!d.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(a=!0),cx(n)===o&&d){let c=-1;for(;++c<e.children.length;){const f=e.children[c];if(f&&f.type==="listItem"&&f.children&&f.children[0]&&f.children[0].type==="thematicBreak"){a=!0;break}}}}a&&(o=s),n.bulletCurrent=o;const u=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=l,i(),u}function YI(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function XI(e,t,n,r){const i=YI(n);let l=n.bulletCurrent||fc(n);t&&t.type==="list"&&t.ordered&&(l=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+l);let o=l.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);const s=n.createTracker(r);s.move(l+" ".repeat(o-l.length)),s.shift(o);const a=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,s.current()),d);return a(),u;function d(c,f,p){return f?(p?"":" ".repeat(o))+c:(p?l:l+" ".repeat(o-l.length))+c}}function JI(e,t,n,r){const i=n.enter("paragraph"),l=n.enter("phrasing"),o=n.containerPhrasing(e,r);return l(),i(),o}const ZI=Mo(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function eN(e,t,n,r){return(e.children.some(function(o){return ZI(o)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function tN(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}dx.peek=nN;function dx(e,t,n,r){const i=tN(n),l=n.enter("strong"),o=n.createTracker(r),s=o.move(i+i);let a=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()}));const u=a.charCodeAt(0),d=fo(r.before.charCodeAt(r.before.length-1),u,i);d.inside&&(a=Di(u)+a.slice(1));const c=a.charCodeAt(a.length-1),f=fo(r.after.charCodeAt(0),c,i);f.inside&&(a=a.slice(0,-1)+Di(c));const p=o.move(i+i);return l(),n.attentionEncodeSurroundingInfo={after:f.outside,before:d.outside},s+a+p}function nN(e,t,n){return n.options.strong||"*"}function rN(e,t,n,r){return n.safe(e.value,r)}function iN(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function lN(e,t,n){const r=(cx(n)+(n.options.ruleSpaces?" ":"")).repeat(iN(n));return n.options.ruleSpaces?r.slice(0,-1):r}const fx={blockquote:NI,break:Jf,code:LI,definition:RI,emphasis:nx,hardBreak:Jf,heading:$I,html:rx,image:ix,imageReference:lx,inlineCode:ox,link:ax,linkReference:ux,list:QI,listItem:XI,paragraph:JI,root:eN,strong:dx,text:rN,thematicBreak:lN};function oN(){return{enter:{table:sN,tableData:Zf,tableHeader:Zf,tableRow:uN},exit:{codeText:cN,table:aN,tableData:Ls,tableHeader:Ls,tableRow:Ls}}}function sN(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function aN(e){this.exit(e),this.data.inTable=void 0}function uN(e){this.enter({type:"tableRow",children:[]},e)}function Ls(e){this.exit(e)}function Zf(e){this.enter({type:"tableCell",children:[]},e)}function cN(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,dN));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function dN(e,t){return t==="|"?t:e}function fN(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,l=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
253
253
|
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:f,table:o,tableCell:a,tableRow:s}};function o(p,x,v,_){return u(d(p,v,_),p.align)}function s(p,x,v,_){const m=c(p,v,_),g=u([m]);return g.slice(0,g.indexOf(`
|
|
254
|
-
`))}function a(p,x,v,_){const m=v.enter("tableCell"),g=v.enter("phrasing"),k=v.containerPhrasing(p,{..._,before:l,after:l});return g(),m(),k}function u(p,x){return _I(p,{align:x,alignDelimiters:r,padding:n,stringLength:i})}function d(p,x,v){const _=p.children;let m=-1;const g=[],k=x.enter("table");for(;++m<_.length;)g[m]=c(_[m],x,v);return k(),g}function c(p,x,v){const _=p.children;let m=-1;const g=[],k=x.enter("tableRow");for(;++m<_.length;)g[m]=a(_[m],p,x,v);return k(),g}function f(p,x,v){let _=fx.inlineCode(p,x,v);return v.stack.includes("tableCell")&&(_=_.replace(/\|/g,"\\$&")),_}}function pN(){return{exit:{taskListCheckValueChecked:ep,taskListCheckValueUnchecked:ep,paragraph:mN}}}function hN(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:gN}}}function ep(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function mN(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=t.children;let l=-1,o;for(;++l<i.length;){const s=i[l];if(s.type==="paragraph"){o=s;break}}o===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function gN(e,t,n,r){const i=e.children[0],l=typeof e.checked=="boolean"&&i&&i.type==="paragraph",o="["+(e.checked?"x":" ")+"] ",s=n.createTracker(r);l&&s.move(o);let a=fx.listItem(e,t,n,{...r,...s.current()});return l&&(a=a.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),a;function u(d){return d+o}}function xN(){return[Q_(),gI(),vI(),oN(),pN()]}function yN(e){return{extensions:[Y_(),xI(e),wI(),fN(e),hN()]}}const kN={tokenize:EN,partial:!0},px={tokenize:_N,partial:!0},hx={tokenize:IN,partial:!0},mx={tokenize:NN,partial:!0},vN={tokenize:TN,partial:!0},gx={name:"wwwAutolink",tokenize:bN,previous:yx},xx={name:"protocolAutolink",tokenize:CN,previous:kx},tn={name:"emailAutolink",tokenize:SN,previous:vx},$t={};function wN(){return{text:$t}}let Ln=48;for(;Ln<123;)$t[Ln]=tn,Ln++,Ln===58?Ln=65:Ln===91&&(Ln=97);$t[43]=tn;$t[45]=tn;$t[46]=tn;$t[95]=tn;$t[72]=[tn,xx];$t[104]=[tn,xx];$t[87]=[tn,gx];$t[119]=[tn,gx];function SN(e,t,n){const r=this;let i,l;return o;function o(c){return!Ba(c)||!vx.call(r,r.previous)||pc(r.events)?n(c):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),s(c))}function s(c){return Ba(c)?(e.consume(c),s):c===64?(e.consume(c),a):n(c)}function a(c){return c===46?e.check(vN,d,u)(c):c===45||c===95||Ve(c)?(l=!0,e.consume(c),a):d(c)}function u(c){return e.consume(c),i=!0,a}function d(c){return l&&i&&We(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(c)):n(c)}}function bN(e,t,n){const r=this;return i;function i(o){return o!==87&&o!==119||!yx.call(r,r.previous)||pc(r.events)?n(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(kN,e.attempt(px,e.attempt(hx,l),n),n)(o))}function l(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function CN(e,t,n){const r=this;let i="",l=!1;return o;function o(c){return(c===72||c===104)&&kx.call(r,r.previous)&&!pc(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(c),e.consume(c),s):n(c)}function s(c){if(We(c)&&i.length<5)return i+=String.fromCodePoint(c),e.consume(c),s;if(c===58){const f=i.toLowerCase();if(f==="http"||f==="https")return e.consume(c),a}return n(c)}function a(c){return c===47?(e.consume(c),l?u:(l=!0,a)):n(c)}function u(c){return c===null||ao(c)||pe(c)||Xn(c)||Po(c)?n(c):e.attempt(px,e.attempt(hx,d),n)(c)}function d(c){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(c)}}function EN(e,t,n){let r=0;return i;function i(o){return(o===87||o===119)&&r<3?(r++,e.consume(o),i):o===46&&r===3?(e.consume(o),l):n(o)}function l(o){return o===null?n(o):t(o)}}function _N(e,t,n){let r,i,l;return o;function o(u){return u===46||u===95?e.check(mx,a,s)(u):u===null||pe(u)||Xn(u)||u!==45&&Po(u)?a(u):(l=!0,e.consume(u),o)}function s(u){return u===95?r=!0:(i=r,r=void 0),e.consume(u),o}function a(u){return i||r||!l?n(u):t(u)}}function IN(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?l(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(mx,t,l)(o):o===null||pe(o)||Xn(o)?t(o):(e.consume(o),i)}function l(o){return o===41&&r++,e.consume(o),i}}function NN(e,t,n){return r;function r(s){return s===33||s===34||s===39||s===41||s===42||s===44||s===46||s===58||s===59||s===63||s===95||s===126?(e.consume(s),r):s===38?(e.consume(s),l):s===93?(e.consume(s),i):s===60||s===null||pe(s)||Xn(s)?t(s):n(s)}function i(s){return s===null||s===40||s===91||pe(s)||Xn(s)?t(s):r(s)}function l(s){return We(s)?o(s):n(s)}function o(s){return s===59?(e.consume(s),r):We(s)?(e.consume(s),o):n(s)}}function TN(e,t,n){return r;function r(l){return e.consume(l),i}function i(l){return Ve(l)?n(l):t(l)}}function yx(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||pe(e)}function kx(e){return!We(e)}function vx(e){return!(e===47||Ba(e))}function Ba(e){return e===43||e===45||e===46||e===95||Ve(e)}function pc(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const jN={tokenize:DN,partial:!0};function zN(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:MN,continuation:{tokenize:RN},exit:ON}},text:{91:{name:"gfmFootnoteCall",tokenize:LN},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:PN,resolveTo:AN}}}}function PN(e,t,n){const r=this;let i=r.events.length;const l=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o;for(;i--;){const a=r.events[i][1];if(a.type==="labelImage"){o=a;break}if(a.type==="gfmFootnoteCall"||a.type==="labelLink"||a.type==="label"||a.type==="image"||a.type==="link")break}return s;function s(a){if(!o||!o._balanced)return n(a);const u=Tt(r.sliceSerialize({start:o.end,end:r.now()}));return u.codePointAt(0)!==94||!l.includes(u.slice(1))?n(a):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(a),e.exit("gfmFootnoteCallLabelMarker"),t(a))}}function AN(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const l={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},l.start),end:Object.assign({},l.end)},s=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",l,t],["enter",o,t],["exit",o,t],["exit",l,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...s),e}function LN(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l=0,o;return s;function s(c){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),a}function a(c){return c!==94?n(c):(e.enter("gfmFootnoteCallMarker"),e.consume(c),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(c){if(l>999||c===93&&!o||c===null||c===91||pe(c))return n(c);if(c===93){e.exit("chunkString");const f=e.exit("gfmFootnoteCallString");return i.includes(Tt(r.sliceSerialize(f)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(c)}return pe(c)||(o=!0),l++,e.consume(c),c===92?d:u}function d(c){return c===91||c===92||c===93?(e.consume(c),l++,u):u(c)}}function MN(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l,o=0,s;return a;function a(x){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(x){return x===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",d):n(x)}function d(x){if(o>999||x===93&&!s||x===null||x===91||pe(x))return n(x);if(x===93){e.exit("chunkString");const v=e.exit("gfmFootnoteDefinitionLabelString");return l=Tt(r.sliceSerialize(v)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),f}return pe(x)||(s=!0),o++,e.consume(x),x===92?c:d}function c(x){return x===91||x===92||x===93?(e.consume(x),o++,d):d(x)}function f(x){return x===58?(e.enter("definitionMarker"),e.consume(x),e.exit("definitionMarker"),i.includes(l)||i.push(l),ne(e,p,"gfmFootnoteDefinitionWhitespace")):n(x)}function p(x){return t(x)}}function RN(e,t,n){return e.check(Wi,t,e.attempt(jN,t,n))}function ON(e){e.exit("gfmFootnoteDefinition")}function DN(e,t,n){const r=this;return ne(e,i,"gfmFootnoteDefinitionIndent",5);function i(l){const o=r.events[r.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(l):n(l)}}function FN(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:l,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(o,s){let a=-1;for(;++a<o.length;)if(o[a][0]==="enter"&&o[a][1].type==="strikethroughSequenceTemporary"&&o[a][1]._close){let u=a;for(;u--;)if(o[u][0]==="exit"&&o[u][1].type==="strikethroughSequenceTemporary"&&o[u][1]._open&&o[a][1].end.offset-o[a][1].start.offset===o[u][1].end.offset-o[u][1].start.offset){o[a][1].type="strikethroughSequence",o[u][1].type="strikethroughSequence";const d={type:"strikethrough",start:Object.assign({},o[u][1].start),end:Object.assign({},o[a][1].end)},c={type:"strikethroughText",start:Object.assign({},o[u][1].end),end:Object.assign({},o[a][1].start)},f=[["enter",d,s],["enter",o[u][1],s],["exit",o[u][1],s],["enter",c,s]],p=s.parser.constructs.insideSpan.null;p&&at(f,f.length,0,Ao(p,o.slice(u+1,a),s)),at(f,f.length,0,[["exit",c,s],["enter",o[a][1],s],["exit",o[a][1],s],["exit",d,s]]),at(o,u-1,a-u+3,f),a=u+f.length-2;break}}for(a=-1;++a<o.length;)o[a][1].type==="strikethroughSequenceTemporary"&&(o[a][1].type="data");return o}function l(o,s,a){const u=this.previous,d=this.events;let c=0;return f;function f(x){return u===126&&d[d.length-1][1].type!=="characterEscape"?a(x):(o.enter("strikethroughSequenceTemporary"),p(x))}function p(x){const v=Pr(u);if(x===126)return c>1?a(x):(o.consume(x),c++,p);if(c<2&&!n)return a(x);const _=o.exit("strikethroughSequenceTemporary"),m=Pr(x);return _._open=!m||m===2&&!!v,_._close=!v||v===2&&!!m,s(x)}}}class $N{constructor(){this.map=[],this.index=new Map}add(t,n,r){VN(this,t,n,r)}consume(t){if(this.map.sort(function(l,o){return l[0]-o[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let i=r.pop();for(;i;){for(const l of i)t.push(l);i=r.pop()}this.map.length=0,this.index.clear()}}function VN(e,t,n,r){if(n===0&&r.length===0)return;const i=e.index.get(t);if(i){i[1]+=n,i[2].push(...r);return}const l=[t,n,r];e.map.push(l),e.index.set(t,l)}function BN(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const l=r.length-1;r[l]=r[l]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function UN(){return{flow:{null:{name:"table",tokenize:HN,resolveAll:WN}}}}function HN(e,t,n){const r=this;let i=0,l=0,o;return s;function s(S){let z=r.events.length-1;for(;z>-1;){const{type:Q}=r.events[z][1];if(Q==="lineEnding"||Q==="linePrefix")z--;else break}const O=z>-1?r.events[z][1].type:null,U=O==="tableHead"||O==="tableRow"?b:a;return U===b&&r.parser.lazy[r.now().line]?n(S):U(S)}function a(S){return e.enter("tableHead"),e.enter("tableRow"),u(S)}function u(S){return S===124||(o=!0,l+=1),d(S)}function d(S){return S===null?n(S):B(S)?l>1?(l=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),p):n(S):Z(S)?ne(e,d,"whitespace")(S):(l+=1,o&&(o=!1,i+=1),S===124?(e.enter("tableCellDivider"),e.consume(S),e.exit("tableCellDivider"),o=!0,d):(e.enter("data"),c(S)))}function c(S){return S===null||S===124||pe(S)?(e.exit("data"),d(S)):(e.consume(S),S===92?f:c)}function f(S){return S===92||S===124?(e.consume(S),c):c(S)}function p(S){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(S):(e.enter("tableDelimiterRow"),o=!1,Z(S)?ne(e,x,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(S):x(S))}function x(S){return S===45||S===58?_(S):S===124?(o=!0,e.enter("tableCellDivider"),e.consume(S),e.exit("tableCellDivider"),v):N(S)}function v(S){return Z(S)?ne(e,_,"whitespace")(S):_(S)}function _(S){return S===58?(l+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(S),e.exit("tableDelimiterMarker"),m):S===45?(l+=1,m(S)):S===null||B(S)?C(S):N(S)}function m(S){return S===45?(e.enter("tableDelimiterFiller"),g(S)):N(S)}function g(S){return S===45?(e.consume(S),g):S===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(S),e.exit("tableDelimiterMarker"),k):(e.exit("tableDelimiterFiller"),k(S))}function k(S){return Z(S)?ne(e,C,"whitespace")(S):C(S)}function C(S){return S===124?x(S):S===null||B(S)?!o||i!==l?N(S):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(S)):N(S)}function N(S){return n(S)}function b(S){return e.enter("tableRow"),I(S)}function I(S){return S===124?(e.enter("tableCellDivider"),e.consume(S),e.exit("tableCellDivider"),I):S===null||B(S)?(e.exit("tableRow"),t(S)):Z(S)?ne(e,I,"whitespace")(S):(e.enter("data"),E(S))}function E(S){return S===null||S===124||pe(S)?(e.exit("data"),I(S)):(e.consume(S),S===92?j:E)}function j(S){return S===92||S===124?(e.consume(S),E):E(S)}}function WN(e,t){let n=-1,r=!0,i=0,l=[0,0,0,0],o=[0,0,0,0],s=!1,a=0,u,d,c;const f=new $N;for(;++n<e.length;){const p=e[n],x=p[1];p[0]==="enter"?x.type==="tableHead"?(s=!1,a!==0&&(tp(f,t,a,u,d),d=void 0,a=0),u={type:"table",start:Object.assign({},x.start),end:Object.assign({},x.end)},f.add(n,0,[["enter",u,t]])):x.type==="tableRow"||x.type==="tableDelimiterRow"?(r=!0,c=void 0,l=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,d={type:"tableBody",start:Object.assign({},x.start),end:Object.assign({},x.end)},f.add(n,0,[["enter",d,t]])),i=x.type==="tableDelimiterRow"?2:d?3:1):i&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")?(r=!1,o[2]===0&&(l[1]!==0&&(o[0]=o[1],c=kl(f,t,l,i,void 0,c),l=[0,0,0,0]),o[2]=n)):x.type==="tableCellDivider"&&(r?r=!1:(l[1]!==0&&(o[0]=o[1],c=kl(f,t,l,i,void 0,c)),l=o,o=[l[1],n,0,0])):x.type==="tableHead"?(s=!0,a=n):x.type==="tableRow"||x.type==="tableDelimiterRow"?(a=n,l[1]!==0?(o[0]=o[1],c=kl(f,t,l,i,n,c)):o[1]!==0&&(c=kl(f,t,o,i,n,c)),i=0):i&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")&&(o[3]=n)}for(a!==0&&tp(f,t,a,u,d),f.consume(t.events),n=-1;++n<t.events.length;){const p=t.events[n];p[0]==="enter"&&p[1].type==="table"&&(p[1]._align=BN(t.events,n))}return e}function kl(e,t,n,r,i,l){const o=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",s="tableContent";n[0]!==0&&(l.end=Object.assign({},or(t.events,n[0])),e.add(n[0],0,[["exit",l,t]]));const a=or(t.events,n[1]);if(l={type:o,start:Object.assign({},a),end:Object.assign({},a)},e.add(n[1],0,[["enter",l,t]]),n[2]!==0){const u=or(t.events,n[2]),d=or(t.events,n[3]),c={type:s,start:Object.assign({},u),end:Object.assign({},d)};if(e.add(n[2],0,[["enter",c,t]]),r!==2){const f=t.events[n[2]],p=t.events[n[3]];if(f[1].end=Object.assign({},p[1].end),f[1].type="chunkText",f[1].contentType="text",n[3]>n[2]+1){const x=n[2]+1,v=n[3]-n[2]-1;e.add(x,v,[])}}e.add(n[3]+1,0,[["exit",c,t]])}return i!==void 0&&(l.end=Object.assign({},or(t.events,i)),e.add(i,0,[["exit",l,t]]),l=void 0),l}function tp(e,t,n,r,i){const l=[],o=or(t.events,n);i&&(i.end=Object.assign({},o),l.push(["exit",i,t])),r.end=Object.assign({},o),l.push(["exit",r,t]),e.add(n+1,0,l)}function or(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const qN={name:"tasklistCheck",tokenize:GN};function KN(){return{text:{91:qN}}}function GN(e,t,n){const r=this;return i;function i(a){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(a):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(a),e.exit("taskListCheckMarker"),l)}function l(a){return pe(a)?(e.enter("taskListCheckValueUnchecked"),e.consume(a),e.exit("taskListCheckValueUnchecked"),o):a===88||a===120?(e.enter("taskListCheckValueChecked"),e.consume(a),e.exit("taskListCheckValueChecked"),o):n(a)}function o(a){return a===93?(e.enter("taskListCheckMarker"),e.consume(a),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),s):n(a)}function s(a){return B(a)?t(a):Z(a)?e.check({tokenize:QN},t,n)(a):n(a)}}function QN(e,t,n){return ne(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function YN(e){return Tg([wN(),zN(),FN(e),UN(),KN()])}const XN={};function JN(e){const t=this,n=e||XN,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),l=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(YN(n)),l.push(xN()),o.push(yN(n))}function ZN({text:e}){return h.jsx("div",{className:"message-markdown break-words",children:h.jsx(F_,{remarkPlugins:[JN],components:{img:({alt:t})=>h.jsxs("span",{className:"text-muted",children:["[Image: ",t||"attachment","]"]}),a:({href:t,children:n})=>h.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",children:n})},children:e})})}function eT({rows:e,startedAt:t,api:n}){const r=L.useMemo(()=>oS(e),[e]),i=e.filter(u=>u.kind==="message"&&u.eventKind==="prompt"&&u.event.image_count===0),l=L.useRef(null),[o,s]=L.useState(null);function a(u){const d=document.getElementById(`thread-${u}`);d==null||d.scrollIntoView({block:"start"}),d==null||d.focus({preventScroll:!0}),s(u)}return h.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1",children:[h.jsx("div",{ref:l,className:"min-h-0 min-w-0 flex-1 overflow-y-auto",children:h.jsxs("div",{className:"mx-auto max-w-3xl px-5 pb-16 pt-8 sm:px-8",children:[h.jsxs("div",{className:"mb-7 flex items-center justify-between gap-4 text-xs text-muted",children:[h.jsxs("span",{children:["Conversation ",h.jsx("span",{className:"px-2 text-faint",children:"/"})," ",i.length," prompts"]}),h.jsxs("button",{type:"button",className:"flex items-center gap-1.5 hover:text-foreground",onClick:()=>{l.current&&(l.current.scrollTop=l.current.scrollHeight)},children:[h.jsx(ak,{size:13,"aria-hidden":"true"})," Latest"]})]}),e.length===0?h.jsx("p",{className:"py-12 text-center text-muted",children:"No messages recorded yet."}):null,h.jsx("ol",{"data-slot":"thread-view",className:"space-y-5 text-base text-foreground",children:r.map(u=>u.kind==="message"?h.jsx("li",{id:`thread-${u.id}`,tabIndex:-1,"data-thread-kind":"message","data-event-id":u.id,className:"scroll-mt-6",children:h.jsx(wx,{row:u.row,startedAt:t,api:n})},u.id):h.jsx("li",{children:h.jsx(tT,{rows:u.rows,startedAt:t,api:n})},u.id))})]})}),i.length>1?h.jsxs("nav",{"aria-label":"Conversation outline",className:"hidden w-60 shrink-0 overflow-y-auto border-l border-border px-4 py-8 lg:block",children:[h.jsxs("p",{className:"mb-5 flex items-center gap-2 text-xs font-medium text-muted",children:[h.jsx(Rk,{size:14,"aria-hidden":"true"})," In this session"]}),h.jsx("ol",{className:"space-y-1",children:i.map((u,d)=>h.jsx("li",{children:h.jsxs("button",{type:"button",onClick:()=>a(u.event.id),"aria-current":o===u.event.id?"location":void 0,className:fe("flex w-full items-start gap-3 rounded-md px-2 py-3 text-left text-xs transition-colors hover:bg-surface-raised hover:text-foreground",o===u.event.id?"bg-span-turn/10 text-foreground":"text-muted"),children:[h.jsx("span",{className:"font-mono text-2xs text-span-turn",children:String(d+1).padStart(2,"0")}),h.jsx("span",{className:"line-clamp-3 break-words",children:u.kind==="message"?u.text||"Empty prompt":""})]})},u.event.id))}),h.jsx("p",{className:"mt-6 border-t border-border pt-4 text-2xs leading-relaxed text-muted",children:"Tool calls and reasoning are tucked into activity groups. Open any group to inspect the details."})]}):null]})}function tT({rows:e,startedAt:t,api:n}){const[r,i]=L.useState(!1);return h.jsxs("details",{"data-slot":"thread-activity",onToggle:l=>i(l.currentTarget.open),className:"rounded-md border border-dashed border-border bg-background",children:[h.jsxs("summary",{className:"flex cursor-pointer items-center gap-2.5 px-4 py-3 text-xs text-muted transition-colors hover:text-foreground",children:[h.jsx(Li,{size:14,className:"disclosure-chevron shrink-0","aria-hidden":"true"}),h.jsx(Gk,{size:14,className:"shrink-0 text-span-tool","aria-hidden":"true"}),h.jsxs("span",{className:"min-w-0 flex-1",children:[h.jsx("span",{className:"block text-xs font-medium",children:"Activity"}),h.jsx("span",{className:"mt-1 block text-2xs text-muted",children:sS(e)})]}),e.some(l=>l.kind==="tool"&&l.status==="error")?h.jsx("span",{className:"shrink-0 text-error",children:"Errors"}):null,h.jsx("span",{className:"text-2xs text-faint",children:"View activity"})]}),h.jsx("ol",{className:"border-t border-border px-4",children:e.map(l=>h.jsx("li",{"data-thread-kind":l.kind,"data-event-id":l.event.id,className:"border-b border-border py-3 last:border-b-0",children:h.jsx(nT,{row:l,startedAt:t,api:n,open:r})},l.event.id))})]})}function ii({ts:e,startedAt:t}){return h.jsx("time",{dateTime:e,className:"shrink-0 font-mono text-2xs text-muted",children:p0(e,t)})}function wx({row:e,startedAt:t,api:n,open:r=!0}){const i=e.eventKind==="prompt",l=e.eventKind==="error",o=e.eventKind==="text",s=i?"You":e.eventKind==="text"?"Claude":e.eventKind==="error"?"Session error":"Context compacted",a=i?Jk:Du;return h.jsxs("article",{className:fe("rounded-md border px-5 py-4",i?"border-span-turn/30 bg-span-turn/10":o?"border-accent/30 bg-accent-muted":"border-border bg-surface",l&&"border-error"),children:[h.jsxs("div",{className:"mb-3 flex items-center gap-2.5",children:[h.jsx("span",{className:fe("flex size-7 items-center justify-center rounded-md",i?"bg-span-turn/15 text-span-turn":"bg-accent-muted text-accent"),children:h.jsx(a,{size:15,"aria-hidden":"true"})}),h.jsx("span",{className:fe("flex-1 text-sm font-semibold",i?"text-span-turn":o?"text-accent":"text-foreground"),children:s}),i||o?h.jsx("span",{className:"text-2xs text-muted",children:i?"Prompt":"Message"}):null,h.jsx(ii,{ts:e.event.ts,startedAt:t})]}),e.text===null?h.jsx("p",{className:"text-sm text-muted",children:"No message text recorded."}):h.jsx("div",{"data-slot":"thread-message",className:"text-base leading-relaxed",children:i?h.jsx("p",{className:"whitespace-pre-wrap break-words",children:e.text}):h.jsx(ZN,{text:e.text})}),r?h.jsx(Sx,{event:e.event,api:n}):null]})}function nT({row:e,startedAt:t,api:n,open:r}){if(e.kind==="message")return h.jsx(wx,{row:e,startedAt:t,api:n,open:r});if(e.kind==="unknown")return h.jsxs("div",{children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("span",{"data-slot":"thread-unknown",className:"min-w-0 flex-1 break-words text-xs text-muted",children:e.label}),h.jsx(ii,{ts:e.event.ts,startedAt:t})]}),e.text===null?null:h.jsx("p",{"data-slot":"thread-record-text",className:"mt-1 whitespace-pre-wrap break-words text-xs text-muted",children:e.text}),h.jsxs("details",{"data-slot":"thread-raw",className:"mt-2 text-xs text-muted",children:[h.jsx("summary",{className:"cursor-pointer",children:"Raw record"}),h.jsx("pre",{className:"mt-2 whitespace-pre-wrap break-words font-mono text-2xs",children:e.record})]})]});if(e.kind==="thinking")return e.recorded?h.jsxs("details",{"data-slot":"thread-reasoning",className:"text-xs text-muted",children:[h.jsxs("summary",{className:"flex cursor-pointer items-center gap-2",children:[h.jsx(Li,{size:13,className:"disclosure-chevron","aria-hidden":"true"}),h.jsx("span",{className:"flex-1",children:"Reasoning"}),h.jsx(ii,{ts:e.event.ts,startedAt:t})]}),h.jsx("p",{"data-slot":"thread-thinking",className:"mt-3 whitespace-pre-wrap break-words text-sm text-foreground",children:e.event.text}),h.jsx(Ms,{event:e.event,field:"text",api:n})]}):h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("p",{"data-slot":"thread-thinking",className:"flex-1 text-xs text-span-thinking",children:e.text}),h.jsx(ii,{ts:e.event.ts,startedAt:t})]});const i=Te.status[e.status];return h.jsxs("div",{children:[h.jsxs("details",{"data-slot":"thread-tool-detail",className:"text-sm",children:[h.jsxs("summary",{className:"flex cursor-pointer flex-wrap items-center gap-2 text-muted hover:text-foreground",children:[h.jsx(Li,{size:13,className:"disclosure-chevron shrink-0","aria-hidden":"true"}),h.jsx("span",{"data-slot":"thread-tool",className:"min-w-0 flex-1 break-words font-mono text-foreground",children:e.name}),e.event.child_session_id?h.jsx("span",{className:"text-2xs text-span-subagent",children:e.event.agent_type||"Subagent"}):null,h.jsx("span",{className:fe("text-2xs",i.tint),children:i.label}),h.jsx(ii,{ts:e.event.ts,startedAt:t}),h.jsx(Gu,{values:Qm(e.event),showErrors:!1}),e.input?h.jsx("span",{className:"w-full truncate pl-5 font-mono text-2xs text-muted",title:e.input,children:e.input}):null]}),h.jsx(np,{slot:"thread-input",title:"Input",body:e.input}),h.jsx(Ms,{event:e.event,field:"input",api:n}),h.jsx(np,{slot:"thread-output",title:"Output",body:e.output}),h.jsx(Ms,{event:e.event,field:"text",api:n})]}),r?h.jsx(Sx,{event:e.event,api:n}):null,e.event.child_session_id?h.jsxs("a",{href:Hn({name:"session",sessionId:e.event.child_session_id}),className:"mt-3 inline-flex items-center gap-1.5 rounded-md bg-accent-muted px-3 py-2 text-xs text-accent hover:text-accent-hover",children:[h.jsx(Du,{size:14,"aria-hidden":"true"})," Open subagent thread"," ",h.jsx(ck,{size:13,"aria-hidden":"true"})]}):null]})}function Sx({event:e,api:t}){const n=lg(t,e);return h.jsx(dg,{event:e,images:n})}function np({slot:e,title:t,body:n}){return n===null?null:h.jsxs("div",{"data-slot":e,className:"mt-3",children:[h.jsx("span",{className:"text-2xs font-medium uppercase tracking-widest text-muted",children:t}),h.jsx("pre",{className:"mt-2 max-h-80 overflow-auto whitespace-pre-wrap break-words rounded-md border border-border bg-background p-3 font-mono text-xs text-muted",children:n})]})}function Ms({event:e,field:t,api:n}){const[r,i]=L.useState(null),[l,o]=L.useState(!1),[s,a]=L.useState(!1),u=ug(e,t,r),d=t==="input"?e.input:e.text,c=((d==null?void 0:d.length)??0)>480;return!u.canRefetch&&!c&&u.note===null||u.kind==="empty"?null:h.jsxs("div",{className:"mt-2 text-xs text-muted",children:[u.note?h.jsx("p",{children:u.note}):null,u.canRefetch&&n?h.jsx("button",{type:"button",disabled:l,className:"mt-2 text-accent disabled:opacity-50",onClick:()=>{o(!0),a(!1),n.getEventContent(e.id,t).then(i).catch(()=>a(!0)).finally(()=>o(!1))},children:l?"Loading…":s?"Retry loading full content":`Load full ${t==="input"?"input":"output"}`}):null,s?h.jsx("p",{role:"alert",className:"mt-1 text-error",children:"Could not load content. Try again."}):null,(c||r!==null)&&u.body!==null?h.jsxs("details",{className:"mt-2",children:[h.jsx("summary",{className:"cursor-pointer text-accent",children:u.truncated?"Stored preview":"Full content"}),h.jsx("pre",{className:"mt-2 max-h-96 overflow-auto whitespace-pre-wrap break-words rounded-md bg-background p-3 font-mono text-xs",children:u.body})]}):null]})}function rT(e){const t=W0(e);return t.length===0?null:h.jsxs("div",{"data-slot":"truncation-notice",role:"status",className:"flex items-center gap-2 border-b border-border bg-surface px-3 py-1.5 text-2xs text-warning",children:[h.jsx(vm,{size:12,"aria-hidden":"true",className:"shrink-0"}),h.jsx("span",{className:"min-w-0",children:t.join(" ")})]})}const iT=new Set(["j","k","ArrowDown","ArrowUp","ArrowLeft","ArrowRight","Home","End","Enter","Escape"]);function lT({sessionId:e,api:t,bus:n,revealSeq:r}){const i=L.useMemo(()=>t??Hu(),[t]),[l]=L.useState(()=>Date.now()),[o,s]=L.useState(0),a=Wu(e,H=>$d(i,e,{signal:H}),o),u=a.kind==="ok"?a.value:null,[d,c]=L.useState(null),f=Jm(d,e,u),[p,x]=L.useState(()=>Yd()),v=L.useCallback(H=>{x(Se=>Zw(Se,H))},[]),[_,m]=L.useReducer($0,Ym),[g,k]=L.useReducer(ow,Zm),[C,N]=L.useState(null);Q0(f,C)&&f!==null&&(N(f.session.id),x(Yd(K0(f.turns))),m({type:"reset"}),k({type:"reset"}));const b=L.useMemo(()=>Gm((f==null?void 0:f.turns)??[],(f==null?void 0:f.eventsByTurn)??new Map),[f]),I=L.useMemo(()=>U0(_),[_]),E=(f==null?void 0:f.session.id)??e,j=L.useMemo(()=>L0(b,p.expandedIds,void 0,{rootSessionId:E,subtrees:I}),[b,p.expandedIds,E,I]),S=G0(f,r),z=S===null?null:`${E}|${String(r)}`,[O,U]=L.useState(null),[Q,W]=L.useState(null);S!==null&&z!==O&&(U(z),x(H=>Jd(H,[S.turnId])),W(S));const{latch:X,revealIndex:re,selectedId:M,focusedIndex:V}=Ww(Q,j);L.useEffect(()=>{X!==Q&&(W(X),!(M===void 0||V===void 0)&&x(H=>({...H,focusedIndex:V,selectedId:M})))},[X,Q,M,V]);const[y,J]=L.useState(r===void 0?"thread":"tree"),ie=L.useMemo(()=>tS((f==null?void 0:f.events)??[]),[f]);L.useEffect(()=>{v(Y0(b,j,_))},[v,b,j,_]);const w=L.useRef({data:null,base:null});w.current={data:f,base:u},L.useEffect(()=>{if(n!==void 0)return n.subscribe(H=>{if(H.event!=="session_changed")return;const{data:Se,base:Le}=w.current,zt=ew(Se,H.data);if(zt.kind!=="ignore"){if(zt.kind==="refetch"){s(zn=>zn+1);return}Se===null||Le===null||i.getSession(e,{from_seq:zt.from_seq,limit:ja}).then(zn=>{const Qi=Z0(Se,H.data,zn);c({key:e,base:Le,data:Qi}),k({type:"appended",count:Qi.events.length-Se.events.length})}).catch(()=>{})}})},[n,i,e]);const he=L.useRef(null);L.useEffect(()=>{const H=new AbortController;return he.current=H,()=>H.abort()},[e]);const oe=V0(j,p.expandedIds,_).join(",");L.useEffect(()=>{var Se;if(oe==="")return;const H=(Se=he.current)==null?void 0:Se.signal;for(const Le of oe.split(","))m({type:"requested",childId:Le}),$d(i,Le,{limit:ja,...H===void 0?{}:{signal:H}}).then(zt=>{m({type:"loaded",childId:Le,child:zt}),x(zn=>Jd(zn,H0(zt)))}).catch(()=>{(H==null?void 0:H.aborted)!==!0&&m({type:"failed",childId:Le})})},[oe,i]);const K=L.useCallback(H=>{H.metaKey||H.ctrlKey||H.altKey||iT.has(H.key)&&(H.preventDefault(),v({type:"key",key:H.key,rows:j}))},[v,j]),Ae=L.useCallback(H=>{k({type:"selected"}),x(Se=>{const Le=j.findIndex(zt=>zt.id===H);return Le===-1?Se:{...Se,focusedIndex:Le,selectedId:H}})},[j]),nt=L.useCallback(H=>{k({type:"scrolled",atBottom:lw(H)})},[]),[ue,vt]=L.useState(null),wt=L.useCallback((H,Se)=>{i.getEventContent(H,Se).then(vt).catch(()=>{})},[i]),ft=L.useMemo(()=>{const H=j.find(Se=>Se.id===p.selectedId);return H===void 0||H.kind!=="event"?null:H.node.event},[j,p.selectedId]),[jn,nn]=L.useState(null),nr=ft==null?void 0:ft.id;L.useEffect(()=>{if(nr===void 0)return;const H=new AbortController;return i.getUnrecognisedFields(nr,{signal:H.signal}).then(nn).catch(()=>{}),()=>H.abort()},[i,nr]);const Ki=lg(i,ft),Gi=L.useCallback(H=>{k({type:"selected"}),x(Se=>{const Le=new Set(Se.expandedIds);return Le.delete(H)||Le.add(H),{...Se,expandedIds:Le}})},[]);return a.kind==="error"?h.jsx("main",{className:"p-6",children:h.jsx("p",{className:"text-sm text-error",children:a.error.message})}):h.jsxs("main",{"data-slot":"session-view",className:"flex h-full min-h-0 flex-col",children:[f===null?null:h.jsx(LS,{session:f.session,parentSessionId:f.session.parent_session_id,now:l,view:y,onViewChange:H=>{k({type:"selected"}),J(H)}}),f===null?null:h.jsx(rT,{shown:f.shown,hasMore:f.hasMore,unmatchedEventCount:b.unmatchedEventCount}),f===null?null:h.jsx(uS,{sessionId:e,hasDrift:f.session.has_drift,harnessVersion:f.session.harness_version}),h.jsx("div",{className:"flex min-h-0 flex-1",children:y==="thread"&&f!==null?h.jsx(eT,{rows:ie,startedAt:f.session.started_at,api:i},e):h.jsxs(h.Fragment,{children:[h.jsxs("div",{"data-slot":"tree-pane",className:"relative min-w-0 flex-1 border-r border-border",children:[h.jsx(lb,{rows:j,selectedId:p.selectedId,focusedIndex:p.focusedIndex,followIndex:g.following&&j.length>0?j.length-1:void 0,revealIndex:re,onScrollMetrics:nt,onKeyDown:K,onSelect:Ae,onToggle:Gi}),h.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-3 flex justify-center",children:h.jsx("div",{className:"pointer-events-auto",children:h.jsx(PS,{label:sw(g),onResume:()=>k({type:"resumed"})})})})]}),h.jsx(CS,{event:ft,fetched:ue,images:Ki,onShowFull:wt,unrecognised:jn})]})})]})}const oT={never_captured:Ak,outside_range:Tk,no_match_for_project:Uk};function sT({state:e}){const{sentence:t,hint:n}=_0(e),r=oT[e.kind];return h.jsxs("div",{"data-slot":"empty-state","data-empty-kind":e.kind,className:"flex flex-col items-center gap-2 px-8 py-16 text-center",children:[h.jsx(r,{size:24,"aria-hidden":"true",className:"text-faint"}),h.jsx("p",{className:"text-sm text-foreground",children:t}),h.jsx("p",{className:"text-xs text-muted",children:n})]})}const Rs="";function aT({range:e,onRangeChange:t,projects:n,project:r,onProjectChange:i}){return h.jsxs("div",{"data-slot":"range-control",className:"flex flex-wrap items-center justify-between gap-4",children:[h.jsxs("div",{role:"group","aria-label":"Time range",title:"Show sessions last active within this period",className:"inline-flex items-center gap-0.5 rounded-md bg-surface p-0.5",children:[h.jsx("span",{className:"px-2 text-xs text-muted",children:"Last active"}),m0.map(l=>h.jsx("button",{type:"button","aria-pressed":l===e,title:l==="all"?"Active at any time":`Active in the last ${l.slice(0,-1)} days`,onClick:()=>{t(l)},className:fe("rounded-md px-2 py-1 text-xs transition-colors",l===e?"bg-surface-raised text-foreground":"text-muted"),children:l},l))]}),h.jsxs("label",{className:"flex items-center gap-2 text-xs text-muted",children:["Project",h.jsxs("select",{value:r??Rs,onChange:l=>{const o=l.target.value;i(o===Rs?void 0:o)},className:"rounded-md border border-border bg-surface px-2 py-1 text-xs text-foreground",children:[h.jsx("option",{value:Rs,children:"All projects"}),n.map(l=>h.jsx("option",{value:l,children:l},l))]})]})]})}function uT({rows:e,sort:t,direction:n,onSortChange:r,cursor:i,now:l,pageTruncated:o=!1}){const s=h0(e,o),{dismissed:a,dismiss:u}=sg("cost-unknown");return h.jsxs("div",{"data-slot":"session-list",className:"overflow-hidden rounded-md border border-border",children:[s===null||a?null:h.jsxs("div",{"data-slot":"unpriced-notice",role:"status",className:"flex items-center gap-2 border-b border-border bg-surface px-3 py-1.5 text-2xs text-warning",children:[h.jsx(vm,{size:12,"aria-hidden":"true",className:"shrink-0"}),h.jsx("span",{className:"min-w-0",children:s}),h.jsx("button",{type:"button","aria-label":"Dismiss cost notice",title:"Dismiss until reload",onClick:u,className:"ml-auto flex size-6 shrink-0 items-center justify-center rounded-md text-muted hover:bg-surface-raised hover:text-foreground",children:h.jsx(bm,{size:14,"aria-hidden":"true"})})]}),h.jsxs("div",{className:"flex items-start justify-between gap-4 border-b border-border px-4 py-3",children:[h.jsxs("details",{className:"text-xs text-muted",children:[h.jsx("summary",{className:"cursor-pointer text-foreground",children:"What do these numbers mean?"}),h.jsxs("div",{className:"mt-2 max-w-2xl space-y-1 leading-relaxed",children:[h.jsx("p",{children:"Last active is the most recent event, in your local time. The day filters use this date."}),h.jsx("p",{children:"Elapsed runs from the first to the last event (or now for live sessions), including idle time."}),h.jsx("p",{children:"Turns counts your prompts. Errors, tokens, and estimated cost cover the main session. Tokens are input + output; cache counts are separate and not shown here."}),h.jsx("p",{children:"Subagents shows the number of agents and their additional input + output tokens. These tokens are separate from the main session totals. A dash means no measured cost or an unavailable estimate; unavailable estimates include an explanation."}),h.jsx("p",{children:"Model shows the main session’s most-used model first; +N counts other models, including sub-agents’. Hover for full ids."})]})]}),h.jsx("span",{"data-slot":"session-list-count",className:"shrink-0 text-2xs text-muted",children:Hm(e.length,o)})]}),h.jsx("p",{className:"px-4 py-2 text-2xs text-muted lg:hidden",children:"Scroll sideways to see all metrics."}),h.jsxs("div",{className:"overflow-x-auto",role:"region","aria-label":"Session list columns",tabIndex:0,children:[h.jsxs("div",{"data-slot":"session-list-header",className:"session-list-grid border-b border-border bg-surface px-4 py-3 text-2xs text-muted",children:[k0.map(d=>h.jsxs("button",{type:"button","aria-pressed":d===t,title:`Sort by ${Rd[d].toLowerCase()}`,onClick:()=>{r(d)},className:fe("text-left transition-colors",d===t?"text-foreground":"text-muted"),children:[d==="project_path"?"Session / Project":Rd[d],d===t?h.jsx(cT,{direction:n}):null]},d)),h.jsx("span",{children:"Status"}),h.jsx("span",{children:"Model"}),h.jsx("span",{className:"text-right",children:"Turns"}),h.jsx("span",{className:"text-right",children:"Subagents"}),h.jsx("span",{className:"text-right",children:"Errors"}),h.jsx("span",{className:"text-right",children:"Elapsed"}),h.jsx("span",{className:"text-right",children:"Tokens"}),h.jsx("span",{className:"text-right",children:"Est. cost"})]}),e.map((d,c)=>h.jsx(dT,{row:d,now:l,isCursor:c===i},d.id))]})]})}function cT({direction:e}){const t=e==="asc"?bk:To;return h.jsx(t,{size:12,"aria-hidden":"true",className:"inline-block"})}function dT({row:e,now:t,isCursor:n}){const r=fg[e.live?"live":"complete"],i=qm(e),l=f0(e.last_activity_at,t),o=e.rollup_state==="own",s=Rr(e.est_cost,e.model),a=c0(e.models,e.sub_models),u=e.error_count>0;return h.jsxs("a",{href:Hn({name:"session",sessionId:e.id}),"data-slot":"session-row","aria-label":`${i}, ${e.project_path}, ${r.label}, ${e.turn_count} turns, active ${l}${o?", sub-agent totals still being summed":""}`,className:fe("session-list-grid min-h-20 border-b border-border px-4 py-4 text-xs text-foreground transition-colors hover:bg-surface last:border-b-0",n&&"bg-surface-raised"),children:[h.jsxs("span",{"data-column":"session",className:"min-w-0",children:[h.jsx("span",{className:"block truncate text-sm font-medium",children:i}),h.jsx("span",{className:"mt-1.5 block truncate font-mono text-2xs text-muted",title:e.project_path,children:e.project_path})]}),h.jsx("time",{"data-column":"active",dateTime:e.last_activity_at,title:new Date(e.last_activity_at).toLocaleString(),className:"text-muted",children:l}),h.jsxs("span",{"data-column":"status",className:fe("flex items-center gap-1",r.badge),children:[h.jsx("span",{"aria-hidden":"true",className:fe("size-1.5 rounded-md",r.dot)}),r.label]}),h.jsx("span",{"data-column":"model","data-slot":"session-model",title:a.title,className:"min-w-0 truncate font-mono text-2xs text-muted",children:a.text}),h.jsx("span",{"data-column":"turns","data-slot":"session-turns",className:"text-right font-mono text-2xs text-muted",children:qt(e.turn_count)}),h.jsxs("span",{"data-column":"subagents",className:"text-right text-2xs text-muted",children:[h.jsx("span",{className:"font-mono",children:qt(e.agent_count)}),e.agent_count===0?null:o?h.jsx("span",{"data-slot":"session-subs-pending",className:"mt-1 block animate-pulse rounded-md bg-surface-raised motion-reduce:animate-none",children:"Counting tokens…"}):h.jsxs("span",{"data-slot":"session-subs",className:"mt-1 block font-mono",children:[qt(e.sub_tokens_in+e.sub_tokens_out)," tok"]})]}),h.jsx("span",{"data-column":"errors","data-slot":"session-errors","aria-label":`${e.error_count} errors`,className:fe("text-right font-mono text-2xs",u?"text-error":"text-muted"),children:qt(e.error_count)}),h.jsx("span",{"data-column":"elapsed","data-slot":"metric-duration",className:"text-right font-mono text-2xs text-muted",children:Vm(e.started_at,e.live?void 0:e.last_activity_at,t)}),h.jsx("span",{"data-column":"tokens","data-slot":"metric-tokens",className:"text-right font-mono text-2xs text-muted",children:qt(e.tokens_in+e.tokens_out)}),h.jsx("span",{"data-slot":"metric-cost",title:s,"aria-label":s,"data-column":"cost",className:fe("text-right font-mono text-2xs",s===void 0?"text-muted":"text-faint"),children:Mi(e.est_cost)})]})}const Ua=2;function fT({buckets:e}){const t=e.reduce((n,r)=>Math.max(n,r.count),0);return h.jsx("div",{"data-slot":"volume-histogram",role:"img","aria-label":`Session volume: ${e.reduce((n,r)=>n+r.count,0)} in range`,className:"flex h-12 items-end gap-0.5",children:e.map(n=>h.jsx("span",{"data-slot":"volume-bucket","data-count":n.count,style:{height:`${t===0?Ua:pT(n.count,t)}%`},className:"flex-1 rounded-md bg-accent-muted"},n.start))})}function pT(e,t){return e===0?Ua:Math.max(Ua,Math.round(e/t*100))}const hT=40;function mT({router:e=rg(),api:t,bus:n}={}){const[r,i]=L.useState("3d"),[l,o]=L.useState(void 0),[s,a]=L.useState("last_activity_at"),[u,d]=L.useState("desc"),[c,f]=L.useState(-1),p=L.useMemo(()=>t??Hu(),[t]),[x]=L.useState(()=>Date.now()),v=`${r}|${l??""}`,_=Wu(v,E=>x0(p,{range:r,now:x,project:l,signal:E})),m=_.kind==="ok"?_.value:null,[g,k]=L.useState(null),C=Jm(g,v,m),N=L.useRef({data:null,base:null});N.current={data:C,base:m},L.useEffect(()=>{if(n!==void 0)return n.subscribe(E=>{if(E.event!=="session_changed")return;const{data:j,base:S}=N.current;if(j===null||S===null)return;const z=rw(j,E.data.session_id,E.data.rollups,Date.now());z!==j&&k({key:v,base:S,data:z})})},[n,v]);const b=L.useMemo(()=>C===null?[]:v0(C,{project:l,sort:s,direction:u}),[C,l,s,u]);L.useEffect(()=>{const E=j=>{const S=j.target,z=(S==null?void 0:S.isContentEditable)===!0||["INPUT","TEXTAREA","SELECT"].includes((S==null?void 0:S.tagName)??""),O=I0(j.key,{index:c,rowCount:b.length,inEditable:z});if(O.kind==="ignore")return;j.preventDefault();const U=N0(O,b,e);U!==null&&f(U)};return window.addEventListener("keydown",E),()=>{window.removeEventListener("keydown",E)}},[c,b,e]);const I=C===null?null:E0(C,b,{project:l});return h.jsxs(gT,{children:[h.jsxs("div",{className:"mb-2",children:[h.jsx("p",{className:"mb-2 text-xs font-medium text-accent",children:"YOUR WORK, REVISITED"}),h.jsx("h1",{className:"text-xl font-semibold",children:"Sessions"}),h.jsx("p",{className:"mt-2 text-base text-muted",children:"Pick up the thread. Explore what you asked, what Claude answered, and how it got there."})]}),h.jsx(fT,{buckets:b0((C==null?void 0:C.sessions)??[],{range:r,now:x,bucketCount:hT})}),h.jsx(aT,{range:r,onRangeChange:i,projects:C===null?[]:w0(C.sessions),project:l,onProjectChange:o}),_.kind==="error"?h.jsx("p",{className:"text-sm text-error",children:_.error.message}):I===null?null:I.kind==="none"?h.jsx(uT,{rows:b,sort:s,direction:u,onSortChange:E=>{d(E===s&&u==="desc"?"asc":"desc"),a(E)},cursor:c,now:x,pageTruncated:(C==null?void 0:C.truncated)??!1}):h.jsx(sT,{state:I})]})}function gT({children:e}){return h.jsx("main",{className:"mx-auto flex max-w-7xl flex-col gap-4 px-5 py-8 sm:px-8",children:e})}const Oo=[{cssVar:"--color-background",specValue:"#0b0b0e",specLine:64,prosePin:"#0b0b0e",emits:"var",utilityClass:"bg-background"},{cssVar:"--color-surface",specValue:"#131318",specLine:65,prosePin:"#131318",emits:"var",utilityClass:"bg-surface"},{cssVar:"--color-surface-raised",specValue:"#1b1b22",specLine:66,prosePin:"#1b1b22",emits:"var",utilityClass:"bg-surface-raised"},{cssVar:"--color-border",specValue:"#26262e",specLine:67,prosePin:"#26262e",emits:"var",utilityClass:"bg-border"},{cssVar:"--color-foreground",specValue:"#ededf0",specLine:68,prosePin:"#ededf0",emits:"var",utilityClass:"bg-foreground"},{cssVar:"--color-muted",specValue:"#9b9ba6",specLine:69,prosePin:"#9b9ba6",emits:"var",utilityClass:"bg-muted"},{cssVar:"--color-faint",specValue:"#5c5c66",specLine:70,prosePin:"#5c5c66",emits:"var",utilityClass:"bg-faint"},{cssVar:"--color-accent",specValue:"#7c8cf8",specLine:73,prosePin:"#7c8cf8",emits:"var",utilityClass:"bg-accent"},{cssVar:"--color-accent-hover",specValue:"#97a3fa",specLine:74,prosePin:"#97a3fa",emits:"var",utilityClass:"bg-accent-hover"},{cssVar:"--color-accent-muted",specValue:"#7c8cf826",specLine:75,prosePin:"#7c8cf826",emits:"var",utilityClass:"bg-accent-muted"},{cssVar:"--color-span-turn",specValue:"#2dd4bf",specLine:78,prosePin:"#2dd4bf",emits:"var",utilityClass:"bg-span-turn"},{cssVar:"--color-span-llm",specValue:"#c084fc",specLine:79,prosePin:"#c084fc",emits:"var",utilityClass:"bg-span-llm"},{cssVar:"--color-span-tool",specValue:"#60a5fa",specLine:80,prosePin:"#60a5fa",emits:"var",utilityClass:"bg-span-tool"},{cssVar:"--color-span-subagent",specValue:"#818cf8",specLine:81,prosePin:"#818cf8",emits:"var",utilityClass:"bg-span-subagent"},{cssVar:"--color-span-thinking",specValue:"#9b9ba6",specLine:82,prosePin:"#9b9ba6",emits:"var",utilityClass:"bg-span-thinking"},{cssVar:"--color-span-generic",specValue:"#a3e635",specLine:83,prosePin:"#a3e635",emits:"var",utilityClass:"bg-span-generic"},{cssVar:"--color-success",specValue:"#4ade80",specLine:86,prosePin:"#4ade80",emits:"var",utilityClass:"bg-success"},{cssVar:"--color-warning",specValue:"#fbbf24",specLine:87,prosePin:"#fbbf24",emits:"var",utilityClass:"bg-warning"},{cssVar:"--color-error",specValue:"#f87171",specLine:88,prosePin:"#f87171",emits:"var",utilityClass:"bg-error"},{cssVar:"--color-running",specValue:"#7c8cf8",specLine:89,prosePin:"#7c8cf8",emits:"var",utilityClass:"bg-running"},{cssVar:"--text-2xs",specValue:"11px",specLine:101,prosePin:"11 (dense chips/timestamps)",emits:"var",utilityClass:"text-2xs"},{cssVar:"--text-xs",specValue:"12px",specLine:101,prosePin:"12 (tree metadata, table cells)",emits:"var",utilityClass:"text-xs"},{cssVar:"--text-sm",specValue:"13px",specLine:101,prosePin:"13 (UI base)",emits:"var",utilityClass:"text-sm"},{cssVar:"--text-base",specValue:"14px",specLine:101,prosePin:"14 (reading)",emits:"var",utilityClass:"text-base"},{cssVar:"--text-lg",specValue:"16px",specLine:101,prosePin:"16 (pane titles)",emits:"var",utilityClass:"text-lg"},{cssVar:"--text-xl",specValue:"20px",specLine:101,prosePin:"20 (page titles)",emits:"var",utilityClass:"text-xl"},{cssVar:"--text-2xs--line-height",specValue:"1.3",specLine:107,prosePin:"1.3",emits:"var-fallback",utilityClass:"text-2xs"},{cssVar:"--text-xs--line-height",specValue:"1.3",specLine:108,prosePin:"1.3",emits:"var-fallback",utilityClass:"text-xs"},{cssVar:"--text-sm--line-height",specValue:"1.3",specLine:109,prosePin:"1.3",emits:"var-fallback",utilityClass:"text-sm"},{cssVar:"--text-base--line-height",specValue:"1.45",specLine:110,prosePin:"1.45",emits:"var-fallback",utilityClass:"text-base"},{cssVar:"--text-lg--line-height",specValue:"1.45",specLine:111,prosePin:"1.45",emits:"var-fallback",utilityClass:"text-lg"},{cssVar:"--text-xl--line-height",specValue:"1.3",specLine:112,prosePin:"1.3",emits:"var-fallback",utilityClass:"text-xl"},{cssVar:"--radius-md",specValue:"6px",specLine:120,prosePin:"6px",emits:"var",utilityClass:"rounded-md"},{cssVar:"--radius-lg",specValue:"8px",specLine:120,prosePin:"8px",emits:"var",utilityClass:"rounded-lg"},{cssVar:"--shadow-float",specValue:"0 8px 24px rgb(0 0 0 / 0.5)",specLine:124,prosePin:"0 8px 24px rgb(0 0 0 / 0.5)",emits:"inline",utilityClass:"shadow-float"},{cssVar:"--font-sans",specValue:"'Inter', ui-sans-serif, system-ui, sans-serif",specLine:96,prosePin:"Inter",emits:"var",utilityClass:"font-sans"},{cssVar:"--font-mono",specValue:"'JetBrains Mono', ui-monospace, 'SF Mono', monospace",specLine:97,prosePin:"JetBrains Mono",emits:"var",utilityClass:"font-mono"},{cssVar:"--default-transition-duration",specValue:"150ms",specLine:128,prosePin:"150ms",emits:"var-fallback",utilityClass:"transition-colors"},{cssVar:"--default-transition-timing-function",specValue:"cubic-bezier(0.4, 0, 0.2, 1)",specLine:128,prosePin:"cubic-bezier(0.4, 0, 0.2, 1)",emits:"var-fallback",utilityClass:"transition-colors"},{cssVar:"--animate-live-pulse",specValue:"live-pulse 1.5s ease-in-out infinite",specLine:129,prosePin:"1.5s ease-in-out",emits:"var",utilityClass:"animate-live-pulse"},{cssVar:"--animate-row-arrive",specValue:"row-arrive 300ms ease-out 1",specLine:129,prosePin:"300ms",emits:"var",utilityClass:"animate-row-arrive"}],xT=e=>e.cssVar.endsWith("--line-height"),yT=Oo.filter(e=>e.cssVar.startsWith("--color-")),kT=Oo.filter(e=>e.cssVar.startsWith("--text-")&&!xT(e)),vT=e=>{var t;return((t=Oo.find(n=>n.cssVar===`${e}--line-height`))==null?void 0:t.specValue)??""},wT=Oo.filter(e=>e.cssVar.startsWith("--radius-"));function sn({title:e,note:t,children:n}){return h.jsxs("section",{className:"border-b border-border py-8",children:[h.jsx("h2",{className:"text-lg font-semibold text-foreground",children:e}),h.jsx("p",{className:"mt-1 text-xs text-faint",children:t}),h.jsx("div",{className:"mt-4",children:n})]})}function rp({token:e}){return h.jsxs("div",{className:"mt-2",children:[h.jsx("div",{className:"font-mono text-2xs text-muted",children:e.cssVar}),h.jsx("div",{className:"font-mono text-2xs text-faint",children:e.specValue}),e.utilityClass!==null&&h.jsxs("div",{className:"font-mono text-2xs text-accent",children:[".",e.utilityClass]})]})}function ST(){return h.jsxs("main",{className:"mx-auto max-w-5xl px-8 py-12",children:[h.jsxs("header",{children:[h.jsx("h1",{className:"text-xl font-semibold text-foreground",children:"agent-lens design tokens"}),h.jsxs("p",{className:"mt-2 text-sm text-muted",children:["Every token in ",h.jsx("span",{className:"font-mono text-2xs",children:"spec/design-system.md"}),", rendered through the utility class that emits it. This page is the reference — copy class names from here, and if a colour or size you want is missing, it is missing on purpose."]})]}),h.jsx(sn,{title:"Color",note:"Neutrals carry the layout, span-type colors carry meaning, the accent only marks interactivity. Tailwind's default palette is cleared — bg-red-500 does not exist.",children:h.jsx("div",{className:"grid grid-cols-2 gap-4 sm:grid-cols-3 lg:grid-cols-4",children:yT.map(e=>h.jsxs("div",{children:[h.jsx("div",{className:`h-16 rounded-md border border-border ${e.utilityClass??""}`,"aria-hidden":"true"}),h.jsx(rp,{token:e})]},e.cssVar))})}),h.jsx(sn,{title:"Type scale",note:"Six steps, 11px to 20px, each with its own line-height. Nothing larger exists — text-3xl does not compile.",children:h.jsx("div",{className:"space-y-5",children:kT.map(e=>h.jsxs("div",{className:"flex items-baseline gap-6",children:[h.jsxs("span",{className:"w-28 shrink-0 font-mono text-2xs text-faint",children:[e.specValue," / ",vT(e.cssVar)]}),h.jsxs("div",{children:[h.jsx("p",{className:e.utilityClass??"",children:"Inspect everything your agent did in a session."}),h.jsxs("div",{className:"font-mono text-2xs text-accent",children:[".",e.utilityClass]})]})]},e.cssVar))})}),h.jsx(sn,{title:"Font families",note:"Both self-hosted and bundled. Mono is ~40% of rendered text in this product — a first-class citizen, not an accent.",children:h.jsxs("div",{className:"space-y-5",children:[h.jsxs("div",{children:[h.jsx("p",{className:"font-sans text-base text-foreground",children:"Inter — the quick brown fox jumps over the lazy dog 0123456789"}),h.jsx("div",{className:"font-mono text-2xs text-accent",children:".font-sans"})]}),h.jsxs("div",{children:[h.jsx("p",{className:"font-mono text-base text-foreground",children:"JetBrains Mono — 1.02s · 185 tok · <$0.001 · sess_01J8XZ"}),h.jsx("div",{className:"font-mono text-2xs text-accent",children:".font-mono"})]})]})}),h.jsx(sn,{title:"Radius",note:"rounded-md everywhere; rounded-lg for floating surfaces only.",children:h.jsx("div",{className:"flex gap-8",children:wT.map(e=>h.jsxs("div",{children:[h.jsx("div",{className:`h-20 w-20 bg-surface-raised border border-border ${e.utilityClass??""}`,"aria-hidden":"true"}),h.jsx(rp,{token:e})]},e.cssVar))})}),h.jsxs(sn,{title:"Shadow",note:"One level, floating surfaces only. In-flow surfaces separate with borders, never shadows.",children:[h.jsxs("div",{className:"w-72 rounded-lg bg-surface-raised p-4 shadow-float",children:[h.jsx("p",{className:"text-sm text-foreground",children:"Floating surface"}),h.jsx("p",{className:"mt-1 text-xs text-muted",children:"Modals, popovers, context menus."})]}),h.jsx("div",{className:"font-mono text-2xs text-accent mt-2",children:".shadow-float"})]}),h.jsx(sn,{title:"Motion",note:"150ms default. The running pulse loops; row arrival washes once. Both stop under prefers-reduced-motion.",children:h.jsxs("div",{className:"flex flex-wrap items-center gap-8",children:[h.jsxs("div",{children:[h.jsxs("span",{className:"inline-flex items-center gap-2 rounded-md bg-surface-raised px-2 py-1",children:[h.jsx("span",{className:"h-2 w-2 rounded-full bg-running animate-live-pulse","aria-hidden":"true"}),h.jsx("span",{className:"font-mono text-2xs text-muted",children:"live"})]}),h.jsx("div",{className:"font-mono text-2xs text-accent mt-2",children:".animate-live-pulse"})]}),h.jsxs("div",{children:[h.jsx("div",{className:"rounded-md px-3 py-1.5 animate-row-arrive",children:h.jsx("span",{className:"font-mono text-2xs text-muted",children:"new row arrived"})}),h.jsx("div",{className:"font-mono text-2xs text-accent mt-2",children:".animate-row-arrive"})]}),h.jsxs("div",{children:[h.jsx("button",{type:"button",className:"rounded-md border border-border bg-surface px-3 py-1.5 text-sm text-foreground transition-colors hover:bg-surface-raised",children:"Hover me"}),h.jsx("div",{className:"font-mono text-2xs text-accent mt-2",children:".transition-colors"})]})]})}),h.jsx(sn,{title:"Span-type vocabulary",note:"How the span palette reads in situ — the atom every tree row and thread card is built from.",children:h.jsx("div",{className:"rounded-md border border-border bg-surface",children:[{label:"turn",dot:"bg-span-turn",name:"user turn"},{label:"llm",dot:"bg-span-llm",name:"claude-opus-4 completion"},{label:"tool",dot:"bg-span-tool",name:"Read(src/server/app.ts)"},{label:"subagent",dot:"bg-span-subagent",name:"Explore subagent"},{label:"thinking",dot:"bg-span-thinking",name:"thinking"},{label:"generic",dot:"bg-span-generic",name:"foreign span"}].map(e=>h.jsxs("div",{className:"flex items-center gap-3 border-b border-border px-3 py-1.5 last:border-b-0",children:[h.jsx("span",{className:`h-2 w-2 rounded-full ${e.dot}`,"aria-hidden":"true"}),h.jsx("span",{className:"text-xs text-foreground",children:e.name}),h.jsx("span",{className:"ml-auto font-mono text-2xs text-muted",children:"1.02s · 185 tok · $0.004"})]},e.label))})}),h.jsx(sn,{title:"Status",note:"Status is never conveyed by color alone — every one of these pairs with an icon or a word in the real UI.",children:h.jsx("div",{className:"flex flex-wrap gap-3",children:[{cls:"text-success",label:"complete"},{cls:"text-warning",label:"degraded"},{cls:"text-error",label:"failed"},{cls:"text-running",label:"running"}].map(e=>h.jsx("span",{className:`rounded-md bg-surface-raised px-2 py-1 font-mono text-2xs ${e.cls}`,children:e.label},e.label))})})]})}function bT({router:e,api:t}={}){const n=Rw(e),r=L.useMemo(()=>aw(),[]);return zw(r),h.jsx(Gv,{children:n.name==="showcase"?h.jsx(ST,{}):n.name==="search"?h.jsx(Gw,{...n.sessionId===void 0?{}:{sessionId:n.sessionId},...t===void 0?{}:{api:t}}):n.name==="session"||n.name==="trace"||n.name==="event"?h.jsx(lT,{sessionId:n.sessionId,bus:r,...n.name==="event"?{revealSeq:n.seq}:{},...t===void 0?{}:{api:t}},`${n.sessionId}:${n.name==="event"?n.seq:"session"}`):h.jsx(mT,{bus:r,...e===void 0?{}:{router:e},...t===void 0?{}:{api:t}})})}const bx=document.getElementById("root");if(!bx)throw new Error("Root element #root not found");ym(bx).render(h.jsx(L.StrictMode,{children:h.jsx(bT,{})}));
|
|
254
|
+
`))}function a(p,x,v,_){const m=v.enter("tableCell"),g=v.enter("phrasing"),k=v.containerPhrasing(p,{..._,before:l,after:l});return g(),m(),k}function u(p,x){return _I(p,{align:x,alignDelimiters:r,padding:n,stringLength:i})}function d(p,x,v){const _=p.children;let m=-1;const g=[],k=x.enter("table");for(;++m<_.length;)g[m]=c(_[m],x,v);return k(),g}function c(p,x,v){const _=p.children;let m=-1;const g=[],k=x.enter("tableRow");for(;++m<_.length;)g[m]=a(_[m],p,x,v);return k(),g}function f(p,x,v){let _=fx.inlineCode(p,x,v);return v.stack.includes("tableCell")&&(_=_.replace(/\|/g,"\\$&")),_}}function pN(){return{exit:{taskListCheckValueChecked:ep,taskListCheckValueUnchecked:ep,paragraph:mN}}}function hN(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:gN}}}function ep(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function mN(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=t.children;let l=-1,o;for(;++l<i.length;){const s=i[l];if(s.type==="paragraph"){o=s;break}}o===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function gN(e,t,n,r){const i=e.children[0],l=typeof e.checked=="boolean"&&i&&i.type==="paragraph",o="["+(e.checked?"x":" ")+"] ",s=n.createTracker(r);l&&s.move(o);let a=fx.listItem(e,t,n,{...r,...s.current()});return l&&(a=a.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),a;function u(d){return d+o}}function xN(){return[Q_(),gI(),vI(),oN(),pN()]}function yN(e){return{extensions:[Y_(),xI(e),wI(),fN(e),hN()]}}const kN={tokenize:EN,partial:!0},px={tokenize:_N,partial:!0},hx={tokenize:IN,partial:!0},mx={tokenize:NN,partial:!0},vN={tokenize:TN,partial:!0},gx={name:"wwwAutolink",tokenize:bN,previous:yx},xx={name:"protocolAutolink",tokenize:CN,previous:kx},tn={name:"emailAutolink",tokenize:SN,previous:vx},$t={};function wN(){return{text:$t}}let Ln=48;for(;Ln<123;)$t[Ln]=tn,Ln++,Ln===58?Ln=65:Ln===91&&(Ln=97);$t[43]=tn;$t[45]=tn;$t[46]=tn;$t[95]=tn;$t[72]=[tn,xx];$t[104]=[tn,xx];$t[87]=[tn,gx];$t[119]=[tn,gx];function SN(e,t,n){const r=this;let i,l;return o;function o(c){return!Ba(c)||!vx.call(r,r.previous)||pc(r.events)?n(c):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),s(c))}function s(c){return Ba(c)?(e.consume(c),s):c===64?(e.consume(c),a):n(c)}function a(c){return c===46?e.check(vN,d,u)(c):c===45||c===95||Ve(c)?(l=!0,e.consume(c),a):d(c)}function u(c){return e.consume(c),i=!0,a}function d(c){return l&&i&&We(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(c)):n(c)}}function bN(e,t,n){const r=this;return i;function i(o){return o!==87&&o!==119||!yx.call(r,r.previous)||pc(r.events)?n(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(kN,e.attempt(px,e.attempt(hx,l),n),n)(o))}function l(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function CN(e,t,n){const r=this;let i="",l=!1;return o;function o(c){return(c===72||c===104)&&kx.call(r,r.previous)&&!pc(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(c),e.consume(c),s):n(c)}function s(c){if(We(c)&&i.length<5)return i+=String.fromCodePoint(c),e.consume(c),s;if(c===58){const f=i.toLowerCase();if(f==="http"||f==="https")return e.consume(c),a}return n(c)}function a(c){return c===47?(e.consume(c),l?u:(l=!0,a)):n(c)}function u(c){return c===null||ao(c)||pe(c)||Xn(c)||Po(c)?n(c):e.attempt(px,e.attempt(hx,d),n)(c)}function d(c){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(c)}}function EN(e,t,n){let r=0;return i;function i(o){return(o===87||o===119)&&r<3?(r++,e.consume(o),i):o===46&&r===3?(e.consume(o),l):n(o)}function l(o){return o===null?n(o):t(o)}}function _N(e,t,n){let r,i,l;return o;function o(u){return u===46||u===95?e.check(mx,a,s)(u):u===null||pe(u)||Xn(u)||u!==45&&Po(u)?a(u):(l=!0,e.consume(u),o)}function s(u){return u===95?r=!0:(i=r,r=void 0),e.consume(u),o}function a(u){return i||r||!l?n(u):t(u)}}function IN(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?l(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(mx,t,l)(o):o===null||pe(o)||Xn(o)?t(o):(e.consume(o),i)}function l(o){return o===41&&r++,e.consume(o),i}}function NN(e,t,n){return r;function r(s){return s===33||s===34||s===39||s===41||s===42||s===44||s===46||s===58||s===59||s===63||s===95||s===126?(e.consume(s),r):s===38?(e.consume(s),l):s===93?(e.consume(s),i):s===60||s===null||pe(s)||Xn(s)?t(s):n(s)}function i(s){return s===null||s===40||s===91||pe(s)||Xn(s)?t(s):r(s)}function l(s){return We(s)?o(s):n(s)}function o(s){return s===59?(e.consume(s),r):We(s)?(e.consume(s),o):n(s)}}function TN(e,t,n){return r;function r(l){return e.consume(l),i}function i(l){return Ve(l)?n(l):t(l)}}function yx(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||pe(e)}function kx(e){return!We(e)}function vx(e){return!(e===47||Ba(e))}function Ba(e){return e===43||e===45||e===46||e===95||Ve(e)}function pc(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const jN={tokenize:DN,partial:!0};function zN(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:MN,continuation:{tokenize:RN},exit:ON}},text:{91:{name:"gfmFootnoteCall",tokenize:LN},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:PN,resolveTo:AN}}}}function PN(e,t,n){const r=this;let i=r.events.length;const l=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o;for(;i--;){const a=r.events[i][1];if(a.type==="labelImage"){o=a;break}if(a.type==="gfmFootnoteCall"||a.type==="labelLink"||a.type==="label"||a.type==="image"||a.type==="link")break}return s;function s(a){if(!o||!o._balanced)return n(a);const u=Tt(r.sliceSerialize({start:o.end,end:r.now()}));return u.codePointAt(0)!==94||!l.includes(u.slice(1))?n(a):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(a),e.exit("gfmFootnoteCallLabelMarker"),t(a))}}function AN(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const l={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},l.start),end:Object.assign({},l.end)},s=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",l,t],["enter",o,t],["exit",o,t],["exit",l,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...s),e}function LN(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l=0,o;return s;function s(c){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),a}function a(c){return c!==94?n(c):(e.enter("gfmFootnoteCallMarker"),e.consume(c),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(c){if(l>999||c===93&&!o||c===null||c===91||pe(c))return n(c);if(c===93){e.exit("chunkString");const f=e.exit("gfmFootnoteCallString");return i.includes(Tt(r.sliceSerialize(f)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(c)}return pe(c)||(o=!0),l++,e.consume(c),c===92?d:u}function d(c){return c===91||c===92||c===93?(e.consume(c),l++,u):u(c)}}function MN(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l,o=0,s;return a;function a(x){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(x){return x===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",d):n(x)}function d(x){if(o>999||x===93&&!s||x===null||x===91||pe(x))return n(x);if(x===93){e.exit("chunkString");const v=e.exit("gfmFootnoteDefinitionLabelString");return l=Tt(r.sliceSerialize(v)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),f}return pe(x)||(s=!0),o++,e.consume(x),x===92?c:d}function c(x){return x===91||x===92||x===93?(e.consume(x),o++,d):d(x)}function f(x){return x===58?(e.enter("definitionMarker"),e.consume(x),e.exit("definitionMarker"),i.includes(l)||i.push(l),ne(e,p,"gfmFootnoteDefinitionWhitespace")):n(x)}function p(x){return t(x)}}function RN(e,t,n){return e.check(Wi,t,e.attempt(jN,t,n))}function ON(e){e.exit("gfmFootnoteDefinition")}function DN(e,t,n){const r=this;return ne(e,i,"gfmFootnoteDefinitionIndent",5);function i(l){const o=r.events[r.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(l):n(l)}}function FN(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:l,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(o,s){let a=-1;for(;++a<o.length;)if(o[a][0]==="enter"&&o[a][1].type==="strikethroughSequenceTemporary"&&o[a][1]._close){let u=a;for(;u--;)if(o[u][0]==="exit"&&o[u][1].type==="strikethroughSequenceTemporary"&&o[u][1]._open&&o[a][1].end.offset-o[a][1].start.offset===o[u][1].end.offset-o[u][1].start.offset){o[a][1].type="strikethroughSequence",o[u][1].type="strikethroughSequence";const d={type:"strikethrough",start:Object.assign({},o[u][1].start),end:Object.assign({},o[a][1].end)},c={type:"strikethroughText",start:Object.assign({},o[u][1].end),end:Object.assign({},o[a][1].start)},f=[["enter",d,s],["enter",o[u][1],s],["exit",o[u][1],s],["enter",c,s]],p=s.parser.constructs.insideSpan.null;p&&at(f,f.length,0,Ao(p,o.slice(u+1,a),s)),at(f,f.length,0,[["exit",c,s],["enter",o[a][1],s],["exit",o[a][1],s],["exit",d,s]]),at(o,u-1,a-u+3,f),a=u+f.length-2;break}}for(a=-1;++a<o.length;)o[a][1].type==="strikethroughSequenceTemporary"&&(o[a][1].type="data");return o}function l(o,s,a){const u=this.previous,d=this.events;let c=0;return f;function f(x){return u===126&&d[d.length-1][1].type!=="characterEscape"?a(x):(o.enter("strikethroughSequenceTemporary"),p(x))}function p(x){const v=Pr(u);if(x===126)return c>1?a(x):(o.consume(x),c++,p);if(c<2&&!n)return a(x);const _=o.exit("strikethroughSequenceTemporary"),m=Pr(x);return _._open=!m||m===2&&!!v,_._close=!v||v===2&&!!m,s(x)}}}class $N{constructor(){this.map=[],this.index=new Map}add(t,n,r){VN(this,t,n,r)}consume(t){if(this.map.sort(function(l,o){return l[0]-o[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let i=r.pop();for(;i;){for(const l of i)t.push(l);i=r.pop()}this.map.length=0,this.index.clear()}}function VN(e,t,n,r){if(n===0&&r.length===0)return;const i=e.index.get(t);if(i){i[1]+=n,i[2].push(...r);return}const l=[t,n,r];e.map.push(l),e.index.set(t,l)}function BN(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const l=r.length-1;r[l]=r[l]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function UN(){return{flow:{null:{name:"table",tokenize:HN,resolveAll:WN}}}}function HN(e,t,n){const r=this;let i=0,l=0,o;return s;function s(S){let z=r.events.length-1;for(;z>-1;){const{type:Q}=r.events[z][1];if(Q==="lineEnding"||Q==="linePrefix")z--;else break}const O=z>-1?r.events[z][1].type:null,U=O==="tableHead"||O==="tableRow"?b:a;return U===b&&r.parser.lazy[r.now().line]?n(S):U(S)}function a(S){return e.enter("tableHead"),e.enter("tableRow"),u(S)}function u(S){return S===124||(o=!0,l+=1),d(S)}function d(S){return S===null?n(S):B(S)?l>1?(l=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),p):n(S):Z(S)?ne(e,d,"whitespace")(S):(l+=1,o&&(o=!1,i+=1),S===124?(e.enter("tableCellDivider"),e.consume(S),e.exit("tableCellDivider"),o=!0,d):(e.enter("data"),c(S)))}function c(S){return S===null||S===124||pe(S)?(e.exit("data"),d(S)):(e.consume(S),S===92?f:c)}function f(S){return S===92||S===124?(e.consume(S),c):c(S)}function p(S){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(S):(e.enter("tableDelimiterRow"),o=!1,Z(S)?ne(e,x,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(S):x(S))}function x(S){return S===45||S===58?_(S):S===124?(o=!0,e.enter("tableCellDivider"),e.consume(S),e.exit("tableCellDivider"),v):N(S)}function v(S){return Z(S)?ne(e,_,"whitespace")(S):_(S)}function _(S){return S===58?(l+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(S),e.exit("tableDelimiterMarker"),m):S===45?(l+=1,m(S)):S===null||B(S)?C(S):N(S)}function m(S){return S===45?(e.enter("tableDelimiterFiller"),g(S)):N(S)}function g(S){return S===45?(e.consume(S),g):S===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(S),e.exit("tableDelimiterMarker"),k):(e.exit("tableDelimiterFiller"),k(S))}function k(S){return Z(S)?ne(e,C,"whitespace")(S):C(S)}function C(S){return S===124?x(S):S===null||B(S)?!o||i!==l?N(S):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(S)):N(S)}function N(S){return n(S)}function b(S){return e.enter("tableRow"),I(S)}function I(S){return S===124?(e.enter("tableCellDivider"),e.consume(S),e.exit("tableCellDivider"),I):S===null||B(S)?(e.exit("tableRow"),t(S)):Z(S)?ne(e,I,"whitespace")(S):(e.enter("data"),E(S))}function E(S){return S===null||S===124||pe(S)?(e.exit("data"),I(S)):(e.consume(S),S===92?j:E)}function j(S){return S===92||S===124?(e.consume(S),E):E(S)}}function WN(e,t){let n=-1,r=!0,i=0,l=[0,0,0,0],o=[0,0,0,0],s=!1,a=0,u,d,c;const f=new $N;for(;++n<e.length;){const p=e[n],x=p[1];p[0]==="enter"?x.type==="tableHead"?(s=!1,a!==0&&(tp(f,t,a,u,d),d=void 0,a=0),u={type:"table",start:Object.assign({},x.start),end:Object.assign({},x.end)},f.add(n,0,[["enter",u,t]])):x.type==="tableRow"||x.type==="tableDelimiterRow"?(r=!0,c=void 0,l=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,d={type:"tableBody",start:Object.assign({},x.start),end:Object.assign({},x.end)},f.add(n,0,[["enter",d,t]])),i=x.type==="tableDelimiterRow"?2:d?3:1):i&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")?(r=!1,o[2]===0&&(l[1]!==0&&(o[0]=o[1],c=kl(f,t,l,i,void 0,c),l=[0,0,0,0]),o[2]=n)):x.type==="tableCellDivider"&&(r?r=!1:(l[1]!==0&&(o[0]=o[1],c=kl(f,t,l,i,void 0,c)),l=o,o=[l[1],n,0,0])):x.type==="tableHead"?(s=!0,a=n):x.type==="tableRow"||x.type==="tableDelimiterRow"?(a=n,l[1]!==0?(o[0]=o[1],c=kl(f,t,l,i,n,c)):o[1]!==0&&(c=kl(f,t,o,i,n,c)),i=0):i&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")&&(o[3]=n)}for(a!==0&&tp(f,t,a,u,d),f.consume(t.events),n=-1;++n<t.events.length;){const p=t.events[n];p[0]==="enter"&&p[1].type==="table"&&(p[1]._align=BN(t.events,n))}return e}function kl(e,t,n,r,i,l){const o=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",s="tableContent";n[0]!==0&&(l.end=Object.assign({},or(t.events,n[0])),e.add(n[0],0,[["exit",l,t]]));const a=or(t.events,n[1]);if(l={type:o,start:Object.assign({},a),end:Object.assign({},a)},e.add(n[1],0,[["enter",l,t]]),n[2]!==0){const u=or(t.events,n[2]),d=or(t.events,n[3]),c={type:s,start:Object.assign({},u),end:Object.assign({},d)};if(e.add(n[2],0,[["enter",c,t]]),r!==2){const f=t.events[n[2]],p=t.events[n[3]];if(f[1].end=Object.assign({},p[1].end),f[1].type="chunkText",f[1].contentType="text",n[3]>n[2]+1){const x=n[2]+1,v=n[3]-n[2]-1;e.add(x,v,[])}}e.add(n[3]+1,0,[["exit",c,t]])}return i!==void 0&&(l.end=Object.assign({},or(t.events,i)),e.add(i,0,[["exit",l,t]]),l=void 0),l}function tp(e,t,n,r,i){const l=[],o=or(t.events,n);i&&(i.end=Object.assign({},o),l.push(["exit",i,t])),r.end=Object.assign({},o),l.push(["exit",r,t]),e.add(n+1,0,l)}function or(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const qN={name:"tasklistCheck",tokenize:GN};function KN(){return{text:{91:qN}}}function GN(e,t,n){const r=this;return i;function i(a){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(a):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(a),e.exit("taskListCheckMarker"),l)}function l(a){return pe(a)?(e.enter("taskListCheckValueUnchecked"),e.consume(a),e.exit("taskListCheckValueUnchecked"),o):a===88||a===120?(e.enter("taskListCheckValueChecked"),e.consume(a),e.exit("taskListCheckValueChecked"),o):n(a)}function o(a){return a===93?(e.enter("taskListCheckMarker"),e.consume(a),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),s):n(a)}function s(a){return B(a)?t(a):Z(a)?e.check({tokenize:QN},t,n)(a):n(a)}}function QN(e,t,n){return ne(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function YN(e){return Tg([wN(),zN(),FN(e),UN(),KN()])}const XN={};function JN(e){const t=this,n=e||XN,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),l=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(YN(n)),l.push(xN()),o.push(yN(n))}function ZN({text:e}){return h.jsx("div",{className:"message-markdown break-words",children:h.jsx(F_,{remarkPlugins:[JN],components:{img:({alt:t})=>h.jsxs("span",{className:"text-muted",children:["[Image: ",t||"attachment","]"]}),a:({href:t,children:n})=>h.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",children:n})},children:e})})}function eT({rows:e,startedAt:t,api:n}){const r=L.useMemo(()=>oS(e),[e]),i=e.filter(u=>u.kind==="message"&&u.eventKind==="prompt"&&u.event.image_count===0),l=L.useRef(null),[o,s]=L.useState(null);function a(u){const d=document.getElementById(`thread-${u}`);d==null||d.scrollIntoView({block:"start"}),d==null||d.focus({preventScroll:!0}),s(u)}return h.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1",children:[h.jsx("div",{ref:l,className:"min-h-0 min-w-0 flex-1 overflow-y-auto",children:h.jsxs("div",{className:"mx-auto max-w-3xl px-5 pb-16 pt-8 sm:px-8",children:[h.jsxs("div",{className:"mb-7 flex items-center justify-between gap-4 text-xs text-muted",children:[h.jsxs("span",{children:["Conversation ",h.jsx("span",{className:"px-2 text-faint",children:"/"})," ",i.length," prompts"]}),h.jsxs("button",{type:"button",className:"flex items-center gap-1.5 hover:text-foreground",onClick:()=>{l.current&&(l.current.scrollTop=l.current.scrollHeight)},children:[h.jsx(ak,{size:13,"aria-hidden":"true"})," Latest"]})]}),e.length===0?h.jsx("p",{className:"py-12 text-center text-muted",children:"No messages recorded yet."}):null,h.jsx("ol",{"data-slot":"thread-view",className:"space-y-5 text-base text-foreground",children:r.map(u=>u.kind==="message"?h.jsx("li",{id:`thread-${u.id}`,tabIndex:-1,"data-thread-kind":"message","data-event-id":u.id,className:"scroll-mt-6",children:h.jsx(wx,{row:u.row,startedAt:t,api:n})},u.id):h.jsx("li",{children:h.jsx(tT,{rows:u.rows,startedAt:t,api:n})},u.id))})]})}),i.length>1?h.jsxs("nav",{"aria-label":"Conversation outline",className:"hidden w-60 shrink-0 overflow-y-auto border-l border-border px-4 py-8 lg:block",children:[h.jsxs("p",{className:"mb-5 flex items-center gap-2 text-xs font-medium text-muted",children:[h.jsx(Rk,{size:14,"aria-hidden":"true"})," In this session"]}),h.jsx("ol",{className:"space-y-1",children:i.map((u,d)=>h.jsx("li",{children:h.jsxs("button",{type:"button",onClick:()=>a(u.event.id),"aria-current":o===u.event.id?"location":void 0,className:fe("flex w-full items-start gap-3 rounded-md px-2 py-3 text-left text-xs transition-colors hover:bg-surface-raised hover:text-foreground",o===u.event.id?"bg-span-turn/10 text-foreground":"text-muted"),children:[h.jsx("span",{className:"font-mono text-2xs text-span-turn",children:String(d+1).padStart(2,"0")}),h.jsx("span",{className:"line-clamp-3 break-words",children:u.kind==="message"?u.text||"Empty prompt":""})]})},u.event.id))}),h.jsx("p",{className:"mt-6 border-t border-border pt-4 text-2xs leading-relaxed text-muted",children:"Tool calls and reasoning are tucked into activity groups. Open any group to inspect the details."})]}):null]})}function tT({rows:e,startedAt:t,api:n}){const[r,i]=L.useState(!1);return h.jsxs("details",{"data-slot":"thread-activity",onToggle:l=>i(l.currentTarget.open),className:"rounded-md border border-dashed border-border bg-background",children:[h.jsxs("summary",{className:"flex cursor-pointer items-center gap-2.5 px-4 py-3 text-xs text-muted transition-colors hover:text-foreground",children:[h.jsx(Li,{size:14,className:"disclosure-chevron shrink-0","aria-hidden":"true"}),h.jsx(Gk,{size:14,className:"shrink-0 text-span-tool","aria-hidden":"true"}),h.jsxs("span",{className:"min-w-0 flex-1",children:[h.jsx("span",{className:"block text-xs font-medium",children:"Activity"}),h.jsx("span",{className:"mt-1 block text-2xs text-muted",children:sS(e)})]}),e.some(l=>l.kind==="tool"&&l.status==="error")?h.jsx("span",{className:"shrink-0 text-error",children:"Errors"}):null,h.jsx("span",{className:"text-2xs text-faint",children:"View activity"})]}),h.jsx("ol",{className:"border-t border-border px-4",children:e.map(l=>h.jsx("li",{"data-thread-kind":l.kind,"data-event-id":l.event.id,className:"border-b border-border py-3 last:border-b-0",children:h.jsx(nT,{row:l,startedAt:t,api:n,open:r})},l.event.id))})]})}function ii({ts:e,startedAt:t}){return h.jsx("time",{dateTime:e,className:"shrink-0 font-mono text-2xs text-muted",children:p0(e,t)})}function wx({row:e,startedAt:t,api:n,open:r=!0}){const i=e.eventKind==="prompt",l=e.eventKind==="error",o=e.eventKind==="text",s=i?"You":e.eventKind==="text"?"Claude":e.eventKind==="error"?"Session error":"Context compacted",a=i?Jk:Du;return h.jsxs("article",{className:fe("rounded-md border px-5 py-4",i?"border-span-turn/30 bg-span-turn/10":o?"border-accent/30 bg-accent-muted":"border-border bg-surface",l&&"border-error"),children:[h.jsxs("div",{className:"mb-3 flex items-center gap-2.5",children:[h.jsx("span",{className:fe("flex size-7 items-center justify-center rounded-md",i?"bg-span-turn/15 text-span-turn":"bg-accent-muted text-accent"),children:h.jsx(a,{size:15,"aria-hidden":"true"})}),h.jsx("span",{className:fe("flex-1 text-sm font-semibold",i?"text-span-turn":o?"text-accent":"text-foreground"),children:s}),i||o?h.jsx("span",{className:"text-2xs text-muted",children:i?"Prompt":"Message"}):null,h.jsx(ii,{ts:e.event.ts,startedAt:t})]}),e.text===null?h.jsx("p",{className:"text-sm text-muted",children:"No message text recorded."}):h.jsx("div",{"data-slot":"thread-message",className:"text-base leading-relaxed",children:i?h.jsx("p",{className:"whitespace-pre-wrap break-words",children:e.text}):h.jsx(ZN,{text:e.text})}),r?h.jsx(Sx,{event:e.event,api:n}):null]})}function nT({row:e,startedAt:t,api:n,open:r}){if(e.kind==="message")return h.jsx(wx,{row:e,startedAt:t,api:n,open:r});if(e.kind==="unknown")return h.jsxs("div",{children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("span",{"data-slot":"thread-unknown",className:"min-w-0 flex-1 break-words text-xs text-muted",children:e.label}),e.role===null?null:h.jsx("span",{"data-slot":"thread-record-role",className:"rounded-md bg-surface-raised px-1.5 py-0.5 font-mono text-2xs text-muted",children:e.role}),h.jsx(ii,{ts:e.event.ts,startedAt:t})]}),e.text===null?null:h.jsx("p",{"data-slot":"thread-record-text",className:"mt-1 whitespace-pre-wrap break-words text-xs text-muted",children:e.text}),h.jsxs("details",{"data-slot":"thread-raw",className:"mt-2 text-xs text-muted",children:[h.jsx("summary",{className:"cursor-pointer",children:"Raw record"}),h.jsx("pre",{className:"mt-2 whitespace-pre-wrap break-words font-mono text-2xs",children:e.record})]})]});if(e.kind==="thinking")return e.recorded?h.jsxs("details",{"data-slot":"thread-reasoning",className:"text-xs text-muted",children:[h.jsxs("summary",{className:"flex cursor-pointer items-center gap-2",children:[h.jsx(Li,{size:13,className:"disclosure-chevron","aria-hidden":"true"}),h.jsx("span",{className:"flex-1",children:"Reasoning"}),h.jsx(ii,{ts:e.event.ts,startedAt:t})]}),h.jsx("p",{"data-slot":"thread-thinking",className:"mt-3 whitespace-pre-wrap break-words text-sm text-foreground",children:e.event.text}),h.jsx(Ms,{event:e.event,field:"text",api:n})]}):h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("p",{"data-slot":"thread-thinking",className:"flex-1 text-xs text-span-thinking",children:e.text}),h.jsx(ii,{ts:e.event.ts,startedAt:t})]});const i=Te.status[e.status];return h.jsxs("div",{children:[h.jsxs("details",{"data-slot":"thread-tool-detail",className:"text-sm",children:[h.jsxs("summary",{className:"flex cursor-pointer flex-wrap items-center gap-2 text-muted hover:text-foreground",children:[h.jsx(Li,{size:13,className:"disclosure-chevron shrink-0","aria-hidden":"true"}),h.jsx("span",{"data-slot":"thread-tool",className:"min-w-0 flex-1 break-words font-mono text-foreground",children:e.name}),e.event.child_session_id?h.jsx("span",{className:"text-2xs text-span-subagent",children:e.event.agent_type||"Subagent"}):null,h.jsx("span",{className:fe("text-2xs",i.tint),children:i.label}),h.jsx(ii,{ts:e.event.ts,startedAt:t}),h.jsx(Gu,{values:Qm(e.event),showErrors:!1}),e.input?h.jsx("span",{className:"w-full truncate pl-5 font-mono text-2xs text-muted",title:e.input,children:e.input}):null]}),h.jsx(np,{slot:"thread-input",title:"Input",body:e.input}),h.jsx(Ms,{event:e.event,field:"input",api:n}),h.jsx(np,{slot:"thread-output",title:"Output",body:e.output}),h.jsx(Ms,{event:e.event,field:"text",api:n})]}),r?h.jsx(Sx,{event:e.event,api:n}):null,e.event.child_session_id?h.jsxs("a",{href:Hn({name:"session",sessionId:e.event.child_session_id}),className:"mt-3 inline-flex items-center gap-1.5 rounded-md bg-accent-muted px-3 py-2 text-xs text-accent hover:text-accent-hover",children:[h.jsx(Du,{size:14,"aria-hidden":"true"})," Open subagent thread"," ",h.jsx(ck,{size:13,"aria-hidden":"true"})]}):null]})}function Sx({event:e,api:t}){const n=lg(t,e);return h.jsx(dg,{event:e,images:n})}function np({slot:e,title:t,body:n}){return n===null?null:h.jsxs("div",{"data-slot":e,className:"mt-3",children:[h.jsx("span",{className:"text-2xs font-medium uppercase tracking-widest text-muted",children:t}),h.jsx("pre",{className:"mt-2 max-h-80 overflow-auto whitespace-pre-wrap break-words rounded-md border border-border bg-background p-3 font-mono text-xs text-muted",children:n})]})}function Ms({event:e,field:t,api:n}){const[r,i]=L.useState(null),[l,o]=L.useState(!1),[s,a]=L.useState(!1),u=ug(e,t,r),d=t==="input"?e.input:e.text,c=((d==null?void 0:d.length)??0)>480;return!u.canRefetch&&!c&&u.note===null||u.kind==="empty"?null:h.jsxs("div",{className:"mt-2 text-xs text-muted",children:[u.note?h.jsx("p",{children:u.note}):null,u.canRefetch&&n?h.jsx("button",{type:"button",disabled:l,className:"mt-2 text-accent disabled:opacity-50",onClick:()=>{o(!0),a(!1),n.getEventContent(e.id,t).then(i).catch(()=>a(!0)).finally(()=>o(!1))},children:l?"Loading…":s?"Retry loading full content":`Load full ${t==="input"?"input":"output"}`}):null,s?h.jsx("p",{role:"alert",className:"mt-1 text-error",children:"Could not load content. Try again."}):null,(c||r!==null)&&u.body!==null?h.jsxs("details",{className:"mt-2",children:[h.jsx("summary",{className:"cursor-pointer text-accent",children:u.truncated?"Stored preview":"Full content"}),h.jsx("pre",{className:"mt-2 max-h-96 overflow-auto whitespace-pre-wrap break-words rounded-md bg-background p-3 font-mono text-xs",children:u.body})]}):null]})}function rT(e){const t=W0(e);return t.length===0?null:h.jsxs("div",{"data-slot":"truncation-notice",role:"status",className:"flex items-center gap-2 border-b border-border bg-surface px-3 py-1.5 text-2xs text-warning",children:[h.jsx(vm,{size:12,"aria-hidden":"true",className:"shrink-0"}),h.jsx("span",{className:"min-w-0",children:t.join(" ")})]})}const iT=new Set(["j","k","ArrowDown","ArrowUp","ArrowLeft","ArrowRight","Home","End","Enter","Escape"]);function lT({sessionId:e,api:t,bus:n,revealSeq:r}){const i=L.useMemo(()=>t??Hu(),[t]),[l]=L.useState(()=>Date.now()),[o,s]=L.useState(0),a=Wu(e,H=>$d(i,e,{signal:H}),o),u=a.kind==="ok"?a.value:null,[d,c]=L.useState(null),f=Jm(d,e,u),[p,x]=L.useState(()=>Yd()),v=L.useCallback(H=>{x(Se=>Zw(Se,H))},[]),[_,m]=L.useReducer($0,Ym),[g,k]=L.useReducer(ow,Zm),[C,N]=L.useState(null);Q0(f,C)&&f!==null&&(N(f.session.id),x(Yd(K0(f.turns))),m({type:"reset"}),k({type:"reset"}));const b=L.useMemo(()=>Gm((f==null?void 0:f.turns)??[],(f==null?void 0:f.eventsByTurn)??new Map),[f]),I=L.useMemo(()=>U0(_),[_]),E=(f==null?void 0:f.session.id)??e,j=L.useMemo(()=>L0(b,p.expandedIds,void 0,{rootSessionId:E,subtrees:I}),[b,p.expandedIds,E,I]),S=G0(f,r),z=S===null?null:`${E}|${String(r)}`,[O,U]=L.useState(null),[Q,W]=L.useState(null);S!==null&&z!==O&&(U(z),x(H=>Jd(H,[S.turnId])),W(S));const{latch:X,revealIndex:re,selectedId:M,focusedIndex:V}=Ww(Q,j);L.useEffect(()=>{X!==Q&&(W(X),!(M===void 0||V===void 0)&&x(H=>({...H,focusedIndex:V,selectedId:M})))},[X,Q,M,V]);const[y,J]=L.useState(r===void 0?"thread":"tree"),ie=L.useMemo(()=>tS((f==null?void 0:f.events)??[]),[f]);L.useEffect(()=>{v(Y0(b,j,_))},[v,b,j,_]);const w=L.useRef({data:null,base:null});w.current={data:f,base:u},L.useEffect(()=>{if(n!==void 0)return n.subscribe(H=>{if(H.event!=="session_changed")return;const{data:Se,base:Le}=w.current,zt=ew(Se,H.data);if(zt.kind!=="ignore"){if(zt.kind==="refetch"){s(zn=>zn+1);return}Se===null||Le===null||i.getSession(e,{from_seq:zt.from_seq,limit:ja}).then(zn=>{const Qi=Z0(Se,H.data,zn);c({key:e,base:Le,data:Qi}),k({type:"appended",count:Qi.events.length-Se.events.length})}).catch(()=>{})}})},[n,i,e]);const he=L.useRef(null);L.useEffect(()=>{const H=new AbortController;return he.current=H,()=>H.abort()},[e]);const oe=V0(j,p.expandedIds,_).join(",");L.useEffect(()=>{var Se;if(oe==="")return;const H=(Se=he.current)==null?void 0:Se.signal;for(const Le of oe.split(","))m({type:"requested",childId:Le}),$d(i,Le,{limit:ja,...H===void 0?{}:{signal:H}}).then(zt=>{m({type:"loaded",childId:Le,child:zt}),x(zn=>Jd(zn,H0(zt)))}).catch(()=>{(H==null?void 0:H.aborted)!==!0&&m({type:"failed",childId:Le})})},[oe,i]);const K=L.useCallback(H=>{H.metaKey||H.ctrlKey||H.altKey||iT.has(H.key)&&(H.preventDefault(),v({type:"key",key:H.key,rows:j}))},[v,j]),Ae=L.useCallback(H=>{k({type:"selected"}),x(Se=>{const Le=j.findIndex(zt=>zt.id===H);return Le===-1?Se:{...Se,focusedIndex:Le,selectedId:H}})},[j]),nt=L.useCallback(H=>{k({type:"scrolled",atBottom:lw(H)})},[]),[ue,vt]=L.useState(null),wt=L.useCallback((H,Se)=>{i.getEventContent(H,Se).then(vt).catch(()=>{})},[i]),ft=L.useMemo(()=>{const H=j.find(Se=>Se.id===p.selectedId);return H===void 0||H.kind!=="event"?null:H.node.event},[j,p.selectedId]),[jn,nn]=L.useState(null),nr=ft==null?void 0:ft.id;L.useEffect(()=>{if(nr===void 0)return;const H=new AbortController;return i.getUnrecognisedFields(nr,{signal:H.signal}).then(nn).catch(()=>{}),()=>H.abort()},[i,nr]);const Ki=lg(i,ft),Gi=L.useCallback(H=>{k({type:"selected"}),x(Se=>{const Le=new Set(Se.expandedIds);return Le.delete(H)||Le.add(H),{...Se,expandedIds:Le}})},[]);return a.kind==="error"?h.jsx("main",{className:"p-6",children:h.jsx("p",{className:"text-sm text-error",children:a.error.message})}):h.jsxs("main",{"data-slot":"session-view",className:"flex h-full min-h-0 flex-col",children:[f===null?null:h.jsx(LS,{session:f.session,parentSessionId:f.session.parent_session_id,now:l,view:y,onViewChange:H=>{k({type:"selected"}),J(H)}}),f===null?null:h.jsx(rT,{shown:f.shown,hasMore:f.hasMore,unmatchedEventCount:b.unmatchedEventCount}),f===null?null:h.jsx(uS,{sessionId:e,hasDrift:f.session.has_drift,harnessVersion:f.session.harness_version}),h.jsx("div",{className:"flex min-h-0 flex-1",children:y==="thread"&&f!==null?h.jsx(eT,{rows:ie,startedAt:f.session.started_at,api:i},e):h.jsxs(h.Fragment,{children:[h.jsxs("div",{"data-slot":"tree-pane",className:"relative min-w-0 flex-1 border-r border-border",children:[h.jsx(lb,{rows:j,selectedId:p.selectedId,focusedIndex:p.focusedIndex,followIndex:g.following&&j.length>0?j.length-1:void 0,revealIndex:re,onScrollMetrics:nt,onKeyDown:K,onSelect:Ae,onToggle:Gi}),h.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-3 flex justify-center",children:h.jsx("div",{className:"pointer-events-auto",children:h.jsx(PS,{label:sw(g),onResume:()=>k({type:"resumed"})})})})]}),h.jsx(CS,{event:ft,fetched:ue,images:Ki,onShowFull:wt,unrecognised:jn})]})})]})}const oT={never_captured:Ak,outside_range:Tk,no_match_for_project:Uk};function sT({state:e}){const{sentence:t,hint:n}=_0(e),r=oT[e.kind];return h.jsxs("div",{"data-slot":"empty-state","data-empty-kind":e.kind,className:"flex flex-col items-center gap-2 px-8 py-16 text-center",children:[h.jsx(r,{size:24,"aria-hidden":"true",className:"text-faint"}),h.jsx("p",{className:"text-sm text-foreground",children:t}),h.jsx("p",{className:"text-xs text-muted",children:n})]})}const Rs="";function aT({range:e,onRangeChange:t,projects:n,project:r,onProjectChange:i}){return h.jsxs("div",{"data-slot":"range-control",className:"flex flex-wrap items-center justify-between gap-4",children:[h.jsxs("div",{role:"group","aria-label":"Time range",title:"Show sessions last active within this period",className:"inline-flex items-center gap-0.5 rounded-md bg-surface p-0.5",children:[h.jsx("span",{className:"px-2 text-xs text-muted",children:"Last active"}),m0.map(l=>h.jsx("button",{type:"button","aria-pressed":l===e,title:l==="all"?"Active at any time":`Active in the last ${l.slice(0,-1)} days`,onClick:()=>{t(l)},className:fe("rounded-md px-2 py-1 text-xs transition-colors",l===e?"bg-surface-raised text-foreground":"text-muted"),children:l},l))]}),h.jsxs("label",{className:"flex items-center gap-2 text-xs text-muted",children:["Project",h.jsxs("select",{value:r??Rs,onChange:l=>{const o=l.target.value;i(o===Rs?void 0:o)},className:"rounded-md border border-border bg-surface px-2 py-1 text-xs text-foreground",children:[h.jsx("option",{value:Rs,children:"All projects"}),n.map(l=>h.jsx("option",{value:l,children:l},l))]})]})]})}function uT({rows:e,sort:t,direction:n,onSortChange:r,cursor:i,now:l,pageTruncated:o=!1}){const s=h0(e,o),{dismissed:a,dismiss:u}=sg("cost-unknown");return h.jsxs("div",{"data-slot":"session-list",className:"overflow-hidden rounded-md border border-border",children:[s===null||a?null:h.jsxs("div",{"data-slot":"unpriced-notice",role:"status",className:"flex items-center gap-2 border-b border-border bg-surface px-3 py-1.5 text-2xs text-warning",children:[h.jsx(vm,{size:12,"aria-hidden":"true",className:"shrink-0"}),h.jsx("span",{className:"min-w-0",children:s}),h.jsx("button",{type:"button","aria-label":"Dismiss cost notice",title:"Dismiss until reload",onClick:u,className:"ml-auto flex size-6 shrink-0 items-center justify-center rounded-md text-muted hover:bg-surface-raised hover:text-foreground",children:h.jsx(bm,{size:14,"aria-hidden":"true"})})]}),h.jsxs("div",{className:"flex items-start justify-between gap-4 border-b border-border px-4 py-3",children:[h.jsxs("details",{className:"text-xs text-muted",children:[h.jsx("summary",{className:"cursor-pointer text-foreground",children:"What do these numbers mean?"}),h.jsxs("div",{className:"mt-2 max-w-2xl space-y-1 leading-relaxed",children:[h.jsx("p",{children:"Last active is the most recent event, in your local time. The day filters use this date."}),h.jsx("p",{children:"Elapsed runs from the first to the last event (or now for live sessions), including idle time."}),h.jsx("p",{children:"Turns counts your prompts. Errors, tokens, and estimated cost cover the main session. Tokens are input + output; cache counts are separate and not shown here."}),h.jsx("p",{children:"Subagents shows the number of agents and their additional input + output tokens. These tokens are separate from the main session totals. A dash means no measured cost or an unavailable estimate; unavailable estimates include an explanation."}),h.jsx("p",{children:"Model shows the main session’s most-used model first; +N counts other models, including sub-agents’. Hover for full ids."})]})]}),h.jsx("span",{"data-slot":"session-list-count",className:"shrink-0 text-2xs text-muted",children:Hm(e.length,o)})]}),h.jsx("p",{className:"px-4 py-2 text-2xs text-muted lg:hidden",children:"Scroll sideways to see all metrics."}),h.jsxs("div",{className:"overflow-x-auto",role:"region","aria-label":"Session list columns",tabIndex:0,children:[h.jsxs("div",{"data-slot":"session-list-header",className:"session-list-grid border-b border-border bg-surface px-4 py-3 text-2xs text-muted",children:[k0.map(d=>h.jsxs("button",{type:"button","aria-pressed":d===t,title:`Sort by ${Rd[d].toLowerCase()}`,onClick:()=>{r(d)},className:fe("text-left transition-colors",d===t?"text-foreground":"text-muted"),children:[d==="project_path"?"Session / Project":Rd[d],d===t?h.jsx(cT,{direction:n}):null]},d)),h.jsx("span",{children:"Status"}),h.jsx("span",{children:"Model"}),h.jsx("span",{className:"text-right",children:"Turns"}),h.jsx("span",{className:"text-right",children:"Subagents"}),h.jsx("span",{className:"text-right",children:"Errors"}),h.jsx("span",{className:"text-right",children:"Elapsed"}),h.jsx("span",{className:"text-right",children:"Tokens"}),h.jsx("span",{className:"text-right",children:"Est. cost"})]}),e.map((d,c)=>h.jsx(dT,{row:d,now:l,isCursor:c===i},d.id))]})]})}function cT({direction:e}){const t=e==="asc"?bk:To;return h.jsx(t,{size:12,"aria-hidden":"true",className:"inline-block"})}function dT({row:e,now:t,isCursor:n}){const r=fg[e.live?"live":"complete"],i=qm(e),l=f0(e.last_activity_at,t),o=e.rollup_state==="own",s=Rr(e.est_cost,e.model),a=c0(e.models,e.sub_models),u=e.error_count>0;return h.jsxs("a",{href:Hn({name:"session",sessionId:e.id}),"data-slot":"session-row","aria-label":`${i}, ${e.project_path}, ${r.label}, ${e.turn_count} turns, active ${l}${o?", sub-agent totals still being summed":""}`,className:fe("session-list-grid min-h-20 border-b border-border px-4 py-4 text-xs text-foreground transition-colors hover:bg-surface last:border-b-0",n&&"bg-surface-raised"),children:[h.jsxs("span",{"data-column":"session",className:"min-w-0",children:[h.jsx("span",{className:"block truncate text-sm font-medium",children:i}),h.jsx("span",{className:"mt-1.5 block truncate font-mono text-2xs text-muted",title:e.project_path,children:e.project_path})]}),h.jsx("time",{"data-column":"active",dateTime:e.last_activity_at,title:new Date(e.last_activity_at).toLocaleString(),className:"text-muted",children:l}),h.jsxs("span",{"data-column":"status",className:fe("flex items-center gap-1",r.badge),children:[h.jsx("span",{"aria-hidden":"true",className:fe("size-1.5 rounded-md",r.dot)}),r.label]}),h.jsx("span",{"data-column":"model","data-slot":"session-model",title:a.title,className:"min-w-0 truncate font-mono text-2xs text-muted",children:a.text}),h.jsx("span",{"data-column":"turns","data-slot":"session-turns",className:"text-right font-mono text-2xs text-muted",children:qt(e.turn_count)}),h.jsxs("span",{"data-column":"subagents",className:"text-right text-2xs text-muted",children:[h.jsx("span",{className:"font-mono",children:qt(e.agent_count)}),e.agent_count===0?null:o?h.jsx("span",{"data-slot":"session-subs-pending",className:"mt-1 block animate-pulse rounded-md bg-surface-raised motion-reduce:animate-none",children:"Counting tokens…"}):h.jsxs("span",{"data-slot":"session-subs",className:"mt-1 block font-mono",children:[qt(e.sub_tokens_in+e.sub_tokens_out)," tok"]})]}),h.jsx("span",{"data-column":"errors","data-slot":"session-errors","aria-label":`${e.error_count} errors`,className:fe("text-right font-mono text-2xs",u?"text-error":"text-muted"),children:qt(e.error_count)}),h.jsx("span",{"data-column":"elapsed","data-slot":"metric-duration",className:"text-right font-mono text-2xs text-muted",children:Vm(e.started_at,e.live?void 0:e.last_activity_at,t)}),h.jsx("span",{"data-column":"tokens","data-slot":"metric-tokens",className:"text-right font-mono text-2xs text-muted",children:qt(e.tokens_in+e.tokens_out)}),h.jsx("span",{"data-slot":"metric-cost",title:s,"aria-label":s,"data-column":"cost",className:fe("text-right font-mono text-2xs",s===void 0?"text-muted":"text-faint"),children:Mi(e.est_cost)})]})}const Ua=2;function fT({buckets:e}){const t=e.reduce((n,r)=>Math.max(n,r.count),0);return h.jsx("div",{"data-slot":"volume-histogram",role:"img","aria-label":`Session volume: ${e.reduce((n,r)=>n+r.count,0)} in range`,className:"flex h-12 items-end gap-0.5",children:e.map(n=>h.jsx("span",{"data-slot":"volume-bucket","data-count":n.count,style:{height:`${t===0?Ua:pT(n.count,t)}%`},className:"flex-1 rounded-md bg-accent-muted"},n.start))})}function pT(e,t){return e===0?Ua:Math.max(Ua,Math.round(e/t*100))}const hT=40;function mT({router:e=rg(),api:t,bus:n}={}){const[r,i]=L.useState("3d"),[l,o]=L.useState(void 0),[s,a]=L.useState("last_activity_at"),[u,d]=L.useState("desc"),[c,f]=L.useState(-1),p=L.useMemo(()=>t??Hu(),[t]),[x]=L.useState(()=>Date.now()),v=`${r}|${l??""}`,_=Wu(v,E=>x0(p,{range:r,now:x,project:l,signal:E})),m=_.kind==="ok"?_.value:null,[g,k]=L.useState(null),C=Jm(g,v,m),N=L.useRef({data:null,base:null});N.current={data:C,base:m},L.useEffect(()=>{if(n!==void 0)return n.subscribe(E=>{if(E.event!=="session_changed")return;const{data:j,base:S}=N.current;if(j===null||S===null)return;const z=rw(j,E.data.session_id,E.data.rollups,Date.now());z!==j&&k({key:v,base:S,data:z})})},[n,v]);const b=L.useMemo(()=>C===null?[]:v0(C,{project:l,sort:s,direction:u}),[C,l,s,u]);L.useEffect(()=>{const E=j=>{const S=j.target,z=(S==null?void 0:S.isContentEditable)===!0||["INPUT","TEXTAREA","SELECT"].includes((S==null?void 0:S.tagName)??""),O=I0(j.key,{index:c,rowCount:b.length,inEditable:z});if(O.kind==="ignore")return;j.preventDefault();const U=N0(O,b,e);U!==null&&f(U)};return window.addEventListener("keydown",E),()=>{window.removeEventListener("keydown",E)}},[c,b,e]);const I=C===null?null:E0(C,b,{project:l});return h.jsxs(gT,{children:[h.jsxs("div",{className:"mb-2",children:[h.jsx("p",{className:"mb-2 text-xs font-medium text-accent",children:"YOUR WORK, REVISITED"}),h.jsx("h1",{className:"text-xl font-semibold",children:"Sessions"}),h.jsx("p",{className:"mt-2 text-base text-muted",children:"Pick up the thread. Explore what you asked, what Claude answered, and how it got there."})]}),h.jsx(fT,{buckets:b0((C==null?void 0:C.sessions)??[],{range:r,now:x,bucketCount:hT})}),h.jsx(aT,{range:r,onRangeChange:i,projects:C===null?[]:w0(C.sessions),project:l,onProjectChange:o}),_.kind==="error"?h.jsx("p",{className:"text-sm text-error",children:_.error.message}):I===null?null:I.kind==="none"?h.jsx(uT,{rows:b,sort:s,direction:u,onSortChange:E=>{d(E===s&&u==="desc"?"asc":"desc"),a(E)},cursor:c,now:x,pageTruncated:(C==null?void 0:C.truncated)??!1}):h.jsx(sT,{state:I})]})}function gT({children:e}){return h.jsx("main",{className:"mx-auto flex max-w-7xl flex-col gap-4 px-5 py-8 sm:px-8",children:e})}const Oo=[{cssVar:"--color-background",specValue:"#0b0b0e",specLine:64,prosePin:"#0b0b0e",emits:"var",utilityClass:"bg-background"},{cssVar:"--color-surface",specValue:"#131318",specLine:65,prosePin:"#131318",emits:"var",utilityClass:"bg-surface"},{cssVar:"--color-surface-raised",specValue:"#1b1b22",specLine:66,prosePin:"#1b1b22",emits:"var",utilityClass:"bg-surface-raised"},{cssVar:"--color-border",specValue:"#26262e",specLine:67,prosePin:"#26262e",emits:"var",utilityClass:"bg-border"},{cssVar:"--color-foreground",specValue:"#ededf0",specLine:68,prosePin:"#ededf0",emits:"var",utilityClass:"bg-foreground"},{cssVar:"--color-muted",specValue:"#9b9ba6",specLine:69,prosePin:"#9b9ba6",emits:"var",utilityClass:"bg-muted"},{cssVar:"--color-faint",specValue:"#5c5c66",specLine:70,prosePin:"#5c5c66",emits:"var",utilityClass:"bg-faint"},{cssVar:"--color-accent",specValue:"#7c8cf8",specLine:73,prosePin:"#7c8cf8",emits:"var",utilityClass:"bg-accent"},{cssVar:"--color-accent-hover",specValue:"#97a3fa",specLine:74,prosePin:"#97a3fa",emits:"var",utilityClass:"bg-accent-hover"},{cssVar:"--color-accent-muted",specValue:"#7c8cf826",specLine:75,prosePin:"#7c8cf826",emits:"var",utilityClass:"bg-accent-muted"},{cssVar:"--color-span-turn",specValue:"#2dd4bf",specLine:78,prosePin:"#2dd4bf",emits:"var",utilityClass:"bg-span-turn"},{cssVar:"--color-span-llm",specValue:"#c084fc",specLine:79,prosePin:"#c084fc",emits:"var",utilityClass:"bg-span-llm"},{cssVar:"--color-span-tool",specValue:"#60a5fa",specLine:80,prosePin:"#60a5fa",emits:"var",utilityClass:"bg-span-tool"},{cssVar:"--color-span-subagent",specValue:"#818cf8",specLine:81,prosePin:"#818cf8",emits:"var",utilityClass:"bg-span-subagent"},{cssVar:"--color-span-thinking",specValue:"#9b9ba6",specLine:82,prosePin:"#9b9ba6",emits:"var",utilityClass:"bg-span-thinking"},{cssVar:"--color-span-generic",specValue:"#a3e635",specLine:83,prosePin:"#a3e635",emits:"var",utilityClass:"bg-span-generic"},{cssVar:"--color-success",specValue:"#4ade80",specLine:86,prosePin:"#4ade80",emits:"var",utilityClass:"bg-success"},{cssVar:"--color-warning",specValue:"#fbbf24",specLine:87,prosePin:"#fbbf24",emits:"var",utilityClass:"bg-warning"},{cssVar:"--color-error",specValue:"#f87171",specLine:88,prosePin:"#f87171",emits:"var",utilityClass:"bg-error"},{cssVar:"--color-running",specValue:"#7c8cf8",specLine:89,prosePin:"#7c8cf8",emits:"var",utilityClass:"bg-running"},{cssVar:"--text-2xs",specValue:"11px",specLine:101,prosePin:"11 (dense chips/timestamps)",emits:"var",utilityClass:"text-2xs"},{cssVar:"--text-xs",specValue:"12px",specLine:101,prosePin:"12 (tree metadata, table cells)",emits:"var",utilityClass:"text-xs"},{cssVar:"--text-sm",specValue:"13px",specLine:101,prosePin:"13 (UI base)",emits:"var",utilityClass:"text-sm"},{cssVar:"--text-base",specValue:"14px",specLine:101,prosePin:"14 (reading)",emits:"var",utilityClass:"text-base"},{cssVar:"--text-lg",specValue:"16px",specLine:101,prosePin:"16 (pane titles)",emits:"var",utilityClass:"text-lg"},{cssVar:"--text-xl",specValue:"20px",specLine:101,prosePin:"20 (page titles)",emits:"var",utilityClass:"text-xl"},{cssVar:"--text-2xs--line-height",specValue:"1.3",specLine:107,prosePin:"1.3",emits:"var-fallback",utilityClass:"text-2xs"},{cssVar:"--text-xs--line-height",specValue:"1.3",specLine:108,prosePin:"1.3",emits:"var-fallback",utilityClass:"text-xs"},{cssVar:"--text-sm--line-height",specValue:"1.3",specLine:109,prosePin:"1.3",emits:"var-fallback",utilityClass:"text-sm"},{cssVar:"--text-base--line-height",specValue:"1.45",specLine:110,prosePin:"1.45",emits:"var-fallback",utilityClass:"text-base"},{cssVar:"--text-lg--line-height",specValue:"1.45",specLine:111,prosePin:"1.45",emits:"var-fallback",utilityClass:"text-lg"},{cssVar:"--text-xl--line-height",specValue:"1.3",specLine:112,prosePin:"1.3",emits:"var-fallback",utilityClass:"text-xl"},{cssVar:"--radius-md",specValue:"6px",specLine:120,prosePin:"6px",emits:"var",utilityClass:"rounded-md"},{cssVar:"--radius-lg",specValue:"8px",specLine:120,prosePin:"8px",emits:"var",utilityClass:"rounded-lg"},{cssVar:"--shadow-float",specValue:"0 8px 24px rgb(0 0 0 / 0.5)",specLine:124,prosePin:"0 8px 24px rgb(0 0 0 / 0.5)",emits:"inline",utilityClass:"shadow-float"},{cssVar:"--font-sans",specValue:"'Inter', ui-sans-serif, system-ui, sans-serif",specLine:96,prosePin:"Inter",emits:"var",utilityClass:"font-sans"},{cssVar:"--font-mono",specValue:"'JetBrains Mono', ui-monospace, 'SF Mono', monospace",specLine:97,prosePin:"JetBrains Mono",emits:"var",utilityClass:"font-mono"},{cssVar:"--default-transition-duration",specValue:"150ms",specLine:128,prosePin:"150ms",emits:"var-fallback",utilityClass:"transition-colors"},{cssVar:"--default-transition-timing-function",specValue:"cubic-bezier(0.4, 0, 0.2, 1)",specLine:128,prosePin:"cubic-bezier(0.4, 0, 0.2, 1)",emits:"var-fallback",utilityClass:"transition-colors"},{cssVar:"--animate-live-pulse",specValue:"live-pulse 1.5s ease-in-out infinite",specLine:129,prosePin:"1.5s ease-in-out",emits:"var",utilityClass:"animate-live-pulse"},{cssVar:"--animate-row-arrive",specValue:"row-arrive 300ms ease-out 1",specLine:129,prosePin:"300ms",emits:"var",utilityClass:"animate-row-arrive"}],xT=e=>e.cssVar.endsWith("--line-height"),yT=Oo.filter(e=>e.cssVar.startsWith("--color-")),kT=Oo.filter(e=>e.cssVar.startsWith("--text-")&&!xT(e)),vT=e=>{var t;return((t=Oo.find(n=>n.cssVar===`${e}--line-height`))==null?void 0:t.specValue)??""},wT=Oo.filter(e=>e.cssVar.startsWith("--radius-"));function sn({title:e,note:t,children:n}){return h.jsxs("section",{className:"border-b border-border py-8",children:[h.jsx("h2",{className:"text-lg font-semibold text-foreground",children:e}),h.jsx("p",{className:"mt-1 text-xs text-faint",children:t}),h.jsx("div",{className:"mt-4",children:n})]})}function rp({token:e}){return h.jsxs("div",{className:"mt-2",children:[h.jsx("div",{className:"font-mono text-2xs text-muted",children:e.cssVar}),h.jsx("div",{className:"font-mono text-2xs text-faint",children:e.specValue}),e.utilityClass!==null&&h.jsxs("div",{className:"font-mono text-2xs text-accent",children:[".",e.utilityClass]})]})}function ST(){return h.jsxs("main",{className:"mx-auto max-w-5xl px-8 py-12",children:[h.jsxs("header",{children:[h.jsx("h1",{className:"text-xl font-semibold text-foreground",children:"agent-lens design tokens"}),h.jsxs("p",{className:"mt-2 text-sm text-muted",children:["Every token in ",h.jsx("span",{className:"font-mono text-2xs",children:"spec/design-system.md"}),", rendered through the utility class that emits it. This page is the reference — copy class names from here, and if a colour or size you want is missing, it is missing on purpose."]})]}),h.jsx(sn,{title:"Color",note:"Neutrals carry the layout, span-type colors carry meaning, the accent only marks interactivity. Tailwind's default palette is cleared — bg-red-500 does not exist.",children:h.jsx("div",{className:"grid grid-cols-2 gap-4 sm:grid-cols-3 lg:grid-cols-4",children:yT.map(e=>h.jsxs("div",{children:[h.jsx("div",{className:`h-16 rounded-md border border-border ${e.utilityClass??""}`,"aria-hidden":"true"}),h.jsx(rp,{token:e})]},e.cssVar))})}),h.jsx(sn,{title:"Type scale",note:"Six steps, 11px to 20px, each with its own line-height. Nothing larger exists — text-3xl does not compile.",children:h.jsx("div",{className:"space-y-5",children:kT.map(e=>h.jsxs("div",{className:"flex items-baseline gap-6",children:[h.jsxs("span",{className:"w-28 shrink-0 font-mono text-2xs text-faint",children:[e.specValue," / ",vT(e.cssVar)]}),h.jsxs("div",{children:[h.jsx("p",{className:e.utilityClass??"",children:"Inspect everything your agent did in a session."}),h.jsxs("div",{className:"font-mono text-2xs text-accent",children:[".",e.utilityClass]})]})]},e.cssVar))})}),h.jsx(sn,{title:"Font families",note:"Both self-hosted and bundled. Mono is ~40% of rendered text in this product — a first-class citizen, not an accent.",children:h.jsxs("div",{className:"space-y-5",children:[h.jsxs("div",{children:[h.jsx("p",{className:"font-sans text-base text-foreground",children:"Inter — the quick brown fox jumps over the lazy dog 0123456789"}),h.jsx("div",{className:"font-mono text-2xs text-accent",children:".font-sans"})]}),h.jsxs("div",{children:[h.jsx("p",{className:"font-mono text-base text-foreground",children:"JetBrains Mono — 1.02s · 185 tok · <$0.001 · sess_01J8XZ"}),h.jsx("div",{className:"font-mono text-2xs text-accent",children:".font-mono"})]})]})}),h.jsx(sn,{title:"Radius",note:"rounded-md everywhere; rounded-lg for floating surfaces only.",children:h.jsx("div",{className:"flex gap-8",children:wT.map(e=>h.jsxs("div",{children:[h.jsx("div",{className:`h-20 w-20 bg-surface-raised border border-border ${e.utilityClass??""}`,"aria-hidden":"true"}),h.jsx(rp,{token:e})]},e.cssVar))})}),h.jsxs(sn,{title:"Shadow",note:"One level, floating surfaces only. In-flow surfaces separate with borders, never shadows.",children:[h.jsxs("div",{className:"w-72 rounded-lg bg-surface-raised p-4 shadow-float",children:[h.jsx("p",{className:"text-sm text-foreground",children:"Floating surface"}),h.jsx("p",{className:"mt-1 text-xs text-muted",children:"Modals, popovers, context menus."})]}),h.jsx("div",{className:"font-mono text-2xs text-accent mt-2",children:".shadow-float"})]}),h.jsx(sn,{title:"Motion",note:"150ms default. The running pulse loops; row arrival washes once. Both stop under prefers-reduced-motion.",children:h.jsxs("div",{className:"flex flex-wrap items-center gap-8",children:[h.jsxs("div",{children:[h.jsxs("span",{className:"inline-flex items-center gap-2 rounded-md bg-surface-raised px-2 py-1",children:[h.jsx("span",{className:"h-2 w-2 rounded-full bg-running animate-live-pulse","aria-hidden":"true"}),h.jsx("span",{className:"font-mono text-2xs text-muted",children:"live"})]}),h.jsx("div",{className:"font-mono text-2xs text-accent mt-2",children:".animate-live-pulse"})]}),h.jsxs("div",{children:[h.jsx("div",{className:"rounded-md px-3 py-1.5 animate-row-arrive",children:h.jsx("span",{className:"font-mono text-2xs text-muted",children:"new row arrived"})}),h.jsx("div",{className:"font-mono text-2xs text-accent mt-2",children:".animate-row-arrive"})]}),h.jsxs("div",{children:[h.jsx("button",{type:"button",className:"rounded-md border border-border bg-surface px-3 py-1.5 text-sm text-foreground transition-colors hover:bg-surface-raised",children:"Hover me"}),h.jsx("div",{className:"font-mono text-2xs text-accent mt-2",children:".transition-colors"})]})]})}),h.jsx(sn,{title:"Span-type vocabulary",note:"How the span palette reads in situ — the atom every tree row and thread card is built from.",children:h.jsx("div",{className:"rounded-md border border-border bg-surface",children:[{label:"turn",dot:"bg-span-turn",name:"user turn"},{label:"llm",dot:"bg-span-llm",name:"claude-opus-4 completion"},{label:"tool",dot:"bg-span-tool",name:"Read(src/server/app.ts)"},{label:"subagent",dot:"bg-span-subagent",name:"Explore subagent"},{label:"thinking",dot:"bg-span-thinking",name:"thinking"},{label:"generic",dot:"bg-span-generic",name:"foreign span"}].map(e=>h.jsxs("div",{className:"flex items-center gap-3 border-b border-border px-3 py-1.5 last:border-b-0",children:[h.jsx("span",{className:`h-2 w-2 rounded-full ${e.dot}`,"aria-hidden":"true"}),h.jsx("span",{className:"text-xs text-foreground",children:e.name}),h.jsx("span",{className:"ml-auto font-mono text-2xs text-muted",children:"1.02s · 185 tok · $0.004"})]},e.label))})}),h.jsx(sn,{title:"Status",note:"Status is never conveyed by color alone — every one of these pairs with an icon or a word in the real UI.",children:h.jsx("div",{className:"flex flex-wrap gap-3",children:[{cls:"text-success",label:"complete"},{cls:"text-warning",label:"degraded"},{cls:"text-error",label:"failed"},{cls:"text-running",label:"running"}].map(e=>h.jsx("span",{className:`rounded-md bg-surface-raised px-2 py-1 font-mono text-2xs ${e.cls}`,children:e.label},e.label))})})]})}function bT({router:e,api:t}={}){const n=Rw(e),r=L.useMemo(()=>aw(),[]);return zw(r),h.jsx(Gv,{children:n.name==="showcase"?h.jsx(ST,{}):n.name==="search"?h.jsx(Gw,{...n.sessionId===void 0?{}:{sessionId:n.sessionId},...t===void 0?{}:{api:t}}):n.name==="session"||n.name==="trace"||n.name==="event"?h.jsx(lT,{sessionId:n.sessionId,bus:r,...n.name==="event"?{revealSeq:n.seq}:{},...t===void 0?{}:{api:t}},`${n.sessionId}:${n.name==="event"?n.seq:"session"}`):h.jsx(mT,{bus:r,...e===void 0?{}:{router:e},...t===void 0?{}:{api:t}})})}const bx=document.getElementById("root");if(!bx)throw new Error("Root element #root not found");ym(bx).render(h.jsx(L.StrictMode,{children:h.jsx(bT,{})}));
|
package/ui/dist/index.html
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
comments verbatim, so it survives the build. Do not remove or rename:
|
|
13
13
|
`injectToken` throws without it, and the UI would 401 on every call. -->
|
|
14
14
|
<!--agent-lens-bootstrap-->
|
|
15
|
-
<script type="module" crossorigin src="/assets/index-
|
|
15
|
+
<script type="module" crossorigin src="/assets/index-De9wOnVP.js"></script>
|
|
16
16
|
<link rel="stylesheet" crossorigin href="/assets/index-CNZgKRsc.css">
|
|
17
17
|
</head>
|
|
18
18
|
<body style="background-color: #0b0b0e">
|