@peasant-labs/fairtrade 0.0.7 → 0.0.10

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/lib/graph.js CHANGED
@@ -1,17 +1,17 @@
1
- import { A as e, C as t, E as n, S as r, T as i, _ as a, b as o, d as s, f as c, g as l, h as u, l as d, m as f, n as p, p as m, r as h, s as g, t as _, u as v, v as y, w as b, x, y as S } from "./InUseShell-VRWaysXY.js";
2
- import { useMemo as C, useRef as w, useState as T } from "react";
3
- import { Fragment as E, jsx as D, jsxs as O } from "react/jsx-runtime";
4
- import { Box as k, Check as A, ChevronDown as j, ChevronRight as M, Coins as N, CornerDownRight as P, FileCode as F, FileDiff as I, FileText as L, Folder as R, GitMerge as z, Hash as ee, Map as B, MessageSquare as V, RotateCw as H, Search as U, Share2 as te, Tag as W, TriangleAlert as G, X as K } from "lucide-react";
5
- import { AllChangeBindings as ne, AllDiffLineKinds as re, AllEdgeViolationKinds as ie, AllFileChangeStatuses as ae, AllMapNodeKinds as oe, ChangeBinding as se, DiffLineKind as ce, EdgeViolationKind as le, FileChangeStatus as ue, MapNodeKind as de, isChangeBinding as fe, isDiffLineKind as pe, isEdgeViolationKind as me, isFileChangeStatus as he, isMapNodeKind as ge } from "@peasant-labs/schema";
1
+ import { $ as e, A as t, B as n, C as r, D as i, E as a, F as o, G as s, H as c, I as l, J as u, K as d, L as f, M as p, N as m, O as h, P as g, Q as _, R as v, S as y, T as b, U as x, V as S, W as C, X as w, Y as T, Z as E, _ as D, at as O, b as k, ct as A, d as j, et as ee, f as M, g as N, h as P, j as F, k as I, l as te, m as L, n as R, p as z, q as B, r as ne, s as re, t as ie, tt as ae, u as oe, ut as se, v as ce, w as le, x as ue, y as de, z as fe } from "./InUseShell-CY5Acw6t.js";
2
+ import { useCallback as pe, useEffect as me, useMemo as V, useRef as H, useState as U } from "react";
3
+ import { Fragment as he, jsx as W, jsxs as G } from "react/jsx-runtime";
4
+ import { Box as ge, Check as _e, ChevronDown as ve, ChevronRight as K, Coins as ye, CornerDownRight as be, FileCode as xe, FileDiff as Se, FileText as Ce, Folder as we, GitMerge as Te, Hash as Ee, Map as De, MessageSquare as Oe, RotateCw as ke, Search as Ae, Share2 as je, Tag as Me, TriangleAlert as Ne, X as Pe } from "lucide-react";
5
+ import { AllChangeBindings as Fe, AllDiffLineKinds as Ie, AllEdgeViolationKinds as Le, AllFileChangeStatuses as Re, AllInsightKinds as ze, AllInsightProvenances as Be, AllMapNodeKinds as Ve, AllReadAttributionStates as He, AllReadStateGrades as Ue, ChangeBinding as We, DiffLineKind as Ge, EdgeViolationKind as Ke, FileChangeStatus as qe, InsightKind as Je, InsightProvenance as Ye, MapNodeKind as Xe, ReadAttributionState as Ze, ReadStateGrade as Qe, isChangeBinding as $e, isDiffLineKind as et, isEdgeViolationKind as tt, isFileChangeStatus as nt, isInsightKind as rt, isInsightProvenance as it, isMapNodeKind as at, isReadAttributionState as ot, isReadStateGrade as st } from "@peasant-labs/schema";
6
6
  //#region src/ui/graph/changeGraph.js
7
- var q = 6e4, J = 60 * q, Y = 24 * J, _e = 7 * Y;
8
- function X(e, t) {
7
+ var ct = 6e4, q = 60 * ct, J = 24 * q, lt = 7 * J;
8
+ function Y(e, t) {
9
9
  if (e == null) return "";
10
10
  let n = Math.max(0, t - e);
11
- return n < J ? `${Math.max(1, Math.floor(n / q))}m ago` : n < Y ? `${Math.floor(n / J)}h ago` : n < _e ? `${Math.floor(n / Y)}d ago` : `${Math.floor(n / _e)}wk ago`;
11
+ return n < q ? `${Math.max(1, Math.floor(n / ct))}m ago` : n < J ? `${Math.floor(n / q)}h ago` : n < lt ? `${Math.floor(n / J)}d ago` : `${Math.floor(n / lt)}wk ago`;
12
12
  }
13
- function ve(e, { nowMs: t }) {
14
- let n = e.recentCommits ?? [], r = e.changes ?? [], i = e.defaultBranch, a = e.sessions ?? [], o = new Map(a.map((e) => [e.sessionId, e])), s = new Set(n.flatMap((e) => e.sessionIds ?? [])), c = r.filter((e) => !e.merged).slice().sort((e, t) => ye(t) - ye(e) || e.branch.localeCompare(t.branch)), l = r.filter((e) => e.merged && !e.reverted), u = r.filter((e) => e.merged && e.reverted), d = new Map(l.filter((e) => e.mergeCommitHash).map((e) => [e.mergeCommitHash, e])), f = c.map((e, t) => ({
13
+ function ut(e, { nowMs: t }) {
14
+ let n = e.recentCommits ?? [], r = e.changes ?? [], i = e.defaultBranch, a = e.sessions ?? [], o = new Map(a.map((e) => [e.sessionId, e])), s = new Set(n.flatMap((e) => e.sessionIds ?? [])), c = r.filter((e) => !e.merged).slice().sort((e, t) => dt(t) - dt(e) || e.branch.localeCompare(t.branch)), l = r.filter((e) => e.merged && !e.reverted), u = r.filter((e) => e.merged && e.reverted), d = new Map(l.filter((e) => e.mergeCommitHash).map((e) => [e.mergeCommitHash, e])), f = c.map((e, t) => ({
15
15
  change: e,
16
16
  lane: t + 1,
17
17
  baseHash: e.baseHash,
@@ -31,7 +31,7 @@ function ve(e, { nowMs: t }) {
31
31
  branch: i.branch,
32
32
  session: (i.sessionCount ?? 0) > 0,
33
33
  tip: !0,
34
- time: X(n.tipMs, t)
34
+ time: Y(n.tipMs, t)
35
35
  });
36
36
  }
37
37
  };
@@ -50,13 +50,13 @@ function ve(e, { nowMs: t }) {
50
50
  return t ? [t] : [];
51
51
  }),
52
52
  merged: c ? !0 : void 0,
53
- time: X(e.timeMs, t)
53
+ time: Y(e.timeMs, t)
54
54
  });
55
55
  }), h(-Infinity);
56
56
  let g = u.map((e) => ({
57
57
  branch: e.branch,
58
58
  mergedAtMs: e.mergedAtMs ?? null,
59
- when: X(e.mergedAtMs, t)
59
+ when: Y(e.mergedAtMs, t)
60
60
  })), _ = a.filter((e) => e.hasCommitBinding === !0 && !s.has(e.sessionId));
61
61
  return {
62
62
  commits: p,
@@ -67,108 +67,122 @@ function ve(e, { nowMs: t }) {
67
67
  outsideWindowSessions: _
68
68
  };
69
69
  }
70
- function ye(e) {
70
+ function dt(e) {
71
71
  return e.tipCommitMs ?? Infinity;
72
72
  }
73
73
  //#endregion
74
74
  //#region src/ui/graph/Changes.jsx
75
- function be({ payload: t, projectLabel: r, selectedId: i, onNavigate: a, onSelectChange: o, onOpenMap: s, hasMore: c = !1, onShowOlder: l, onOpenSession: u, nowMs: d }) {
76
- let f = d ?? Date.now(), { commits: p, reverted: m, unlinkedSessions: h, outsideWindowSessions: g, openCount: _, mergedCount: v } = C(() => ve(t, { nowMs: f }), [t, f]), y = t.defaultBranch;
77
- return /* @__PURE__ */ O("div", {
75
+ function ft({ payload: e, projectLabel: t, selectedId: n, onNavigate: r, onSelectChange: i, onOpenMap: a, hasMore: o = !1, onShowOlder: s, onOpenSession: c, nowMs: l }) {
76
+ let u = l ?? Date.now(), { commits: d, reverted: f, unlinkedSessions: p, outsideWindowSessions: m, openCount: h, mergedCount: g } = V(() => ut(e, { nowMs: u }), [e, u]), _ = e.defaultBranch, v = V(() => new Set(d.filter((e) => (e.sessionRefs?.length ?? 0) > 2).map((e) => e.id)), [d]), [y, b] = U([]);
77
+ me(() => {
78
+ b((e) => {
79
+ let t = e.filter((e) => v.has(e));
80
+ return t.length === e.length ? e : t;
81
+ });
82
+ }, [v]);
83
+ let x = pe((e) => {
84
+ v.has(e) && b((t) => {
85
+ let n = new Set(t);
86
+ return n.has(e) ? n.delete(e) : n.add(e), [...n];
87
+ });
88
+ }, [v]);
89
+ return /* @__PURE__ */ G("div", {
78
90
  className: "gmp-root gmp-changes-root",
79
- children: [/* @__PURE__ */ O("div", {
91
+ children: [/* @__PURE__ */ G("div", {
80
92
  className: "gmp-changes-head",
81
- children: [/* @__PURE__ */ O("div", { children: [r && /* @__PURE__ */ O("span", {
93
+ children: [/* @__PURE__ */ G("div", { children: [t && /* @__PURE__ */ G("span", {
82
94
  className: "label",
83
- children: ["lines of work · ", r]
84
- }), /* @__PURE__ */ O("div", {
95
+ children: ["lines of work · ", t]
96
+ }), /* @__PURE__ */ G("div", {
85
97
  className: "gmp-changes-sub mono",
86
98
  children: [
87
- y ? `default branch ${y} · ` : "",
88
- _,
99
+ _ ? `default branch ${_} · ` : "",
100
+ h,
89
101
  " open · ",
90
- v,
102
+ g,
91
103
  " merged"
92
104
  ]
93
- })] }), /* @__PURE__ */ O("button", {
105
+ })] }), /* @__PURE__ */ G("button", {
94
106
  type: "button",
95
107
  className: "btn btn-secondary btn-sm",
96
108
  onClick: () => {
97
- a ? a({ type: "open-map" }) : s?.();
109
+ r ? r({ type: "open-map" }) : a?.();
98
110
  },
99
- children: [/* @__PURE__ */ D(k, {
111
+ children: [/* @__PURE__ */ W(ge, {
100
112
  size: 14,
101
113
  "aria-hidden": "true"
102
114
  }), " open the map"]
103
115
  })]
104
- }), /* @__PURE__ */ O("div", {
116
+ }), /* @__PURE__ */ G("div", {
105
117
  className: "gmp-changes-body",
106
118
  children: [
107
- /* @__PURE__ */ D(n, {
119
+ /* @__PURE__ */ W(T, {
108
120
  className: "gmp-cg",
109
- commits: p,
110
- selectedId: i,
121
+ commits: d,
122
+ selectedId: n,
111
123
  label: "default-branch commit history",
112
- onNavigate: a,
113
- onSelect: (e) => o?.(e),
114
- onOpenSession: u,
115
- hasMore: c,
116
- onShowOlder: l
124
+ onNavigate: r,
125
+ onSelect: (e) => i?.(e),
126
+ onOpenSession: c,
127
+ hasMore: o,
128
+ onShowOlder: s,
129
+ expandedCommitSessions: y,
130
+ onToggleCommitSessions: x
117
131
  }),
118
- h.length > 0 && /* @__PURE__ */ O("section", {
132
+ p.length > 0 && /* @__PURE__ */ G("section", {
119
133
  className: "gmp-unlinked-sessions",
120
134
  "aria-labelledby": "gmp-unlinked-sessions-heading",
121
- children: [/* @__PURE__ */ D("h2", {
135
+ children: [/* @__PURE__ */ W("h2", {
122
136
  id: "gmp-unlinked-sessions-heading",
123
137
  className: "sb-head gmp-unlinked-sessions-head",
124
138
  children: "sessions not linked to a commit"
125
- }), /* @__PURE__ */ D("div", {
139
+ }), /* @__PURE__ */ W("div", {
126
140
  className: "gmp-unlinked-sessions-list",
127
- children: h.map((t) => /* @__PURE__ */ O("button", {
141
+ children: p.map((e) => /* @__PURE__ */ G("button", {
128
142
  type: "button",
129
143
  className: "gmp-unlinked-session",
130
144
  onClick: () => {
131
- a ? a({
145
+ r ? r({
132
146
  type: "open-session",
133
- sessionId: t.sessionId,
147
+ sessionId: e.sessionId,
134
148
  source: { kind: "unlinked" }
135
- }) : u?.(t.sessionId);
149
+ }) : c?.(e.sessionId);
136
150
  },
137
- children: [/* @__PURE__ */ D(e, { harness: t.harness }), /* @__PURE__ */ D("span", { children: t.title || t.sessionId })]
138
- }, t.sessionId))
151
+ children: [/* @__PURE__ */ W(O, { harness: e.harness }), /* @__PURE__ */ W("span", { children: e.title || e.sessionId })]
152
+ }, e.sessionId))
139
153
  })]
140
154
  }),
141
- g.length > 0 && /* @__PURE__ */ O("section", {
155
+ m.length > 0 && /* @__PURE__ */ G("section", {
142
156
  className: "gmp-unlinked-sessions",
143
157
  "aria-labelledby": "gmp-outside-window-sessions-heading",
144
- children: [/* @__PURE__ */ D("h2", {
158
+ children: [/* @__PURE__ */ W("h2", {
145
159
  id: "gmp-outside-window-sessions-heading",
146
160
  className: "sb-head gmp-unlinked-sessions-head",
147
161
  children: "sessions linked outside this visible commit window"
148
- }), /* @__PURE__ */ D("div", {
162
+ }), /* @__PURE__ */ W("div", {
149
163
  className: "gmp-unlinked-sessions-list",
150
- children: g.map((t) => /* @__PURE__ */ O("button", {
164
+ children: m.map((e) => /* @__PURE__ */ G("button", {
151
165
  type: "button",
152
166
  className: "gmp-unlinked-session",
153
167
  onClick: () => {
154
- a ? a({
168
+ r ? r({
155
169
  type: "open-session",
156
- sessionId: t.sessionId,
170
+ sessionId: e.sessionId,
157
171
  source: { kind: "outside-window" }
158
- }) : u?.(t.sessionId);
172
+ }) : c?.(e.sessionId);
159
173
  },
160
- children: [/* @__PURE__ */ D(e, { harness: t.harness }), /* @__PURE__ */ D("span", { children: t.title || t.sessionId })]
161
- }, t.sessionId))
174
+ children: [/* @__PURE__ */ W(O, { harness: e.harness }), /* @__PURE__ */ W("span", { children: e.title || e.sessionId })]
175
+ }, e.sessionId))
162
176
  })]
163
177
  }),
164
- m.length > 0 && /* @__PURE__ */ O("div", {
178
+ f.length > 0 && /* @__PURE__ */ G("div", {
165
179
  className: "gmp-merged-sec",
166
- children: [/* @__PURE__ */ D("div", {
180
+ children: [/* @__PURE__ */ W("div", {
167
181
  className: "sb-head gmp-merged-head",
168
182
  children: "already merged in"
169
- }), /* @__PURE__ */ D("div", {
183
+ }), /* @__PURE__ */ W("div", {
170
184
  className: "gmp-merged-list",
171
- children: m.map((e) => /* @__PURE__ */ O("button", {
185
+ children: f.map((e) => /* @__PURE__ */ G("button", {
172
186
  type: "button",
173
187
  className: "gmp-merged-chip gmp-merged-revert",
174
188
  onClick: () => {
@@ -176,16 +190,16 @@ function be({ payload: t, projectLabel: r, selectedId: i, onNavigate: a, onSelec
176
190
  id: `revert:${e.branch}`,
177
191
  branch: e.branch
178
192
  };
179
- a ? a({
193
+ r ? r({
180
194
  type: "open-change",
181
195
  change: {
182
196
  id: t.id,
183
197
  branch: t.branch
184
198
  }
185
- }) : o?.(t);
199
+ }) : i?.(t);
186
200
  },
187
201
  children: [
188
- /* @__PURE__ */ D(z, {
202
+ /* @__PURE__ */ W(Te, {
189
203
  size: 13,
190
204
  "aria-hidden": "true"
191
205
  }),
@@ -197,12 +211,12 @@ function be({ payload: t, projectLabel: r, selectedId: i, onNavigate: a, onSelec
197
211
  }, e.branch))
198
212
  })]
199
213
  }),
200
- /* @__PURE__ */ O("div", {
214
+ /* @__PURE__ */ G("div", {
201
215
  className: "gmp-changes-legend",
202
216
  children: [
203
- /* @__PURE__ */ O("span", {
217
+ /* @__PURE__ */ G("span", {
204
218
  className: "gmp-legend-item",
205
- children: [/* @__PURE__ */ D("span", {
219
+ children: [/* @__PURE__ */ W("span", {
206
220
  className: "cg-dot cg-dot-filled",
207
221
  style: {
208
222
  width: 9,
@@ -211,9 +225,9 @@ function be({ payload: t, projectLabel: r, selectedId: i, onNavigate: a, onSelec
211
225
  "aria-hidden": "true"
212
226
  }), " commit with a recorded session"]
213
227
  }),
214
- /* @__PURE__ */ O("span", {
228
+ /* @__PURE__ */ G("span", {
215
229
  className: "gmp-legend-item",
216
- children: [/* @__PURE__ */ D("span", {
230
+ children: [/* @__PURE__ */ W("span", {
217
231
  className: "cg-dot cg-dot-hollow",
218
232
  style: {
219
233
  width: 9,
@@ -222,7 +236,7 @@ function be({ payload: t, projectLabel: r, selectedId: i, onNavigate: a, onSelec
222
236
  "aria-hidden": "true"
223
237
  }), " no session captured"]
224
238
  }),
225
- /* @__PURE__ */ D("span", {
239
+ /* @__PURE__ */ W("span", {
226
240
  className: "gmp-legend-item gmp-legend-dim",
227
241
  children: "a filled dot also flies a sparkle · select a commit to open it"
228
242
  })
@@ -234,29 +248,29 @@ function be({ payload: t, projectLabel: r, selectedId: i, onNavigate: a, onSelec
234
248
  }
235
249
  //#endregion
236
250
  //#region src/ui/graph/ChangeDetail.jsx
237
- var xe = {
251
+ var pt = {
238
252
  M: "changed",
239
253
  A: "added",
240
254
  D: "deleted",
241
255
  R: "renamed"
242
- }, Se = {
256
+ }, mt = {
243
257
  A: "chip-ok",
244
258
  M: "",
245
259
  D: "chip-err",
246
260
  R: "chip-warn"
247
- }, Ce = {
261
+ }, ht = {
248
262
  context: "ctx",
249
263
  add: "add",
250
264
  del: "del"
251
265
  };
252
- function we(e) {
266
+ function gt(e) {
253
267
  let t = (e.split("/").pop() ?? e).replace(/[-_]+/g, " ").trim();
254
268
  return t.charAt(0).toUpperCase() + t.slice(1);
255
269
  }
256
- var Te = (e) => e >= 1e3 ? `≈${(e / 1e3).toFixed(1)}k` : String(e);
257
- function Ee(e) {
270
+ var _t = (e) => e >= 1e3 ? `≈${(e / 1e3).toFixed(1)}k` : String(e);
271
+ function vt(e) {
258
272
  let t = e.oldStart, n = e.newStart, r = e.lines.map((e) => {
259
- let r = Ce[e.kind] ?? "ctx";
273
+ let r = ht[e.kind] ?? "ctx";
260
274
  return r === "add" ? {
261
275
  type: r,
262
276
  newNo: n++,
@@ -277,103 +291,103 @@ function Ee(e) {
277
291
  lines: r
278
292
  };
279
293
  }
280
- function De({ file: e, diff: n, open: r, onToggle: a }) {
281
- n && t(n);
282
- let o = e.status, s = n ? new Set(n.hunks.map((e) => e.sessionId).filter(Boolean)).size : null;
283
- return /* @__PURE__ */ O("div", {
294
+ function yt({ file: e, diff: t, open: n, onToggle: r }) {
295
+ t && d(t);
296
+ let i = e.status, a = t ? new Set(t.hunks.map((e) => e.sessionId).filter(Boolean)).size : null;
297
+ return /* @__PURE__ */ G("div", {
284
298
  className: "gmp-file",
285
- children: [/* @__PURE__ */ O("button", {
299
+ children: [/* @__PURE__ */ G("button", {
286
300
  type: "button",
287
301
  className: "gmp-file-head",
288
- "aria-expanded": r,
289
- onClick: a,
302
+ "aria-expanded": n,
303
+ onClick: r,
290
304
  children: [
291
- D(r ? j : M, {
305
+ W(n ? ve : K, {
292
306
  size: 14,
293
307
  "aria-hidden": "true"
294
308
  }),
295
- /* @__PURE__ */ D("span", {
309
+ /* @__PURE__ */ W("span", {
296
310
  className: "mono gmp-file-path",
297
311
  children: e.path
298
312
  }),
299
- /* @__PURE__ */ D("span", {
300
- className: "chip gmp-file-status " + (Se[o] ?? ""),
301
- children: xe[o] ?? o
313
+ /* @__PURE__ */ W("span", {
314
+ className: "chip gmp-file-status " + (mt[i] ?? ""),
315
+ children: pt[i] ?? i
302
316
  }),
303
- s != null && s > 0 && /* @__PURE__ */ O("span", {
317
+ a != null && a > 0 && /* @__PURE__ */ G("span", {
304
318
  className: "gmp-file-convos metaitem",
305
319
  children: [
306
- /* @__PURE__ */ D(V, {
320
+ /* @__PURE__ */ W(Oe, {
307
321
  size: 13,
308
322
  "aria-hidden": "true"
309
323
  }),
310
324
  " ",
311
- /* @__PURE__ */ D("span", {
325
+ /* @__PURE__ */ W("span", {
312
326
  className: "tnum",
313
- children: s
327
+ children: a
314
328
  })
315
329
  ]
316
330
  })
317
331
  ]
318
- }), r && /* @__PURE__ */ D("div", {
332
+ }), n && /* @__PURE__ */ W("div", {
319
333
  className: "gmp-file-body",
320
- children: n ? n.error ? /* @__PURE__ */ D("p", {
334
+ children: t ? t.error ? /* @__PURE__ */ W("p", {
321
335
  className: "gmp-diff-state gmp-diff-error mono",
322
- children: n.error
323
- }) : n.binary ? /* @__PURE__ */ D("p", {
336
+ children: t.error
337
+ }) : t.binary ? /* @__PURE__ */ W("p", {
324
338
  className: "gmp-diff-state mono",
325
339
  children: "binary file — no textual diff."
326
- }) : n.hunks.length === 0 ? /* @__PURE__ */ D("p", {
340
+ }) : t.hunks.length === 0 ? /* @__PURE__ */ W("p", {
327
341
  className: "gmp-diff-state mono",
328
342
  children: "no line changes."
329
- }) : n.hunks.map((e, t) => /* @__PURE__ */ O("div", {
343
+ }) : t.hunks.map((e, n) => /* @__PURE__ */ G("div", {
330
344
  className: "gmp-hunk",
331
345
  children: [
332
- e.sessionTitle && /* @__PURE__ */ O("div", {
346
+ e.sessionTitle && /* @__PURE__ */ G("div", {
333
347
  className: "gmp-hunk-attrib",
334
348
  children: [
335
- /* @__PURE__ */ D(P, {
349
+ /* @__PURE__ */ W(be, {
336
350
  size: 13,
337
351
  "aria-hidden": "true"
338
352
  }),
339
- /* @__PURE__ */ D("span", {
353
+ /* @__PURE__ */ W("span", {
340
354
  className: "gmp-hunk-from",
341
355
  children: "from"
342
356
  }),
343
- /* @__PURE__ */ D("span", {
357
+ /* @__PURE__ */ W("span", {
344
358
  className: "gmp-hunk-link",
345
359
  children: e.sessionTitle
346
360
  }),
347
- e.sessionId && /* @__PURE__ */ D("span", {
361
+ e.sessionId && /* @__PURE__ */ W("span", {
348
362
  className: "mono gmp-hunk-hash",
349
363
  children: e.sessionId.slice(0, 7)
350
364
  })
351
365
  ]
352
366
  }),
353
- /* @__PURE__ */ D(i, {
367
+ /* @__PURE__ */ W(u, {
354
368
  file: "",
355
- hunks: [Ee(e)],
369
+ hunks: [vt(e)],
356
370
  className: "gmp-hunk-diff"
357
371
  }),
358
- n.truncated && t === n.hunks.length - 1 && /* @__PURE__ */ D("p", {
372
+ t.truncated && n === t.hunks.length - 1 && /* @__PURE__ */ W("p", {
359
373
  className: "gmp-diff-state mono",
360
374
  children: "diff truncated (file exceeds the size cap)."
361
375
  })
362
376
  ]
363
- }, t)) : /* @__PURE__ */ D("p", {
377
+ }, n)) : /* @__PURE__ */ W("p", {
364
378
  className: "gmp-diff-state mono",
365
379
  children: "loading diff…"
366
380
  })
367
381
  })]
368
382
  });
369
383
  }
370
- function Oe({ payload: e, getDiff: t, title: n, annotation: i = "", onSaveAnnotation: a, onRemoveAnnotation: o, onOpenMap: s, onShare: c, onCopyRecap: l, initialOpenFiles: u = {} }) {
371
- r(e);
372
- let [d, f] = T(u), [p, m] = T(null), [h, g] = T(!1), [_, v] = T(""), y = w({}), b = w(null), x = n ?? we(e.branch), S = e.work.length, C = e.newEdges.length, E = e.removedEdges.length, j = (e) => f((t) => ({
384
+ function bt({ payload: e, getDiff: t, title: n, annotation: r = "", onSaveAnnotation: i, onRemoveAnnotation: a, onOpenMap: o, onShare: c, onCopyRecap: l, initialOpenFiles: u = {} }) {
385
+ s(e);
386
+ let [d, f] = U(u), [p, m] = U(null), [h, g] = U(!1), [_, v] = U(""), y = H({}), b = H(null), x = n ?? gt(e.branch), S = e.work.length, C = e.newEdges.length, w = e.removedEdges.length, T = (e) => f((t) => ({
373
387
  ...t,
374
388
  [e]: !t[e]
375
389
  }));
376
- function P(e, t) {
390
+ function E(e, t) {
377
391
  if (m(e), t) {
378
392
  f((e) => ({
379
393
  ...e,
@@ -389,106 +403,106 @@ function Oe({ payload: e, getDiff: t, title: n, annotation: i = "", onSaveAnnota
389
403
  }
390
404
  }
391
405
  }
392
- function F(e) {
406
+ function D(e) {
393
407
  e.preventDefault();
394
408
  let t = _.trim();
395
- t && a?.(t), g(!1), v("");
409
+ t && i?.(t), g(!1), v("");
396
410
  }
397
- let R = e.files[0]?.path;
398
- return /* @__PURE__ */ O("div", {
411
+ let O = e.files[0]?.path;
412
+ return /* @__PURE__ */ G("div", {
399
413
  className: "gmp-root gmp-detail-root",
400
414
  ref: b,
401
415
  children: [
402
- /* @__PURE__ */ O("div", {
416
+ /* @__PURE__ */ G("div", {
403
417
  className: "gmp-detail-head",
404
418
  children: [
405
- /* @__PURE__ */ O("div", {
419
+ /* @__PURE__ */ G("div", {
406
420
  className: "crumb",
407
421
  children: [
408
422
  "review ",
409
- /* @__PURE__ */ D(M, {
423
+ /* @__PURE__ */ W(K, {
410
424
  size: 13,
411
425
  "aria-hidden": "true"
412
426
  }),
413
427
  " ",
414
428
  e.defaultBranch,
415
429
  " ",
416
- /* @__PURE__ */ D(M, {
430
+ /* @__PURE__ */ W(K, {
417
431
  size: 13,
418
432
  "aria-hidden": "true"
419
433
  }),
420
434
  " ",
421
- /* @__PURE__ */ D("span", {
435
+ /* @__PURE__ */ W("span", {
422
436
  className: "cur",
423
437
  children: e.branch
424
438
  })
425
439
  ]
426
440
  }),
427
- /* @__PURE__ */ D("div", {
441
+ /* @__PURE__ */ W("div", {
428
442
  className: "gmp-detail-title",
429
443
  children: x
430
444
  }),
431
- /* @__PURE__ */ O("p", {
445
+ /* @__PURE__ */ G("p", {
432
446
  className: "gmp-caption",
433
447
  children: [
434
448
  "this line of work touched",
435
449
  " ",
436
- /* @__PURE__ */ O("button", {
450
+ /* @__PURE__ */ G("button", {
437
451
  type: "button",
438
452
  className: "gmp-frag" + (p === "files" ? " gmp-frag-on" : ""),
439
- onClick: () => P("files", R),
453
+ onClick: () => E("files", O),
440
454
  children: [e.filesChanged, " files"]
441
455
  }),
442
456
  " ",
443
457
  "across",
444
458
  " ",
445
- /* @__PURE__ */ O("button", {
459
+ /* @__PURE__ */ G("button", {
446
460
  type: "button",
447
461
  className: "gmp-frag" + (p === "conversations" ? " gmp-frag-on" : ""),
448
- onClick: () => P("conversations"),
462
+ onClick: () => E("conversations"),
449
463
  children: [S, " conversations"]
450
464
  }),
451
465
  ", reshaping",
452
466
  " ",
453
- /* @__PURE__ */ O("button", {
467
+ /* @__PURE__ */ G("button", {
454
468
  type: "button",
455
469
  className: "gmp-frag" + (p === "conn" ? " gmp-frag-on" : ""),
456
- onClick: () => P("conn"),
470
+ onClick: () => E("conn"),
457
471
  children: [
458
472
  "+",
459
473
  C,
460
474
  "/−",
461
- E,
475
+ w,
462
476
  " connections"
463
477
  ]
464
478
  }),
465
479
  "."
466
480
  ]
467
481
  }),
468
- /* @__PURE__ */ D("span", {
482
+ /* @__PURE__ */ W("span", {
469
483
  className: "gmp-caption-hint mono",
470
484
  children: "click any number to jump to its proof"
471
485
  })
472
486
  ]
473
487
  }),
474
- (e.frictions.length > 0 || e.violations.length > 0) && /* @__PURE__ */ O("div", {
488
+ (e.frictions.length > 0 || e.violations.length > 0) && /* @__PURE__ */ G("div", {
475
489
  className: "gmp-signals",
476
- children: [e.frictions.map((e, t) => /* @__PURE__ */ O("span", {
490
+ children: [e.frictions.map((e, t) => /* @__PURE__ */ G("span", {
477
491
  className: "gmp-signal",
478
492
  children: [
479
- /* @__PURE__ */ D(H, {
493
+ /* @__PURE__ */ W(ke, {
480
494
  size: 14,
481
495
  "aria-hidden": "true"
482
496
  }),
483
497
  " ",
484
498
  e.label,
485
499
  " · ",
486
- /* @__PURE__ */ D("span", {
500
+ /* @__PURE__ */ W("span", {
487
501
  className: "mono",
488
502
  children: e.file
489
503
  }),
490
504
  " ",
491
- /* @__PURE__ */ O("b", {
505
+ /* @__PURE__ */ G("b", {
492
506
  className: "tnum",
493
507
  children: [e.count, "×"]
494
508
  }),
@@ -496,15 +510,15 @@ function Oe({ payload: e, getDiff: t, title: n, annotation: i = "", onSaveAnnota
496
510
  e.sessions,
497
511
  " conversations"
498
512
  ]
499
- }, t)), e.violations.length > 0 && /* @__PURE__ */ O("span", {
513
+ }, t)), e.violations.length > 0 && /* @__PURE__ */ G("span", {
500
514
  className: "gmp-signal gmp-signal-warn",
501
515
  children: [
502
- /* @__PURE__ */ D(G, {
516
+ /* @__PURE__ */ W(Ne, {
503
517
  size: 14,
504
518
  "aria-hidden": "true"
505
519
  }),
506
520
  " ",
507
- /* @__PURE__ */ D("b", {
521
+ /* @__PURE__ */ W("b", {
508
522
  className: "tnum",
509
523
  children: e.violations.length
510
524
  }),
@@ -512,13 +526,13 @@ function Oe({ payload: e, getDiff: t, title: n, annotation: i = "", onSaveAnnota
512
526
  ]
513
527
  })]
514
528
  }),
515
- /* @__PURE__ */ O("div", {
529
+ /* @__PURE__ */ G("div", {
516
530
  className: "gmp-totals",
517
531
  children: [
518
- /* @__PURE__ */ O("span", {
532
+ /* @__PURE__ */ G("span", {
519
533
  className: "metaitem tnum",
520
534
  children: [
521
- /* @__PURE__ */ D(I, {
535
+ /* @__PURE__ */ W(Se, {
522
536
  size: 14,
523
537
  "aria-hidden": "true"
524
538
  }),
@@ -527,37 +541,37 @@ function Oe({ payload: e, getDiff: t, title: n, annotation: i = "", onSaveAnnota
527
541
  " files touched"
528
542
  ]
529
543
  }),
530
- /* @__PURE__ */ O("span", {
544
+ /* @__PURE__ */ G("span", {
531
545
  className: "metaitem tnum",
532
546
  children: [
533
- /* @__PURE__ */ O("span", {
547
+ /* @__PURE__ */ G("span", {
534
548
  className: "gmp-add",
535
549
  children: ["+", C]
536
550
  }),
537
551
  "/",
538
- /* @__PURE__ */ O("span", {
552
+ /* @__PURE__ */ G("span", {
539
553
  className: "gmp-del",
540
- children: ["−", E]
554
+ children: ["−", w]
541
555
  }),
542
556
  " connections"
543
557
  ]
544
558
  }),
545
- /* @__PURE__ */ O("span", {
559
+ /* @__PURE__ */ G("span", {
546
560
  className: "metaitem tnum",
547
561
  children: [
548
- /* @__PURE__ */ D(ee, {
562
+ /* @__PURE__ */ W(Ee, {
549
563
  size: 14,
550
564
  "aria-hidden": "true"
551
565
  }),
552
566
  " ai wrote ",
553
- Te(Number(e.outputTokens)),
567
+ _t(Number(e.outputTokens)),
554
568
  " tokens"
555
569
  ]
556
570
  }),
557
- e.costUsd != null && /* @__PURE__ */ O("span", {
571
+ e.costUsd != null && /* @__PURE__ */ G("span", {
558
572
  className: "metaitem tnum",
559
573
  children: [
560
- /* @__PURE__ */ D(N, {
574
+ /* @__PURE__ */ W(ye, {
561
575
  size: 14,
562
576
  "aria-hidden": "true"
563
577
  }),
@@ -567,78 +581,78 @@ function Oe({ payload: e, getDiff: t, title: n, annotation: i = "", onSaveAnnota
567
581
  })
568
582
  ]
569
583
  }),
570
- /* @__PURE__ */ O("div", {
584
+ /* @__PURE__ */ G("div", {
571
585
  className: "gmp-detail-sec",
572
- children: [/* @__PURE__ */ D("div", {
586
+ children: [/* @__PURE__ */ W("div", {
573
587
  className: "sb-head gmp-detail-sechead",
574
588
  children: "files changed · click a path to open its diff"
575
- }), /* @__PURE__ */ D("div", {
589
+ }), /* @__PURE__ */ W("div", {
576
590
  className: "gmp-files",
577
- children: e.files.map((e) => /* @__PURE__ */ D("div", {
591
+ children: e.files.map((e) => /* @__PURE__ */ W("div", {
578
592
  ref: (t) => {
579
593
  y.current[e.path] = t;
580
594
  },
581
- children: /* @__PURE__ */ D(De, {
595
+ children: /* @__PURE__ */ W(yt, {
582
596
  file: e,
583
597
  diff: d[e.path] ? t?.(e) : void 0,
584
598
  open: !!d[e.path],
585
- onToggle: () => j(e.path)
599
+ onToggle: () => T(e.path)
586
600
  })
587
601
  }, e.path))
588
602
  })]
589
603
  }),
590
- /* @__PURE__ */ O("div", {
604
+ /* @__PURE__ */ G("div", {
591
605
  className: "gmp-detail-sec",
592
- children: [/* @__PURE__ */ D("div", {
606
+ children: [/* @__PURE__ */ W("div", {
593
607
  className: "sb-head gmp-detail-sechead",
594
608
  children: "your annotation"
595
- }), /* @__PURE__ */ O("div", {
609
+ }), /* @__PURE__ */ G("div", {
596
610
  className: "gmp-annot",
597
611
  children: [
598
- i && /* @__PURE__ */ O("span", {
612
+ r && /* @__PURE__ */ G("span", {
599
613
  className: "gmp-label-chip gmp-annot-chip",
600
614
  children: [
601
- /* @__PURE__ */ D(W, {
615
+ /* @__PURE__ */ W(Me, {
602
616
  size: 12,
603
617
  "aria-hidden": "true"
604
618
  }),
605
619
  " ",
606
- i,
607
- /* @__PURE__ */ D("button", {
620
+ r,
621
+ /* @__PURE__ */ W("button", {
608
622
  type: "button",
609
623
  className: "gmp-annot-x",
610
624
  "aria-label": "remove annotation",
611
- onClick: () => o?.(),
612
- children: /* @__PURE__ */ D(K, {
625
+ onClick: () => a?.(),
626
+ children: /* @__PURE__ */ W(Pe, {
613
627
  size: 11,
614
628
  "aria-hidden": "true"
615
629
  })
616
630
  })
617
631
  ]
618
632
  }),
619
- /* @__PURE__ */ O("button", {
633
+ /* @__PURE__ */ G("button", {
620
634
  type: "button",
621
635
  className: "gmp-annot-add",
622
636
  "aria-expanded": h,
623
637
  onClick: () => g((e) => !e),
624
638
  children: [
625
- /* @__PURE__ */ D(W, {
639
+ /* @__PURE__ */ W(Me, {
626
640
  size: 13,
627
641
  "aria-hidden": "true"
628
642
  }),
629
643
  " ",
630
- i ? "change label" : "add a label"
644
+ r ? "change label" : "add a label"
631
645
  ]
632
646
  }),
633
- h && /* @__PURE__ */ O("form", {
647
+ h && /* @__PURE__ */ G("form", {
634
648
  className: "gmp-annot-pop",
635
- onSubmit: F,
649
+ onSubmit: D,
636
650
  children: [
637
- /* @__PURE__ */ D("span", {
651
+ /* @__PURE__ */ W("span", {
638
652
  className: "label",
639
653
  children: "user.custom_label"
640
654
  }),
641
- /* @__PURE__ */ D("input", {
655
+ /* @__PURE__ */ W("input", {
642
656
  className: "input",
643
657
  type: "text",
644
658
  autoFocus: !0,
@@ -647,17 +661,17 @@ function Oe({ payload: e, getDiff: t, title: n, annotation: i = "", onSaveAnnota
647
661
  placeholder: "e.g. good handoff",
648
662
  "aria-label": "annotation value"
649
663
  }),
650
- /* @__PURE__ */ O("div", {
664
+ /* @__PURE__ */ G("div", {
651
665
  className: "gmp-annot-pop-foot",
652
- children: [/* @__PURE__ */ D("button", {
666
+ children: [/* @__PURE__ */ W("button", {
653
667
  type: "button",
654
668
  className: "btn btn-ghost btn-sm",
655
669
  onClick: () => g(!1),
656
670
  children: "cancel"
657
- }), /* @__PURE__ */ O("button", {
671
+ }), /* @__PURE__ */ G("button", {
658
672
  type: "submit",
659
673
  className: "btn btn-primary btn-sm",
660
- children: [/* @__PURE__ */ D(A, {
674
+ children: [/* @__PURE__ */ W(_e, {
661
675
  size: 13,
662
676
  "aria-hidden": "true"
663
677
  }), " save"]
@@ -668,24 +682,24 @@ function Oe({ payload: e, getDiff: t, title: n, annotation: i = "", onSaveAnnota
668
682
  ]
669
683
  })]
670
684
  }),
671
- /* @__PURE__ */ O("div", {
685
+ /* @__PURE__ */ G("div", {
672
686
  className: "gmp-exits",
673
687
  children: [
674
- /* @__PURE__ */ O("button", {
688
+ /* @__PURE__ */ G("button", {
675
689
  type: "button",
676
690
  className: "btn btn-secondary btn-sm",
677
- onClick: () => s?.(),
678
- children: [/* @__PURE__ */ D(k, {
691
+ onClick: () => o?.(),
692
+ children: [/* @__PURE__ */ W(ge, {
679
693
  size: 14,
680
694
  "aria-hidden": "true"
681
695
  }), " see this work on the code map"]
682
696
  }),
683
- /* @__PURE__ */ O("button", {
697
+ /* @__PURE__ */ G("button", {
684
698
  type: "button",
685
699
  className: "btn btn-secondary btn-sm",
686
700
  onClick: () => c?.(),
687
701
  children: [
688
- /* @__PURE__ */ D(te, {
702
+ /* @__PURE__ */ W(je, {
689
703
  size: 14,
690
704
  "aria-hidden": "true"
691
705
  }),
@@ -694,16 +708,16 @@ function Oe({ payload: e, getDiff: t, title: n, annotation: i = "", onSaveAnnota
694
708
  " conversations…"
695
709
  ]
696
710
  }),
697
- /* @__PURE__ */ O("button", {
711
+ /* @__PURE__ */ G("button", {
698
712
  type: "button",
699
713
  className: "btn btn-secondary btn-sm",
700
714
  onClick: () => l?.(),
701
- children: [/* @__PURE__ */ D(L, {
715
+ children: [/* @__PURE__ */ W(Ce, {
702
716
  size: 14,
703
717
  "aria-hidden": "true"
704
718
  }), " copy recap"]
705
719
  }),
706
- /* @__PURE__ */ O("code", {
720
+ /* @__PURE__ */ G("code", {
707
721
  className: "gmp-gitdiff mono",
708
722
  children: [
709
723
  "git diff ",
@@ -714,7 +728,7 @@ function Oe({ payload: e, getDiff: t, title: n, annotation: i = "", onSaveAnnota
714
728
  })
715
729
  ]
716
730
  }),
717
- /* @__PURE__ */ D("p", {
731
+ /* @__PURE__ */ W("p", {
718
732
  className: "gmp-boundary mono",
719
733
  children: "shows what changed and the recorded work behind it, not whether the change is correct or secure."
720
734
  })
@@ -723,77 +737,77 @@ function Oe({ payload: e, getDiff: t, title: n, annotation: i = "", onSaveAnnota
723
737
  }
724
738
  //#endregion
725
739
  //#region src/ui/graph/CodeMap.jsx
726
- var ke = Object.freeze({
740
+ var xt = Object.freeze({
727
741
  project: "overview",
728
742
  package: "folders",
729
743
  file: "files"
730
- }), Ae = Object.freeze({
744
+ }), St = Object.freeze({
731
745
  overview: "project",
732
746
  folders: "package",
733
747
  files: "file"
734
748
  });
735
- function je({ payload: e, zoom: t, onZoomChange: n, selectedId: r, onSelect: i, onExpand: a, highlightedIds: o, nodeDeltas: s, structureEdgeDeltas: u, height: p = 520, ariaLabel: h = "code map", className: g = "", viewport: _, onViewportChange: v, state: y, onStateChange: b }) {
736
- let x = C(() => {
749
+ function Ct({ payload: e, zoom: t, onZoomChange: n, selectedId: r, onSelect: i, onExpand: a, highlightedIds: o, nodeDeltas: s, structureEdgeDeltas: c, height: l = 520, ariaLabel: u = "code map", className: d = "", viewport: f, onViewportChange: p, state: m, onStateChange: h }) {
750
+ let g = V(() => {
737
751
  let t = /* @__PURE__ */ new Map();
738
752
  for (let n of e?.nodes ?? []) t.set(n.id, n);
739
753
  return t;
740
- }, [e?.nodes]), S = C(() => y === void 0 ? null : m(y), [y]), T = C(() => S ? f(e, S) : null, [e, S]), E = C(() => Me(e && {
754
+ }, [e?.nodes]), _ = V(() => m === void 0 ? null : z(m), [m]), v = V(() => _ ? L(e, _) : null, [e, _]), y = V(() => wt(e && {
741
755
  ...e,
742
- nodes: T?.canvas.allNodes ?? e.nodes
743
- }), [e, T?.canvas.allNodes]), O = T ? ke[T.canvas.grain] ?? "folders" : ke[t?.level ?? "package"], k = T?.canvas.expandedIds ?? t?.expanded, A = w(O);
744
- A.current = O;
745
- function j(e) {
746
- if (!S) return;
747
- let t = l(S, e);
748
- c(S, t) || b?.(t);
756
+ nodes: v?.canvas.allNodes ?? e.nodes
757
+ }), [e, v?.canvas.allNodes]), b = v ? xt[v.canvas.grain] ?? "folders" : xt[t?.level ?? "package"], x = v?.canvas.expandedIds ?? t?.expanded, S = H(b);
758
+ S.current = b;
759
+ function C(e) {
760
+ if (!_) return;
761
+ let t = D(_, e);
762
+ M(_, t) || h?.(t);
749
763
  }
750
- return /* @__PURE__ */ D(d, {
751
- data: E,
752
- grain: O,
753
- expandedIds: k,
754
- visibleIds: T?.canvas.visibleIds,
755
- hierarchy: T?.canvas.hierarchy,
756
- selectedId: T ? T.canvas.selectedId : r,
764
+ return /* @__PURE__ */ W(te, {
765
+ data: y,
766
+ grain: b,
767
+ expandedIds: x,
768
+ visibleIds: v?.canvas.visibleIds,
769
+ hierarchy: v?.canvas.hierarchy,
770
+ selectedId: v ? v.canvas.selectedId : r,
757
771
  highlightedIds: o,
758
772
  nodeDeltas: s,
759
- edgeDeltas: u,
773
+ edgeDeltas: c,
760
774
  onSelect: (e) => {
761
- i?.(e, e ? x.get(e) ?? null : null);
775
+ i?.(e, e ? g.get(e) ?? null : null);
762
776
  },
763
777
  onExpand: a,
764
778
  onGrainChange: (e) => {
765
- A.current = e, n?.({
766
- level: Ae[e] ?? "package",
779
+ S.current = e, n?.({
780
+ level: St[e] ?? "package",
767
781
  expanded: []
768
782
  });
769
783
  },
770
784
  onExpandedIdsChange: (e) => {
771
785
  n?.({
772
- level: Ae[A.current] ?? "package",
786
+ level: St[S.current] ?? "package",
773
787
  expanded: e
774
788
  });
775
789
  },
776
- height: p,
777
- ariaLabel: h,
778
- className: g,
779
- viewport: T ? T.canvas.viewport : _,
790
+ height: l,
791
+ ariaLabel: u,
792
+ className: d,
793
+ viewport: v ? v.canvas.viewport : f,
780
794
  onViewportChange: (e) => {
781
- v?.(e);
795
+ p?.(e);
782
796
  },
783
- onStateAction: S ? j : void 0,
784
- canonicalControlled: S !== null
797
+ onStateAction: _ ? C : void 0,
798
+ canonicalControlled: _ !== null
785
799
  });
786
800
  }
787
- function Me(e) {
788
- e && b(e);
789
- let t = e?.nodes ?? [], n = Pe(e?.violations ?? []);
801
+ function wt(e) {
802
+ e && B(e);
803
+ let t = e?.nodes ?? [], n = Et(e?.violations ?? []);
790
804
  return {
791
805
  nodes: t.map((e) => ({
792
806
  id: e.id,
793
807
  label: e.name || e.id,
794
808
  kind: e.kind === "file" ? "file" : "folder",
795
809
  loc: e.loc ?? 0,
796
- coverage: Ne(e.recordedFiles, e.totalFiles),
810
+ coverage: Tt(e.recordedFiles, e.totalFiles),
797
811
  parent: e.parent || void 0,
798
812
  violations: n.get(e.id) ?? 0,
799
813
  layer: e.layer,
@@ -807,96 +821,96 @@ function Me(e) {
807
821
  }))
808
822
  };
809
823
  }
810
- function Ne(e, t) {
824
+ function Tt(e, t) {
811
825
  let n = Number(t) || 0;
812
826
  if (n <= 0) return 0;
813
827
  let r = Math.max(0, Math.min(1, (Number(e) || 0) / n));
814
828
  return Math.max(0, Math.min(4, Math.round(r * 4)));
815
829
  }
816
- function Pe(e) {
830
+ function Et(e) {
817
831
  let t = /* @__PURE__ */ new Map();
818
- for (let n of e) Fe(t, n.from), Fe(t, n.to);
832
+ for (let n of e) Dt(t, n.from), Dt(t, n.to);
819
833
  return t;
820
834
  }
821
- function Fe(e, t) {
835
+ function Dt(e, t) {
822
836
  t && e.set(t, (e.get(t) ?? 0) + 1);
823
837
  }
824
838
  //#endregion
825
839
  //#region src/ui/graph/CodeMapNavigator.jsx
826
- function Ie({ payload: e, grain: t = "package", expandedIds: n, onExpandedIdsChange: r, selectedId: i = null, onSelect: a, focusedId: o, onFocusChange: s, filter: c = "", onFilterChange: l, onOpenMap: u, onStateAction: d, ariaLabel: p = "code map navigator" }) {
827
- let [h, g] = T(() => /* @__PURE__ */ new Set()), [_, v] = T(null), y = n === void 0 ? h : new Set(n), b = o === void 0 ? _ : o, x = w(/* @__PURE__ */ new Map()), S = C(() => f(e, m({
840
+ function Ot({ payload: e, grain: t = "package", expandedIds: n, onExpandedIdsChange: r, selectedId: i = null, onSelect: a, focusedId: o, onFocusChange: s, filter: c = "", onFilterChange: l, onOpenMap: u, onStateAction: d, ariaLabel: f = "code map navigator" }) {
841
+ let [p, m] = U(() => /* @__PURE__ */ new Set()), [h, g] = U(null), _ = n === void 0 ? p : new Set(n), v = o === void 0 ? h : o, y = H(/* @__PURE__ */ new Map()), b = V(() => L(e, z({
828
842
  grain: t,
829
- expandedIds: Array.from(y),
843
+ expandedIds: Array.from(_),
830
844
  selectedId: i,
831
- navigatorFocusedId: b,
845
+ navigatorFocusedId: v,
832
846
  navigatorFilter: c
833
847
  })), [
834
848
  e,
835
849
  t,
836
- Re(y),
850
+ At(_),
837
851
  i,
838
- b,
852
+ v,
839
853
  c
840
- ]), k = S.rows, A = S.focusedId, j = S.selected, N = j ? k.find((e) => e.node.id === j.id) : null, P = !!N?.canExpand && !N.forcedOpen;
841
- function F(e) {
842
- n === void 0 && g(e), d?.({
854
+ ]), x = b.rows, S = b.focusedId, C = b.selected, w = C ? x.find((e) => e.node.id === C.id) : null, T = !!w?.canExpand && !w.forcedOpen;
855
+ function E(e) {
856
+ n === void 0 && m(e), d?.({
843
857
  type: "set-expanded",
844
858
  ids: Array.from(e)
845
859
  }), r?.(Array.from(e));
846
860
  }
847
- function I(e) {
848
- let t = new Set(y);
849
- t.has(e) ? t.delete(e) : t.add(e), F(t);
861
+ function D(e) {
862
+ let t = new Set(_);
863
+ t.has(e) ? t.delete(e) : t.add(e), E(t);
850
864
  }
851
- function L(e) {
852
- o === void 0 && v(e), d?.({
865
+ function O(e) {
866
+ o === void 0 && g(e), d?.({
853
867
  type: "focus",
854
868
  id: e
855
- }), s?.(e), x.current.get(e)?.focus();
869
+ }), s?.(e), y.current.get(e)?.focus();
856
870
  }
857
- function R(e) {
858
- o === void 0 && v(e.id), x.current.get(e.id)?.focus(), d?.({
871
+ function k(e) {
872
+ o === void 0 && g(e.id), y.current.get(e.id)?.focus(), d?.({
859
873
  type: "select",
860
874
  id: e.id
861
875
  }), s?.(e.id), a?.(e.id, e);
862
876
  }
863
- function z(e, t) {
864
- let n = k[t];
877
+ function A(e, t) {
878
+ let n = x[t];
865
879
  if (!n) return;
866
880
  let { node: r } = n, i = null;
867
- if (e.key === "ArrowDown") i = k[Math.min(t + 1, k.length - 1)]?.node.id;
868
- else if (e.key === "ArrowUp") i = k[Math.max(t - 1, 0)]?.node.id;
869
- else if (e.key === "Home") i = k[0]?.node.id;
870
- else if (e.key === "End") i = k[k.length - 1]?.node.id;
871
- else if (e.key === "ArrowRight" && (n.canExpand || n.forcedOpen)) n.forcedOpen || n.expanded ? i = n.childIds[0] ?? null : y.has(r.id) || I(r.id);
872
- else if (e.key === "ArrowLeft") !n.forcedOpen && n.canExpand && n.expanded ? I(r.id) : i = n.parentId;
881
+ if (e.key === "ArrowDown") i = x[Math.min(t + 1, x.length - 1)]?.node.id;
882
+ else if (e.key === "ArrowUp") i = x[Math.max(t - 1, 0)]?.node.id;
883
+ else if (e.key === "Home") i = x[0]?.node.id;
884
+ else if (e.key === "End") i = x[x.length - 1]?.node.id;
885
+ else if (e.key === "ArrowRight" && (n.canExpand || n.forcedOpen)) n.forcedOpen || n.expanded ? i = n.childIds[0] ?? null : _.has(r.id) || D(r.id);
886
+ else if (e.key === "ArrowLeft") !n.forcedOpen && n.canExpand && n.expanded ? D(r.id) : i = n.parentId;
873
887
  else if (e.key === "Enter" || e.key === " ") {
874
- R(r), e.preventDefault();
888
+ k(r), e.preventDefault();
875
889
  return;
876
890
  } else return;
877
- e.preventDefault(), i && L(i);
891
+ e.preventDefault(), i && O(i);
878
892
  }
879
- return /* @__PURE__ */ O("section", {
893
+ return /* @__PURE__ */ G("section", {
880
894
  className: "gmp-navigator",
881
- "aria-label": p,
895
+ "aria-label": f,
882
896
  children: [
883
- /* @__PURE__ */ O("header", {
897
+ /* @__PURE__ */ G("header", {
884
898
  className: "gmp-navigator-head",
885
- children: [/* @__PURE__ */ O("div", { children: [/* @__PURE__ */ D("p", {
899
+ children: [/* @__PURE__ */ G("div", { children: [/* @__PURE__ */ W("p", {
886
900
  className: "gmp-navigator-kicker",
887
901
  children: "browse the codebase"
888
- }), /* @__PURE__ */ D("p", {
902
+ }), /* @__PURE__ */ W("p", {
889
903
  className: "gmp-navigator-note",
890
904
  children: "choose an area for its recorded work, then open the spatial map when relationships matter"
891
- })] }), /* @__PURE__ */ O("label", {
905
+ })] }), /* @__PURE__ */ G("label", {
892
906
  className: "gmp-navigator-search",
893
907
  children: [
894
- /* @__PURE__ */ D(U, { "aria-hidden": "true" }),
895
- /* @__PURE__ */ D("span", {
908
+ /* @__PURE__ */ W(Ae, { "aria-hidden": "true" }),
909
+ /* @__PURE__ */ W("span", {
896
910
  className: "mc-sr",
897
911
  children: "filter code areas"
898
912
  }),
899
- /* @__PURE__ */ D("input", {
913
+ /* @__PURE__ */ W("input", {
900
914
  value: c,
901
915
  onChange: (e) => {
902
916
  d?.({
@@ -909,13 +923,13 @@ function Ie({ payload: e, grain: t = "package", expandedIds: n, onExpandedIdsCha
909
923
  ]
910
924
  })]
911
925
  }),
912
- S.staleSelectedId ? /* @__PURE__ */ O("p", {
926
+ b.staleSelectedId ? /* @__PURE__ */ G("p", {
913
927
  className: "gmp-navigator-missing",
914
928
  role: "status",
915
929
  children: [
916
930
  "the selected code area is not present in this map.",
917
931
  " ",
918
- /* @__PURE__ */ D("button", {
932
+ /* @__PURE__ */ W("button", {
919
933
  type: "button",
920
934
  onClick: () => {
921
935
  d?.({ type: "clear-selection" }), a?.(null, null);
@@ -924,68 +938,68 @@ function Ie({ payload: e, grain: t = "package", expandedIds: n, onExpandedIdsCha
924
938
  })
925
939
  ]
926
940
  }) : null,
927
- /* @__PURE__ */ O("div", {
941
+ /* @__PURE__ */ G("div", {
928
942
  className: "gmp-navigator-body",
929
- children: [/* @__PURE__ */ D("div", {
943
+ children: [/* @__PURE__ */ W("div", {
930
944
  role: "tree",
931
945
  "aria-label": "code areas",
932
946
  className: "gmp-navigator-tree",
933
947
  "data-grain": t,
934
- children: k.length === 0 ? /* @__PURE__ */ D("p", {
948
+ children: x.length === 0 ? /* @__PURE__ */ W("p", {
935
949
  className: "gmp-navigator-empty",
936
950
  role: "status",
937
951
  children: "no code areas match this filter"
938
- }) : k.map((e, t) => {
939
- let n = e.canExpand || e.forcedOpen, r = e.expanded, a = A === e.node.id;
940
- return /* @__PURE__ */ D(Le, {
952
+ }) : x.map((e, t) => {
953
+ let n = e.canExpand || e.forcedOpen, r = e.expanded, a = S === e.node.id;
954
+ return /* @__PURE__ */ W(kt, {
941
955
  row: e,
942
956
  hasChildren: n,
943
957
  isExpanded: r,
944
958
  selected: i === e.node.id,
945
959
  tabbable: a,
946
960
  setRef: (t) => {
947
- t ? x.current.set(e.node.id, t) : x.current.delete(e.node.id);
961
+ t ? y.current.set(e.node.id, t) : y.current.delete(e.node.id);
948
962
  },
949
963
  onFocus: () => {
950
- o === void 0 && v(e.node.id);
964
+ o === void 0 && g(e.node.id);
951
965
  },
952
- onSelect: () => R(e.node),
966
+ onSelect: () => k(e.node),
953
967
  onToggle: () => {
954
- e.forcedOpen || I(e.node.id);
968
+ e.forcedOpen || D(e.node.id);
955
969
  },
956
- onKeyDown: (e) => z(e, t)
970
+ onKeyDown: (e) => A(e, t)
957
971
  }, e.node.id);
958
972
  })
959
- }), /* @__PURE__ */ D("aside", {
973
+ }), /* @__PURE__ */ W("aside", {
960
974
  className: "gmp-navigator-actions",
961
975
  "aria-label": "selected code area",
962
- children: j ? /* @__PURE__ */ O(E, { children: [
963
- /* @__PURE__ */ D("p", {
976
+ children: C ? /* @__PURE__ */ G(he, { children: [
977
+ /* @__PURE__ */ W("p", {
964
978
  className: "gmp-navigator-selected",
965
- children: j.name || j.id
979
+ children: C.name || C.id
966
980
  }),
967
- /* @__PURE__ */ D("p", {
981
+ /* @__PURE__ */ W("p", {
968
982
  className: "gmp-navigator-selected-path",
969
- children: j.id
983
+ children: C.id
970
984
  }),
971
- P ? /* @__PURE__ */ O("button", {
985
+ T ? /* @__PURE__ */ G("button", {
972
986
  type: "button",
973
987
  className: "gmp-navigator-action",
974
- onClick: () => I(j.id),
975
- children: [/* @__PURE__ */ D(M, { "aria-hidden": "true" }), y.has(j.id) ? "hide children" : "show children"]
988
+ onClick: () => D(C.id),
989
+ children: [/* @__PURE__ */ W(K, { "aria-hidden": "true" }), _.has(C.id) ? "hide children" : "show children"]
976
990
  }) : null,
977
- /* @__PURE__ */ O("button", {
991
+ /* @__PURE__ */ G("button", {
978
992
  type: "button",
979
993
  className: "gmp-navigator-action gmp-navigator-action--primary",
980
994
  onClick: () => {
981
995
  d?.({
982
996
  type: "open-in-map",
983
- id: j.id
984
- }), u?.(j.id);
997
+ id: C.id
998
+ }), u?.(C.id);
985
999
  },
986
- children: [/* @__PURE__ */ D(B, { "aria-hidden": "true" }), " open in map"]
1000
+ children: [/* @__PURE__ */ W(De, { "aria-hidden": "true" }), " open in map"]
987
1001
  })
988
- ] }) : /* @__PURE__ */ D("p", {
1002
+ ] }) : /* @__PURE__ */ W("p", {
989
1003
  className: "gmp-navigator-empty",
990
1004
  children: "select an area to see its recorded work and map context"
991
1005
  })
@@ -994,13 +1008,13 @@ function Ie({ payload: e, grain: t = "package", expandedIds: n, onExpandedIdsCha
994
1008
  ]
995
1009
  });
996
1010
  }
997
- function Le({ row: e, hasChildren: t, isExpanded: n, selected: r, tabbable: i, setRef: a, onFocus: o, onSelect: s, onToggle: c, onKeyDown: l }) {
998
- return /* @__PURE__ */ O("div", {
1011
+ function kt({ row: e, hasChildren: t, isExpanded: n, selected: r, tabbable: i, setRef: a, onFocus: o, onSelect: s, onToggle: c, onKeyDown: l }) {
1012
+ return /* @__PURE__ */ G("div", {
999
1013
  role: "none",
1000
1014
  className: "gmp-navigator-row-wrap",
1001
1015
  "data-selected": r,
1002
1016
  style: { "--gmp-tree-depth": e.depth },
1003
- children: [t ? /* @__PURE__ */ D("button", {
1017
+ children: [t ? /* @__PURE__ */ W("button", {
1004
1018
  type: "button",
1005
1019
  className: "gmp-navigator-disclosure",
1006
1020
  tabIndex: -1,
@@ -1011,14 +1025,14 @@ function Le({ row: e, hasChildren: t, isExpanded: n, selected: r, tabbable: i, s
1011
1025
  onClick: (t) => {
1012
1026
  t.stopPropagation(), e.forcedOpen || c();
1013
1027
  },
1014
- children: /* @__PURE__ */ D(M, {
1028
+ children: /* @__PURE__ */ W(K, {
1015
1029
  className: "gmp-navigator-chevron",
1016
1030
  "aria-hidden": "true"
1017
1031
  })
1018
- }) : /* @__PURE__ */ D("span", {
1032
+ }) : /* @__PURE__ */ W("span", {
1019
1033
  className: "gmp-navigator-disclosure-placeholder",
1020
1034
  "aria-hidden": "true"
1021
- }), /* @__PURE__ */ O("div", {
1035
+ }), /* @__PURE__ */ G("div", {
1022
1036
  ref: a,
1023
1037
  role: "treeitem",
1024
1038
  "aria-level": e.depth + 1,
@@ -1033,154 +1047,154 @@ function Le({ row: e, hasChildren: t, isExpanded: n, selected: r, tabbable: i, s
1033
1047
  },
1034
1048
  onKeyDown: l,
1035
1049
  children: [
1036
- e.node.kind === "file" ? /* @__PURE__ */ D(F, { "aria-hidden": "true" }) : /* @__PURE__ */ D(R, { "aria-hidden": "true" }),
1037
- /* @__PURE__ */ D("span", {
1050
+ e.node.kind === "file" ? /* @__PURE__ */ W(xe, { "aria-hidden": "true" }) : /* @__PURE__ */ W(we, { "aria-hidden": "true" }),
1051
+ /* @__PURE__ */ W("span", {
1038
1052
  className: "gmp-navigator-path",
1039
1053
  children: e.node.name || e.node.id
1040
1054
  }),
1041
- /* @__PURE__ */ O("span", {
1055
+ /* @__PURE__ */ G("span", {
1042
1056
  className: "gmp-navigator-meta",
1043
- children: [/* @__PURE__ */ O("span", { children: [ze(e.node.loc ?? 0), " lines"] }), /* @__PURE__ */ D("span", { children: Be(e.node.recordedFiles, e.node.totalFiles) })]
1057
+ children: [/* @__PURE__ */ G("span", { children: [jt(e.node.loc ?? 0), " lines"] }), /* @__PURE__ */ W("span", { children: Mt(e.node.recordedFiles, e.node.totalFiles) })]
1044
1058
  })
1045
1059
  ]
1046
1060
  })]
1047
1061
  });
1048
1062
  }
1049
- function Re(e) {
1063
+ function At(e) {
1050
1064
  return Array.from(e).sort().join("\0");
1051
1065
  }
1052
- function ze(e) {
1066
+ function jt(e) {
1053
1067
  return new Intl.NumberFormat("en", {
1054
1068
  notation: "compact",
1055
1069
  maximumFractionDigits: 1
1056
1070
  }).format(Number(e) || 0);
1057
1071
  }
1058
- function Be(e, t) {
1072
+ function Mt(e, t) {
1059
1073
  let n = Number(t) || 0;
1060
1074
  return n <= 0 ? "no coverage data" : `${Math.round((Number(e) || 0) / n * 100)}% recorded`;
1061
1075
  }
1062
1076
  //#endregion
1063
1077
  //#region src/ui/graph/CodeMapComposition.jsx
1064
- function Ve({ payload: e, zoom: t, onZoomChange: n, selectedId: r, onSelect: i, onExpand: a, highlightedIds: o, nodeDeltas: s, structureEdgeDeltas: u, height: d = 480, ariaLabel: f = "code map", canvasSlot: p, rail: h, toolbar: _, sheetTitle: v = "code area", sheetMeta: y, railSide: b = "right", legend: x, canvasWrapperClassName: S = "", canvasWrapperStyle: w, className: k = "", presentation: A = "canvas", navigatorSlot: j, onPresentationChange: M, viewport: N, onViewportChange: P, state: F, defaultState: I, onStateChange: L }) {
1065
- let R = F !== void 0 || I !== void 0, [z, ee] = T(() => m(I)), B = C(() => R ? m(F ?? z) : null, [
1066
- R,
1067
- F,
1068
- z
1069
- ]), V = B?.presentation ?? A;
1070
- function H(e, t) {
1071
- F === void 0 && ee(e), L?.(e), t?.(e);
1078
+ function Nt({ payload: e, zoom: t, onZoomChange: n, selectedId: r, onSelect: i, onExpand: a, highlightedIds: o, nodeDeltas: s, structureEdgeDeltas: c, height: l = 480, ariaLabel: u = "code map", canvasSlot: d, rail: f, toolbar: p, sheetTitle: m = "code area", sheetMeta: h, railSide: g = "right", legend: _, canvasWrapperClassName: v = "", canvasWrapperStyle: y, className: b = "", presentation: x = "canvas", navigatorSlot: S, onPresentationChange: C, viewport: w, onViewportChange: T, state: E, defaultState: O, onStateChange: k }) {
1079
+ let A = E !== void 0 || O !== void 0, [j, ee] = U(() => z(O)), N = V(() => A ? z(E ?? j) : null, [
1080
+ A,
1081
+ E,
1082
+ j
1083
+ ]), P = N?.presentation ?? x;
1084
+ function F(e, t) {
1085
+ E === void 0 && ee(e), k?.(e), t?.(e);
1072
1086
  }
1073
- function U(e, t) {
1074
- if (!B) return;
1075
- let n = l(B, e);
1076
- c(B, n) || H(n, t);
1087
+ function I(e, t) {
1088
+ if (!N) return;
1089
+ let n = D(N, e);
1090
+ M(N, n) || F(n, t);
1077
1091
  }
1078
- let te = R || M ? /* @__PURE__ */ O(E, { children: [/* @__PURE__ */ O("div", {
1092
+ let te = A || C ? /* @__PURE__ */ G(he, { children: [/* @__PURE__ */ G("div", {
1079
1093
  className: "gmp-presentation-switch",
1080
1094
  role: "group",
1081
1095
  "aria-label": "code map view",
1082
- children: [/* @__PURE__ */ D("button", {
1096
+ children: [/* @__PURE__ */ W("button", {
1083
1097
  type: "button",
1084
- "aria-pressed": V === "navigator",
1085
- onClick: () => R ? U({
1098
+ "aria-pressed": P === "navigator",
1099
+ onClick: () => A ? I({
1086
1100
  type: "set-presentation",
1087
1101
  presentation: "navigator"
1088
- }, () => M?.("navigator")) : M?.("navigator"),
1089
- children: V === "canvas" ? "back to browse" : "browse"
1090
- }), /* @__PURE__ */ D("button", {
1102
+ }, () => C?.("navigator")) : C?.("navigator"),
1103
+ children: P === "canvas" ? "back to browse" : "browse"
1104
+ }), /* @__PURE__ */ W("button", {
1091
1105
  type: "button",
1092
- "aria-pressed": V === "canvas",
1093
- onClick: () => R ? U({
1106
+ "aria-pressed": P === "canvas",
1107
+ onClick: () => A ? I({
1094
1108
  type: "set-presentation",
1095
1109
  presentation: "canvas"
1096
- }, () => M?.("canvas")) : M?.("canvas"),
1110
+ }, () => C?.("canvas")) : C?.("canvas"),
1097
1111
  children: "spatial map"
1098
1112
  })]
1099
- }), _] }) : _, W = p ?? /* @__PURE__ */ D(je, {
1113
+ }), p] }) : p, L = d ?? /* @__PURE__ */ W(Ct, {
1100
1114
  payload: e,
1101
- zoom: B ? {
1102
- level: B.grain,
1103
- expanded: B.expandedIds
1115
+ zoom: N ? {
1116
+ level: N.grain,
1117
+ expanded: N.expandedIds
1104
1118
  } : t,
1105
1119
  onZoomChange: n,
1106
- selectedId: B ? B.selectedId : r,
1120
+ selectedId: N ? N.selectedId : r,
1107
1121
  onSelect: i,
1108
1122
  onExpand: a,
1109
1123
  highlightedIds: o,
1110
1124
  nodeDeltas: s,
1111
- structureEdgeDeltas: u,
1112
- height: d,
1113
- ariaLabel: f,
1114
- viewport: B ? B.viewport ?? void 0 : N,
1115
- onViewportChange: P,
1116
- state: B ?? void 0,
1117
- onStateChange: B ? (e) => H(e) : void 0
1118
- }), G = j ?? (B && e ? /* @__PURE__ */ D(Ie, {
1125
+ structureEdgeDeltas: c,
1126
+ height: l,
1127
+ ariaLabel: u,
1128
+ viewport: N ? N.viewport ?? void 0 : w,
1129
+ onViewportChange: T,
1130
+ state: N ?? void 0,
1131
+ onStateChange: N ? (e) => F(e) : void 0
1132
+ }), R = S ?? (N && e ? /* @__PURE__ */ W(Ot, {
1119
1133
  payload: e,
1120
- grain: B.grain,
1121
- expandedIds: B.expandedIds,
1122
- selectedId: B.selectedId,
1123
- focusedId: B.navigatorFocusedId,
1124
- filter: B.navigatorFilter,
1125
- onStateAction: (t) => U(t, () => {
1134
+ grain: N.grain,
1135
+ expandedIds: N.expandedIds,
1136
+ selectedId: N.selectedId,
1137
+ focusedId: N.navigatorFocusedId,
1138
+ filter: N.navigatorFilter,
1139
+ onStateAction: (t) => I(t, () => {
1126
1140
  t.type === "select" ? i?.(t.id, e.nodes.find((e) => e.id === t.id) ?? null) : t.type === "clear-selection" ? i?.(null, null) : t.type === "set-expanded" ? n?.({
1127
- level: B.grain,
1141
+ level: N.grain,
1128
1142
  expanded: Array.from(t.ids)
1129
- }) : t.type === "open-in-map" && (i?.(t.id, e.nodes.find((e) => e.id === t.id) ?? null), M?.("canvas"));
1143
+ }) : t.type === "open-in-map" && (i?.(t.id, e.nodes.find((e) => e.id === t.id) ?? null), C?.("canvas"));
1130
1144
  }),
1131
- ariaLabel: `browse ${f}`
1132
- }) : null), K = V === "navigator" && G !== null;
1133
- return /* @__PURE__ */ D("div", {
1134
- className: ["gmp-root", k].filter(Boolean).join(" "),
1135
- children: /* @__PURE__ */ O(g, {
1145
+ ariaLabel: `browse ${u}`
1146
+ }) : null), B = P === "navigator" && R !== null;
1147
+ return /* @__PURE__ */ W("div", {
1148
+ className: ["gmp-root", b].filter(Boolean).join(" "),
1149
+ children: /* @__PURE__ */ G(re, {
1136
1150
  toolbar: te,
1137
- rail: h,
1138
- sheetTitle: v,
1139
- sheetMeta: y,
1140
- railSide: b,
1141
- children: [/* @__PURE__ */ D("div", {
1142
- className: ["gmp-map-canvas-region", S].filter(Boolean).join(" "),
1143
- style: w,
1151
+ rail: f,
1152
+ sheetTitle: m,
1153
+ sheetMeta: h,
1154
+ railSide: g,
1155
+ children: [/* @__PURE__ */ W("div", {
1156
+ className: ["gmp-map-canvas-region", v].filter(Boolean).join(" "),
1157
+ style: y,
1144
1158
  "data-testid": "gmp-map-canvas-region",
1145
- children: K ? G : W
1146
- }), !K && x !== !1 && (x ?? /* @__PURE__ */ D(He, {}))]
1159
+ children: B ? R : L
1160
+ }), !B && _ !== !1 && (_ ?? /* @__PURE__ */ W(Pt, {}))]
1147
1161
  })
1148
1162
  });
1149
1163
  }
1150
- function He() {
1151
- return /* @__PURE__ */ O("p", {
1164
+ function Pt() {
1165
+ return /* @__PURE__ */ G("p", {
1152
1166
  className: "gmp-map-legend",
1153
1167
  children: [
1154
- /* @__PURE__ */ O("span", {
1168
+ /* @__PURE__ */ G("span", {
1155
1169
  className: "gmp-legend-item",
1156
- children: [/* @__PURE__ */ D("span", {
1170
+ children: [/* @__PURE__ */ W("span", {
1157
1171
  className: "gmp-map-swatch",
1158
1172
  "aria-hidden": "true"
1159
1173
  }), " code area (folder or file)"]
1160
1174
  }),
1161
- /* @__PURE__ */ O("span", {
1175
+ /* @__PURE__ */ G("span", {
1162
1176
  className: "gmp-legend-item gmp-legend-dim",
1163
- children: [/* @__PURE__ */ D("span", {
1177
+ children: [/* @__PURE__ */ W("span", {
1164
1178
  className: "gmp-map-swatch gmp-map-swatch--empty",
1165
1179
  "aria-hidden": "true"
1166
1180
  }), " no saved conversation behind it"]
1167
1181
  }),
1168
- /* @__PURE__ */ D("span", {
1182
+ /* @__PURE__ */ W("span", {
1169
1183
  className: "gmp-legend-item gmp-legend-dim",
1170
1184
  children: "brighter = more of it built with AI on record"
1171
1185
  }),
1172
- /* @__PURE__ */ O("span", {
1186
+ /* @__PURE__ */ G("span", {
1173
1187
  className: "gmp-legend-item gmp-legend-dim",
1174
- children: [/* @__PURE__ */ D("span", {
1188
+ children: [/* @__PURE__ */ W("span", {
1175
1189
  className: "gmp-map-swatch gmp-map-swatch--edge",
1176
1190
  "aria-hidden": "true"
1177
1191
  }), " one area uses another"]
1178
1192
  }),
1179
- /* @__PURE__ */ D("span", {
1193
+ /* @__PURE__ */ W("span", {
1180
1194
  className: "gmp-legend-item gmp-map-legend-danger",
1181
1195
  children: "⚠ tangle — two areas that depend on each other"
1182
1196
  }),
1183
- /* @__PURE__ */ D("span", {
1197
+ /* @__PURE__ */ W("span", {
1184
1198
  className: "gmp-legend-item gmp-legend-dim",
1185
1199
  children: "double-click a folder to open its files"
1186
1200
  })
@@ -1189,26 +1203,26 @@ function He() {
1189
1203
  }
1190
1204
  //#endregion
1191
1205
  //#region src/ui/graph/timelineNavigation.js
1192
- function Z(e) {
1206
+ function X(e) {
1193
1207
  return typeof e == "object" && !!e && !Array.isArray(e);
1194
1208
  }
1195
- function Q(e, t) {
1209
+ function Z(e, t) {
1196
1210
  let n = Object.keys(e).sort();
1197
1211
  return n.length === t.length && t.slice().sort().every((e, t) => e === n[t]);
1198
1212
  }
1199
- function $(e) {
1213
+ function Q(e) {
1200
1214
  return typeof e == "string" && e.length > 0;
1201
1215
  }
1202
- function Ue(e) {
1203
- return e === null || $(e);
1216
+ function Ft(e) {
1217
+ return e === null || Q(e);
1204
1218
  }
1205
- function We(e) {
1219
+ function It(e) {
1206
1220
  let t = !1;
1207
- if (Z(e) && typeof e.type == "string" && (e.type === "open-change" && Q(e, ["type", "change"]) && Z(e.change) ? t = Q(e.change, ["id", "branch"]) && $(e.change.id) && Ue(e.change.branch) : e.type === "open-session" && Q(e, [
1221
+ if (X(e) && typeof e.type == "string" && (e.type === "open-change" && Z(e, ["type", "change"]) && X(e.change) ? t = Z(e.change, ["id", "branch"]) && Q(e.change.id) && Ft(e.change.branch) : e.type === "open-session" && Z(e, [
1208
1222
  "type",
1209
1223
  "sessionId",
1210
1224
  "source"
1211
- ]) && $(e.sessionId) && Z(e.source) ? e.source.kind === "commit" && Q(e.source, ["kind", "commit"]) && Z(e.source.commit) ? t = Q(e.source.commit, ["id", "branch"]) && $(e.source.commit.id) && Ue(e.source.commit.branch) : (e.source.kind === "unlinked" || e.source.kind === "outside-window") && Q(e.source, ["kind"]) && (t = !0) : (e.type === "open-map" || e.type === "show-older") && Q(e, ["type"]) && (t = !0)), !t) throw TypeError([
1225
+ ]) && Q(e.sessionId) && X(e.source) ? e.source.kind === "commit" && Z(e.source, ["kind", "commit"]) && X(e.source.commit) ? t = Z(e.source.commit, ["id", "branch"]) && Q(e.source.commit.id) && Ft(e.source.commit.branch) : (e.source.kind === "unlinked" || e.source.kind === "outside-window") && Z(e.source, ["kind"]) && (t = !0) : (e.type === "open-map" || e.type === "show-older") && Z(e, ["type"]) && (t = !0)), !t) throw TypeError([
1212
1226
  "Timeline navigation action rejected.",
1213
1227
  "What went wrong: the value is not an exact supported TimelineNavigationAction.",
1214
1228
  "Why it happened: an untyped caller supplied an unknown action, missing context, or extra fields.",
@@ -1219,4 +1233,186 @@ function We(e) {
1219
1233
  ].join("\n"));
1220
1234
  }
1221
1235
  //#endregion
1222
- export { ne as AllChangeBindings, re as AllDiffLineKinds, ie as AllEdgeViolationKinds, ae as AllFileChangeStatuses, oe as AllMapNodeKinds, a as CHANGE_BINDINGS, v as CODE_MAP_STATE_VERSION, s as CODE_MAP_VIEWPORT_SCALE, se as ChangeBinding, Oe as ChangeDetail, be as Changes, je as CodeMap, Ve as CodeMapComposition, Ie as CodeMapNavigator, y as DIFF_LINE_KINDS, He as DefaultMapLegend, ce as DiffLineKind, S as EDGE_VIOLATION_KINDS, le as EdgeViolationKind, o as FILE_CHANGE_STATUSES, ue as FileChangeStatus, _ as GRAPH_APP_SECTIONS, p as GraphAppShell, h as GraphSectionNav, x as MAP_NODE_KINDS, de as MapNodeKind, r as assertChangeDetailPayloadEnums, t as assertChangeDiffPayloadEnums, b as assertCodeMapPayloadEnums, We as assertTimelineNavigationAction, ve as buildChangesGraph, Me as codeMapPayloadToMapData, c as codeMapStatesEqual, m as createCodeMapState, f as deriveCodeMapView, X as humanizeAge, fe as isChangeBinding, u as isCodeMapViewportScale, pe as isDiffLineKind, me as isEdgeViolationKind, he as isFileChangeStatus, ge as isMapNodeKind, l as reduceCodeMapState };
1236
+ //#region src/ui/graph/ScentTag.jsx
1237
+ function Lt({ tag: e, hoverText: t, active: n = !1, onToggle: r, className: i = "", ...a }) {
1238
+ if (!b.includes(e)) throw Error(`ScentTag render failed: what went wrong: unknown scent tag ${JSON.stringify(e)}; why: the value is not a member of the closed SCENT_TAGS set; where: src/ui/graph/ScentTag.jsx; when: rendering a ranked-list row; what it means: an upstream ranking derivation produced a value outside the frozen vocabulary; how to fix: only pass one of ${b.join(", ")}.`);
1239
+ return r ? /* @__PURE__ */ G("button", {
1240
+ type: "button",
1241
+ className: `tlp-scent tlp-scent-filter${n ? " tlp-scent-filter-active" : ""}${i ? ` ${i}` : ""}`,
1242
+ title: t || void 0,
1243
+ "aria-pressed": n,
1244
+ onClick: () => r(n ? null : e),
1245
+ ...a,
1246
+ children: [e, /* @__PURE__ */ W("span", {
1247
+ className: "tlp-sr",
1248
+ role: "status",
1249
+ "aria-live": "polite",
1250
+ children: n ? `filtering by ${e}` : ""
1251
+ })]
1252
+ }) : /* @__PURE__ */ W("span", {
1253
+ className: `tlp-scent${i ? ` ${i}` : ""}`,
1254
+ title: t || void 0,
1255
+ ...a,
1256
+ children: e
1257
+ });
1258
+ }
1259
+ //#endregion
1260
+ //#region src/ui/graph/RankedRow.jsx
1261
+ function Rt({ row: e, loc: t = 0, selected: n = !1, onSelect: r, className: i = "", ...a }) {
1262
+ return /* @__PURE__ */ G("button", {
1263
+ type: "button",
1264
+ className: [
1265
+ "tlp-ranked-row",
1266
+ n && "tlp-ranked-row-sel",
1267
+ i
1268
+ ].filter(Boolean).join(" "),
1269
+ "aria-pressed": n,
1270
+ onClick: () => r?.(e.id),
1271
+ ...a,
1272
+ children: [
1273
+ /* @__PURE__ */ W(A, {
1274
+ className: "tlp-ranked-doi-scope",
1275
+ children: /* @__PURE__ */ W(se, {
1276
+ label: e.name,
1277
+ loc: t,
1278
+ recorded: e.doi,
1279
+ total: 1,
1280
+ selected: n,
1281
+ as: "span",
1282
+ className: "tlp-ranked-doi"
1283
+ })
1284
+ }),
1285
+ /* @__PURE__ */ W("span", {
1286
+ className: "tlp-ranked-name",
1287
+ title: e.name,
1288
+ children: e.name
1289
+ }),
1290
+ /* @__PURE__ */ W("span", {
1291
+ className: "tlp-ranked-tags",
1292
+ "aria-label": "comprehension signals",
1293
+ children: e.scentTags.map((t) => /* @__PURE__ */ W(Lt, {
1294
+ tag: t,
1295
+ hoverText: t.startsWith("agent wrote:") ? e.hoverText ?? void 0 : void 0
1296
+ }, t))
1297
+ }),
1298
+ /* @__PURE__ */ W("span", {
1299
+ className: "tlp-ranked-doi-val tnum",
1300
+ "aria-hidden": "true",
1301
+ children: e.doi.toFixed(2)
1302
+ })
1303
+ ]
1304
+ });
1305
+ }
1306
+ //#endregion
1307
+ //#region src/ui/graph/RankModeControl.jsx
1308
+ var $ = [
1309
+ "relevance",
1310
+ "debt",
1311
+ "churn"
1312
+ ];
1313
+ function zt({ rankMode: e, onChange: t, className: n = "", ...r }) {
1314
+ let i = H([]), a = (e) => {
1315
+ let n = $[e];
1316
+ n && (t(n), i.current[e]?.focus());
1317
+ }, o = (e, t) => {
1318
+ let n;
1319
+ switch (e.key) {
1320
+ case "ArrowRight":
1321
+ case "ArrowDown":
1322
+ n = (t + 1) % $.length;
1323
+ break;
1324
+ case "ArrowLeft":
1325
+ case "ArrowUp":
1326
+ n = (t - 1 + $.length) % $.length;
1327
+ break;
1328
+ case "Home":
1329
+ n = 0;
1330
+ break;
1331
+ case "End":
1332
+ n = $.length - 1;
1333
+ break;
1334
+ default: return;
1335
+ }
1336
+ e.preventDefault(), a(n);
1337
+ };
1338
+ return /* @__PURE__ */ G("span", {
1339
+ className: `tlp-rank-mode${n ? ` ${n}` : ""}`,
1340
+ role: "radiogroup",
1341
+ "aria-label": "rank mode",
1342
+ ...r,
1343
+ children: [$.map((n, r) => /* @__PURE__ */ W("button", {
1344
+ type: "button",
1345
+ role: "radio",
1346
+ "aria-checked": e === n,
1347
+ tabIndex: e === n ? 0 : -1,
1348
+ ref: (e) => {
1349
+ i.current[r] = e;
1350
+ },
1351
+ className: `tlp-rank-mode-btn${e === n ? " tlp-rank-mode-btn-active" : ""}`,
1352
+ onClick: () => t(n),
1353
+ onKeyDown: (e) => o(e, r),
1354
+ children: n
1355
+ }, n)), /* @__PURE__ */ W("span", {
1356
+ className: "tlp-sr",
1357
+ role: "status",
1358
+ "aria-live": "polite",
1359
+ children: `rank mode: ${e}`
1360
+ })]
1361
+ });
1362
+ }
1363
+ //#endregion
1364
+ //#region src/ui/graph/InsightPanel.jsx
1365
+ function Bt({ insights: e, onOpenEvidence: t, className: n = "", ...r }) {
1366
+ if (fe(e), e.length === 0) return /* @__PURE__ */ W("p", {
1367
+ className: `tlp-insight-empty${n ? ` ${n}` : ""}`,
1368
+ ...r,
1369
+ children: "no insights recorded for this node yet."
1370
+ });
1371
+ let i = /* @__PURE__ */ new Map();
1372
+ for (let t of e) {
1373
+ let e = i.get(t.kind) ?? [];
1374
+ e.push(t), i.set(t.kind, e);
1375
+ }
1376
+ return /* @__PURE__ */ W("div", {
1377
+ className: `tlp-insight-panel${n ? ` ${n}` : ""}`,
1378
+ ...r,
1379
+ children: [...i.entries()].map(([e, n]) => /* @__PURE__ */ G("section", {
1380
+ className: "tlp-insight-group",
1381
+ "aria-label": f[e],
1382
+ children: [/* @__PURE__ */ W("h3", {
1383
+ className: "tlp-insight-group-title",
1384
+ children: f[e]
1385
+ }), /* @__PURE__ */ W("ul", {
1386
+ className: "tlp-insight-list",
1387
+ children: n.map((e, n) => /* @__PURE__ */ G("li", {
1388
+ className: "tlp-insight-item",
1389
+ children: [
1390
+ /* @__PURE__ */ W("span", {
1391
+ className: `tlp-insight-provenance ${v[e.provenance].markerClass}`,
1392
+ "aria-hidden": "true"
1393
+ }),
1394
+ /* @__PURE__ */ W("span", {
1395
+ className: "tlp-insight-title",
1396
+ children: e.title
1397
+ }),
1398
+ e.summary && /* @__PURE__ */ W("span", {
1399
+ className: "tlp-insight-summary",
1400
+ children: e.summary
1401
+ }),
1402
+ /* @__PURE__ */ W("span", {
1403
+ className: "tlp-insight-evidence",
1404
+ children: e.evidence.map((e, n) => /* @__PURE__ */ W("button", {
1405
+ type: "button",
1406
+ className: "tlp-insight-evidence-link",
1407
+ onClick: () => t?.(e.sessionId),
1408
+ children: e.file || e.sessionId
1409
+ }, n))
1410
+ })
1411
+ ]
1412
+ }, n))
1413
+ })]
1414
+ }, e))
1415
+ });
1416
+ }
1417
+ //#endregion
1418
+ export { Fe as AllChangeBindings, Ie as AllDiffLineKinds, Le as AllEdgeViolationKinds, Re as AllFileChangeStatuses, ze as AllInsightKinds, Be as AllInsightProvenances, Ve as AllMapNodeKinds, He as AllReadAttributionStates, Ue as AllReadStateGrades, n as CHANGE_BINDINGS, oe as CODE_MAP_STATE_VERSION, j as CODE_MAP_VIEWPORT_SCALE, de as COVERAGE_CAP, We as ChangeBinding, bt as ChangeDetail, ft as Changes, Ct as CodeMap, Nt as CodeMapComposition, Ot as CodeMapNavigator, k as DEBT_VIEWED, S as DIFF_LINE_KINDS, ue as DOI_WEIGHTS, Pt as DefaultMapLegend, Ge as DiffLineKind, c as EDGE_VIOLATION_KINDS, Ke as EdgeViolationKind, x as FILE_CHANGE_STATUSES, qe as FileChangeStatus, ie as GRAPH_APP_SECTIONS, ae as GhostCommitNode, e as GhostGroup, R as GraphAppShell, ne as GraphSectionNav, E as HighlightEdge, Je as InsightKind, Bt as InsightPanel, Ye as InsightProvenance, C as MAP_NODE_KINDS, Xe as MapNodeKind, y as RANK_CAP, r as RANK_FLOOR, le as RECENCY_HALF_LIFE_DAYS, zt as RankModeControl, Rt as RankedRow, Ze as ReadAttributionState, Qe as ReadStateGrade, b as SCENT_TAGS, Lt as ScentTag, ee as SessionLane, _ as SessionOverflowDisclosure, w as TouchedFileCluster, s as assertChangeDetailPayloadEnums, d as assertChangeDiffPayloadEnums, B as assertCodeMapPayloadEnums, It as assertTimelineNavigationAction, ut as buildChangesGraph, wt as codeMapPayloadToMapData, M as codeMapStatesEqual, a as coverage, z as createCodeMapState, i as debt, h as debtHoverText, I as debtState, L as deriveCodeMapView, t as deriveRankedRows, P as deriveTimelineHighlight, F as gateRankedRows, Y as humanizeAge, p as hunkClears, $e as isChangeBinding, N as isCodeMapViewportScale, et as isDiffLineKind, tt as isEdgeViolationKind, nt as isFileChangeStatus, rt as isInsightKind, it as isInsightProvenance, at as isMapNodeKind, ot as isReadAttributionState, st as isReadStateGrade, m as partialReadHoverText, g as rankMapNodes, o as rankMapNodesIntrinsic, D as reduceCodeMapState, ce as resolveEscapeAction, l as scentTagsFor };