@locusgraph/loop 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/agent/pulse/gradient-label.js +64 -12
  2. package/dist/agent/pulse/marks/bars-mark.js +39 -15
  3. package/dist/agent/pulse/marks/glyph-mark.js +56 -15
  4. package/dist/agent/pulse/marks/locus-mark.js +38 -12
  5. package/dist/agent/pulse/marks/orb-mark.js +21 -9
  6. package/dist/agent/pulse/use-loop-animation.js +35 -12
  7. package/dist/approval/inbox/inbox-row.js +303 -76
  8. package/dist/approval/inbox/inbox.js +192 -39
  9. package/dist/approval/inbox/virtual-inbox-list.js +104 -26
  10. package/dist/approval/memory/memory-review.js +172 -36
  11. package/dist/approval/memory/memory-row.js +187 -50
  12. package/dist/approval/plan/plan-review.js +225 -73
  13. package/dist/approval/plan/plan-step-row.js +182 -76
  14. package/dist/approval/plan/question-choices.js +132 -44
  15. package/dist/approval/plan/question.js +156 -38
  16. package/dist/approval/run/run-bar.js +125 -39
  17. package/dist/approval/shared/use-focus-on-mount.js +23 -5
  18. package/dist/approval/spend/raise-cap-form.js +223 -48
  19. package/dist/approval/spend/spend-gate.js +157 -40
  20. package/dist/approval/tool/approval.js +196 -35
  21. package/dist/approval/tool/args/args-editor.js +206 -46
  22. package/dist/approval/tool/args/args-field.js +240 -55
  23. package/dist/approval/tool/deny-form.js +125 -36
  24. package/dist/approval/tool/tool-inputs.js +90 -23
  25. package/dist/chat/chat/use-stick-to-bottom.js +115 -60
  26. package/dist/chat/chat/virtual-chat-items.js +129 -34
  27. package/dist/chat/composer/composer-actions.d.ts +1 -2
  28. package/dist/chat/composer/composer-actions.js +132 -49
  29. package/dist/chat/composer/composer-status.d.ts +2 -0
  30. package/dist/chat/composer/composer-status.js +3 -0
  31. package/dist/chat/composer/composer.d.ts +1 -1
  32. package/dist/chat/composer/composer.js +2 -1
  33. package/dist/chat/composer/use-auto-grow.js +25 -8
  34. package/dist/chat/files/files.js +293 -66
  35. package/dist/chat/index.d.ts +1 -1
  36. package/dist/chat/index.js +1 -1
  37. package/dist/cost/model-picker.js +174 -42
  38. package/dist/memory/cite.js +181 -58
  39. package/dist/memory/memorized.js +196 -42
  40. package/dist/memory/recall.js +265 -68
  41. package/dist/memory/sources.js +232 -52
  42. package/dist/shared/virtual/use-list-virtualizer.js +2 -0
  43. package/dist/thread/actions/branch-switcher.js +97 -21
  44. package/dist/thread/canvas/version-switcher.js +128 -31
  45. package/dist/thread/code/copy-code-button.js +58 -24
  46. package/dist/thread/history/row/history-row.js +99 -18
  47. package/dist/thread/history/row/thread-item-menu.js +74 -19
  48. package/dist/thread/history/row/thread-title-editor.js +74 -29
  49. package/dist/thread/history/virtual-history-list.js +84 -46
  50. package/dist/thread/starters/starters.js +89 -27
  51. package/dist/thread/use-copied.js +40 -10
  52. package/package.json +1 -1
@@ -1,3 +1,6 @@
1
+ "use client";
2
+
3
+ import { c as _c } from "react/compiler-runtime";
1
4
  import { ChevronRight as ChevronRightIcon, RecentlyViewed as HistoryIcon } from "@carbon/icons-react";
2
5
  import { Collapsible, CollapsibleContent, CollapsibleTrigger, cn } from "@locusgraph/components";
3
6
  import { pluralize } from "@locusgraph/utils";
@@ -6,77 +9,235 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
6
9
  export function relevancePercent(relevance) {
7
10
  return Math.round(Math.min(Math.max(relevance, 0), 1) * 100);
8
11
  }
9
- export function Recall({
10
- memories,
11
- onOpenMemory,
12
- defaultOpen = false,
13
- className
14
- }) {
15
- if (memories.length === 0) return null;
16
- return /*#__PURE__*/_jsxs(Collapsible, {
17
- "data-slot": "recall",
18
- defaultOpen: defaultOpen,
19
- className: cn("flex min-w-0 flex-col gap-2", className),
20
- children: [/*#__PURE__*/_jsxs(CollapsibleTrigger, {
12
+ export function Recall(t0) {
13
+ const $ = _c(20);
14
+ const {
15
+ memories,
16
+ onOpenMemory,
17
+ defaultOpen: t1,
18
+ className
19
+ } = t0;
20
+ const defaultOpen = t1 === undefined ? false : t1;
21
+ if (memories.length === 0) {
22
+ return null;
23
+ }
24
+ let t2;
25
+ if ($[0] !== className) {
26
+ t2 = cn("flex min-w-0 flex-col gap-2", className);
27
+ $[0] = className;
28
+ $[1] = t2;
29
+ } else {
30
+ t2 = $[1];
31
+ }
32
+ let t3;
33
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
34
+ t3 = /*#__PURE__*/_jsx(HistoryIcon, {
35
+ "aria-hidden": true
36
+ });
37
+ $[2] = t3;
38
+ } else {
39
+ t3 = $[2];
40
+ }
41
+ let t4;
42
+ if ($[3] !== memories.length) {
43
+ t4 = pluralize(memories.length, "memory", "memories");
44
+ $[3] = memories.length;
45
+ $[4] = t4;
46
+ } else {
47
+ t4 = $[4];
48
+ }
49
+ let t5;
50
+ if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
51
+ t5 = /*#__PURE__*/_jsx(ChevronRightIcon, {
52
+ "aria-hidden": true,
53
+ className: chevronClass
54
+ });
55
+ $[5] = t5;
56
+ } else {
57
+ t5 = $[5];
58
+ }
59
+ let t6;
60
+ if ($[6] !== t4) {
61
+ t6 = /*#__PURE__*/_jsxs(CollapsibleTrigger, {
21
62
  className: collapsibleTriggerClass,
22
- children: [/*#__PURE__*/_jsx(HistoryIcon, {
23
- "aria-hidden": true
24
- }), "Recalled ", pluralize(memories.length, "memory", "memories"), /*#__PURE__*/_jsx(ChevronRightIcon, {
25
- "aria-hidden": true,
26
- className: chevronClass
27
- })]
28
- }), /*#__PURE__*/_jsx(CollapsibleContent, {
63
+ children: [t3, "Recalled ", t4, t5]
64
+ });
65
+ $[6] = t4;
66
+ $[7] = t6;
67
+ } else {
68
+ t6 = $[7];
69
+ }
70
+ let t7;
71
+ if ($[8] !== memories || $[9] !== onOpenMemory) {
72
+ let t8;
73
+ if ($[11] !== onOpenMemory) {
74
+ t8 = memory => /*#__PURE__*/_jsx(RecallRow, {
75
+ memory: memory,
76
+ onOpenMemory: onOpenMemory
77
+ }, memory.id);
78
+ $[11] = onOpenMemory;
79
+ $[12] = t8;
80
+ } else {
81
+ t8 = $[12];
82
+ }
83
+ t7 = memories.map(t8);
84
+ $[8] = memories;
85
+ $[9] = onOpenMemory;
86
+ $[10] = t7;
87
+ } else {
88
+ t7 = $[10];
89
+ }
90
+ let t8;
91
+ if ($[13] !== t7) {
92
+ t8 = /*#__PURE__*/_jsx(CollapsibleContent, {
29
93
  children: /*#__PURE__*/_jsx("ul", {
30
94
  className: ruledListClass,
31
- children: memories.map(memory => /*#__PURE__*/_jsx(RecallRow, {
32
- memory: memory,
33
- onOpenMemory: onOpenMemory
34
- }, memory.id))
95
+ children: t7
35
96
  })
36
- })]
37
- });
97
+ });
98
+ $[13] = t7;
99
+ $[14] = t8;
100
+ } else {
101
+ t8 = $[14];
102
+ }
103
+ let t9;
104
+ if ($[15] !== defaultOpen || $[16] !== t2 || $[17] !== t6 || $[18] !== t8) {
105
+ t9 = /*#__PURE__*/_jsxs(Collapsible, {
106
+ "data-slot": "recall",
107
+ defaultOpen: defaultOpen,
108
+ className: t2,
109
+ children: [t6, t8]
110
+ });
111
+ $[15] = defaultOpen;
112
+ $[16] = t2;
113
+ $[17] = t6;
114
+ $[18] = t8;
115
+ $[19] = t9;
116
+ } else {
117
+ t9 = $[19];
118
+ }
119
+ return t9;
38
120
  }
39
- function RelevanceMeter({
40
- memory
41
- }) {
42
- if (memory.relevance === undefined) return null;
43
- const percent = relevancePercent(memory.relevance);
44
- return /*#__PURE__*/_jsxs("span", {
45
- className: "flex shrink-0 items-center gap-2",
46
- children: [/*#__PURE__*/_jsx("span", {
121
+ function RelevanceMeter(t0) {
122
+ const $ = _c(14);
123
+ const {
124
+ memory
125
+ } = t0;
126
+ if (memory.relevance === undefined) {
127
+ return null;
128
+ }
129
+ let t1;
130
+ if ($[0] !== memory.relevance) {
131
+ t1 = relevancePercent(memory.relevance);
132
+ $[0] = memory.relevance;
133
+ $[1] = t1;
134
+ } else {
135
+ t1 = $[1];
136
+ }
137
+ const percent = t1;
138
+ const t2 = `Relevance of ${memory.label}`;
139
+ const t3 = `${percent}% relevant`;
140
+ const t4 = `${percent}%`;
141
+ let t5;
142
+ if ($[2] !== t4) {
143
+ t5 = /*#__PURE__*/_jsx("span", {
144
+ className: "absolute inset-y-0 left-0 bg-foreground/60 transition-[width] duration-300 motion-reduce:transition-none",
145
+ style: {
146
+ width: t4
147
+ }
148
+ });
149
+ $[2] = t4;
150
+ $[3] = t5;
151
+ } else {
152
+ t5 = $[3];
153
+ }
154
+ let t6;
155
+ if ($[4] !== percent || $[5] !== t2 || $[6] !== t3 || $[7] !== t5) {
156
+ t6 = /*#__PURE__*/_jsx("span", {
47
157
  role: "meter",
48
- "aria-label": `Relevance of ${memory.label}`,
158
+ "aria-label": t2,
49
159
  "aria-valuemin": 0,
50
160
  "aria-valuemax": 100,
51
161
  "aria-valuenow": percent,
52
- "aria-valuetext": `${percent}% relevant`,
162
+ "aria-valuetext": t3,
53
163
  className: "relative h-[3px] w-10 overflow-hidden bg-muted",
54
- children: /*#__PURE__*/_jsx("span", {
55
- className: "absolute inset-y-0 left-0 bg-foreground/60 transition-[width] duration-300 motion-reduce:transition-none",
56
- style: {
57
- width: `${percent}%`
58
- }
59
- })
60
- }), /*#__PURE__*/_jsxs("span", {
164
+ children: t5
165
+ });
166
+ $[4] = percent;
167
+ $[5] = t2;
168
+ $[6] = t3;
169
+ $[7] = t5;
170
+ $[8] = t6;
171
+ } else {
172
+ t6 = $[8];
173
+ }
174
+ let t7;
175
+ if ($[9] !== percent) {
176
+ t7 = /*#__PURE__*/_jsxs("span", {
61
177
  className: "w-8 text-right font-mono text-xs text-muted-foreground tabular-nums",
62
178
  children: [percent, "%"]
63
- })]
64
- });
179
+ });
180
+ $[9] = percent;
181
+ $[10] = t7;
182
+ } else {
183
+ t7 = $[10];
184
+ }
185
+ let t8;
186
+ if ($[11] !== t6 || $[12] !== t7) {
187
+ t8 = /*#__PURE__*/_jsxs("span", {
188
+ className: "flex shrink-0 items-center gap-2",
189
+ children: [t6, t7]
190
+ });
191
+ $[11] = t6;
192
+ $[12] = t7;
193
+ $[13] = t8;
194
+ } else {
195
+ t8 = $[13];
196
+ }
197
+ return t8;
65
198
  }
66
- function RecallRow({
67
- memory,
68
- onOpenMemory
69
- }) {
70
- const content = /*#__PURE__*/_jsxs(_Fragment, {
71
- children: [/*#__PURE__*/_jsxs("span", {
199
+ function RecallRow(t0) {
200
+ const $ = _c(21);
201
+ const {
202
+ memory,
203
+ onOpenMemory
204
+ } = t0;
205
+ let t1;
206
+ if ($[0] !== memory.label) {
207
+ t1 = /*#__PURE__*/_jsx("span", {
208
+ className: "min-w-0 flex-1 truncate text-sm font-medium",
209
+ children: memory.label
210
+ });
211
+ $[0] = memory.label;
212
+ $[1] = t1;
213
+ } else {
214
+ t1 = $[1];
215
+ }
216
+ let t2;
217
+ if ($[2] !== memory) {
218
+ t2 = /*#__PURE__*/_jsx(RelevanceMeter, {
219
+ memory: memory
220
+ });
221
+ $[2] = memory;
222
+ $[3] = t2;
223
+ } else {
224
+ t2 = $[3];
225
+ }
226
+ let t3;
227
+ if ($[4] !== t1 || $[5] !== t2) {
228
+ t3 = /*#__PURE__*/_jsxs("span", {
72
229
  className: "flex w-full items-baseline gap-3",
73
- children: [/*#__PURE__*/_jsx("span", {
74
- className: "min-w-0 flex-1 truncate text-sm font-medium",
75
- children: memory.label
76
- }), /*#__PURE__*/_jsx(RelevanceMeter, {
77
- memory: memory
78
- })]
79
- }), (memory.kind || memory.snippet) && /*#__PURE__*/_jsxs("span", {
230
+ children: [t1, t2]
231
+ });
232
+ $[4] = t1;
233
+ $[5] = t2;
234
+ $[6] = t3;
235
+ } else {
236
+ t3 = $[6];
237
+ }
238
+ let t4;
239
+ if ($[7] !== memory.kind || $[8] !== memory.snippet) {
240
+ t4 = (memory.kind || memory.snippet) && /*#__PURE__*/_jsxs("span", {
80
241
  className: "flex w-full gap-2 text-xs text-muted-foreground",
81
242
  children: [memory.kind && /*#__PURE__*/_jsx("span", {
82
243
  className: "shrink-0 font-mono",
@@ -88,21 +249,57 @@ function RecallRow({
88
249
  className: "line-clamp-2 min-w-0",
89
250
  children: memory.snippet
90
251
  })]
91
- })]
92
- });
93
- const rowClass = "flex w-full flex-col items-start gap-1 px-3 py-2.5 text-left";
94
- return /*#__PURE__*/_jsx("li", {
95
- "data-slot": "recall-item",
96
- "data-id": memory.id,
97
- children: onOpenMemory ? /*#__PURE__*/_jsx("button", {
252
+ });
253
+ $[7] = memory.kind;
254
+ $[8] = memory.snippet;
255
+ $[9] = t4;
256
+ } else {
257
+ t4 = $[9];
258
+ }
259
+ let t5;
260
+ if ($[10] !== t3 || $[11] !== t4) {
261
+ t5 = /*#__PURE__*/_jsxs(_Fragment, {
262
+ children: [t3, t4]
263
+ });
264
+ $[10] = t3;
265
+ $[11] = t4;
266
+ $[12] = t5;
267
+ } else {
268
+ t5 = $[12];
269
+ }
270
+ const content = t5;
271
+ let t6;
272
+ if ($[13] !== content || $[14] !== memory.id || $[15] !== memory.label || $[16] !== onOpenMemory) {
273
+ t6 = onOpenMemory ? /*#__PURE__*/_jsx("button", {
98
274
  type: "button",
99
275
  "aria-label": `Open memory ${memory.label}`,
100
276
  onClick: () => onOpenMemory(memory.id),
101
- className: cn(rowClass, interactiveRowClass),
277
+ className: cn("flex w-full flex-col items-start gap-1 px-3 py-2.5 text-left", interactiveRowClass),
102
278
  children: content
103
279
  }) : /*#__PURE__*/_jsx("div", {
104
- className: rowClass,
280
+ className: "flex w-full flex-col items-start gap-1 px-3 py-2.5 text-left",
105
281
  children: content
106
- })
107
- });
282
+ });
283
+ $[13] = content;
284
+ $[14] = memory.id;
285
+ $[15] = memory.label;
286
+ $[16] = onOpenMemory;
287
+ $[17] = t6;
288
+ } else {
289
+ t6 = $[17];
290
+ }
291
+ let t7;
292
+ if ($[18] !== memory.id || $[19] !== t6) {
293
+ t7 = /*#__PURE__*/_jsx("li", {
294
+ "data-slot": "recall-item",
295
+ "data-id": memory.id,
296
+ children: t6
297
+ });
298
+ $[18] = memory.id;
299
+ $[19] = t6;
300
+ $[20] = t7;
301
+ } else {
302
+ t7 = $[20];
303
+ }
304
+ return t7;
108
305
  }
@@ -1,3 +1,6 @@
1
+ "use client";
2
+
3
+ import { c as _c } from "react/compiler-runtime";
1
4
  import { ChevronRight as ChevronRightIcon } from "@carbon/icons-react";
2
5
  import { Collapsible, CollapsibleContent, CollapsibleTrigger, cn } from "@locusgraph/components";
3
6
  import { pluralize } from "@locusgraph/utils";
@@ -6,81 +9,258 @@ import { hostLabel, sourceKey, toCitation } from "./shared/host-label.js";
6
9
  import { SourceMark } from "./shared/source-mark.js";
7
10
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
8
11
  const stackedMarkLimit = 3;
9
- export function Sources({
10
- sources,
11
- onOpen,
12
- defaultOpen = false,
13
- className
14
- }) {
15
- if (sources.length === 0) return null;
16
- const citations = sources.map(toCitation);
17
- return /*#__PURE__*/_jsxs(Collapsible, {
18
- "data-slot": "sources",
19
- defaultOpen: defaultOpen,
20
- className: cn("flex min-w-0 flex-col gap-2", className),
21
- children: [/*#__PURE__*/_jsxs(CollapsibleTrigger, {
12
+ export function Sources(t0) {
13
+ const $ = _c(35);
14
+ const {
15
+ sources,
16
+ onOpen,
17
+ defaultOpen: t1,
18
+ className
19
+ } = t0;
20
+ const defaultOpen = t1 === undefined ? false : t1;
21
+ if (sources.length === 0) {
22
+ return null;
23
+ }
24
+ let T0;
25
+ let T1;
26
+ let t2;
27
+ let t3;
28
+ let t4;
29
+ let t5;
30
+ let t6;
31
+ let t7;
32
+ if ($[0] !== className || $[1] !== defaultOpen || $[2] !== onOpen || $[3] !== sources) {
33
+ const citations = sources.map(toCitation);
34
+ T1 = Collapsible;
35
+ t4 = "sources";
36
+ t5 = defaultOpen;
37
+ if ($[12] !== className) {
38
+ t6 = cn("flex min-w-0 flex-col gap-2", className);
39
+ $[12] = className;
40
+ $[13] = t6;
41
+ } else {
42
+ t6 = $[13];
43
+ }
44
+ let t8;
45
+ if ($[14] !== sources) {
46
+ t8 = (citation, position) => /*#__PURE__*/_jsx(SourceMark, {
47
+ citation: citation,
48
+ className: "ring-card"
49
+ }, sourceKey(sources[position], position));
50
+ $[14] = sources;
51
+ $[15] = t8;
52
+ } else {
53
+ t8 = $[15];
54
+ }
55
+ let t9;
56
+ if ($[16] !== sources.length) {
57
+ t9 = pluralize(sources.length, "source");
58
+ $[16] = sources.length;
59
+ $[17] = t9;
60
+ } else {
61
+ t9 = $[17];
62
+ }
63
+ let t10;
64
+ if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
65
+ t10 = /*#__PURE__*/_jsx(ChevronRightIcon, {
66
+ "aria-hidden": true,
67
+ className: chevronClass
68
+ });
69
+ $[18] = t10;
70
+ } else {
71
+ t10 = $[18];
72
+ }
73
+ t7 = /*#__PURE__*/_jsxs(CollapsibleTrigger, {
22
74
  className: collapsibleTriggerClass,
23
75
  children: [/*#__PURE__*/_jsx("span", {
24
76
  "aria-hidden": true,
25
77
  className: "flex -space-x-1",
26
- children: citations.slice(0, stackedMarkLimit).map((citation, position) => /*#__PURE__*/_jsx(SourceMark, {
27
- citation: citation,
28
- className: "ring-card"
29
- }, sourceKey(sources[position], position)))
30
- }), "Used ", pluralize(sources.length, "source"), /*#__PURE__*/_jsx(ChevronRightIcon, {
31
- "aria-hidden": true,
32
- className: chevronClass
33
- })]
34
- }), /*#__PURE__*/_jsx(CollapsibleContent, {
35
- children: /*#__PURE__*/_jsx("ol", {
36
- className: ruledListClass,
37
- children: citations.map((citation, position) => /*#__PURE__*/_jsx(SourceRow, {
38
- citation: citation,
39
- onOpen: onOpen
40
- }, sourceKey(sources[position], position)))
41
- })
42
- })]
43
- });
78
+ children: citations.slice(0, stackedMarkLimit).map(t8)
79
+ }), "Used ", t9, t10]
80
+ });
81
+ T0 = CollapsibleContent;
82
+ t2 = ruledListClass;
83
+ let t11;
84
+ if ($[19] !== onOpen || $[20] !== sources) {
85
+ t11 = (citation_0, position_0) => /*#__PURE__*/_jsx(SourceRow, {
86
+ citation: citation_0,
87
+ onOpen: onOpen
88
+ }, sourceKey(sources[position_0], position_0));
89
+ $[19] = onOpen;
90
+ $[20] = sources;
91
+ $[21] = t11;
92
+ } else {
93
+ t11 = $[21];
94
+ }
95
+ t3 = citations.map(t11);
96
+ $[0] = className;
97
+ $[1] = defaultOpen;
98
+ $[2] = onOpen;
99
+ $[3] = sources;
100
+ $[4] = T0;
101
+ $[5] = T1;
102
+ $[6] = t2;
103
+ $[7] = t3;
104
+ $[8] = t4;
105
+ $[9] = t5;
106
+ $[10] = t6;
107
+ $[11] = t7;
108
+ } else {
109
+ T0 = $[4];
110
+ T1 = $[5];
111
+ t2 = $[6];
112
+ t3 = $[7];
113
+ t4 = $[8];
114
+ t5 = $[9];
115
+ t6 = $[10];
116
+ t7 = $[11];
117
+ }
118
+ let t8;
119
+ if ($[22] !== t2 || $[23] !== t3) {
120
+ t8 = /*#__PURE__*/_jsx("ol", {
121
+ className: t2,
122
+ children: t3
123
+ });
124
+ $[22] = t2;
125
+ $[23] = t3;
126
+ $[24] = t8;
127
+ } else {
128
+ t8 = $[24];
129
+ }
130
+ let t9;
131
+ if ($[25] !== T0 || $[26] !== t8) {
132
+ t9 = /*#__PURE__*/_jsx(T0, {
133
+ children: t8
134
+ });
135
+ $[25] = T0;
136
+ $[26] = t8;
137
+ $[27] = t9;
138
+ } else {
139
+ t9 = $[27];
140
+ }
141
+ let t10;
142
+ if ($[28] !== T1 || $[29] !== t4 || $[30] !== t5 || $[31] !== t6 || $[32] !== t7 || $[33] !== t9) {
143
+ t10 = /*#__PURE__*/_jsxs(T1, {
144
+ "data-slot": t4,
145
+ defaultOpen: t5,
146
+ className: t6,
147
+ children: [t7, t9]
148
+ });
149
+ $[28] = T1;
150
+ $[29] = t4;
151
+ $[30] = t5;
152
+ $[31] = t6;
153
+ $[32] = t7;
154
+ $[33] = t9;
155
+ $[34] = t10;
156
+ } else {
157
+ t10 = $[34];
158
+ }
159
+ return t10;
44
160
  }
45
- function SourceRow({
46
- citation,
47
- onOpen
48
- }) {
49
- const host = hostLabel(citation.url);
161
+ function SourceRow(t0) {
162
+ const $ = _c(21);
163
+ const {
164
+ citation,
165
+ onOpen
166
+ } = t0;
167
+ let t1;
168
+ if ($[0] !== citation.url) {
169
+ t1 = hostLabel(citation.url);
170
+ $[0] = citation.url;
171
+ $[1] = t1;
172
+ } else {
173
+ t1 = $[1];
174
+ }
175
+ const host = t1;
50
176
  const showHost = host !== undefined && host !== citation.title;
51
- const content = /*#__PURE__*/_jsxs(_Fragment, {
52
- children: [/*#__PURE__*/_jsx("span", {
177
+ let t2;
178
+ if ($[2] !== citation.index) {
179
+ t2 = /*#__PURE__*/_jsx("span", {
53
180
  className: "w-4 shrink-0 font-mono text-xs text-muted-foreground tabular-nums",
54
181
  children: citation.index
55
- }), /*#__PURE__*/_jsx("span", {
182
+ });
183
+ $[2] = citation.index;
184
+ $[3] = t2;
185
+ } else {
186
+ t2 = $[3];
187
+ }
188
+ let t3;
189
+ if ($[4] !== citation.title) {
190
+ t3 = /*#__PURE__*/_jsx("span", {
56
191
  className: "min-w-0 flex-1 truncate",
57
192
  children: citation.title
58
- }), showHost && /*#__PURE__*/_jsx("span", {
193
+ });
194
+ $[4] = citation.title;
195
+ $[5] = t3;
196
+ } else {
197
+ t3 = $[5];
198
+ }
199
+ let t4;
200
+ if ($[6] !== host || $[7] !== showHost) {
201
+ t4 = showHost && /*#__PURE__*/_jsx("span", {
59
202
  className: "max-w-[40%] shrink-0 truncate text-xs text-muted-foreground",
60
203
  children: host
61
- })]
62
- });
63
- const rowClass = ruledRowClass;
204
+ });
205
+ $[6] = host;
206
+ $[7] = showHost;
207
+ $[8] = t4;
208
+ } else {
209
+ t4 = $[8];
210
+ }
211
+ let t5;
212
+ if ($[9] !== t2 || $[10] !== t3 || $[11] !== t4) {
213
+ t5 = /*#__PURE__*/_jsxs(_Fragment, {
214
+ children: [t2, t3, t4]
215
+ });
216
+ $[9] = t2;
217
+ $[10] = t3;
218
+ $[11] = t4;
219
+ $[12] = t5;
220
+ } else {
221
+ t5 = $[12];
222
+ }
223
+ const content = t5;
64
224
  const label = `Open source ${citation.index}: ${citation.title}`;
65
- return /*#__PURE__*/_jsx("li", {
66
- "data-slot": "sources-item",
67
- "data-index": citation.index,
68
- children: onOpen ? /*#__PURE__*/_jsx("button", {
225
+ let t6;
226
+ if ($[13] !== citation || $[14] !== content || $[15] !== label || $[16] !== onOpen) {
227
+ t6 = onOpen ? /*#__PURE__*/_jsx("button", {
69
228
  type: "button",
70
229
  "aria-label": label,
71
230
  onClick: () => onOpen(citation),
72
- className: cn(rowClass, interactiveRowClass),
231
+ className: cn(ruledRowClass, interactiveRowClass),
73
232
  children: content
74
233
  }) : citation.url ? /*#__PURE__*/_jsx("a", {
75
234
  href: citation.url,
76
235
  target: "_blank",
77
236
  rel: "noreferrer",
78
237
  "aria-label": label,
79
- className: cn(rowClass, interactiveRowClass),
238
+ className: cn(ruledRowClass, interactiveRowClass),
80
239
  children: content
81
240
  }) : /*#__PURE__*/_jsx("div", {
82
- className: rowClass,
241
+ className: ruledRowClass,
83
242
  children: content
84
- })
85
- });
243
+ });
244
+ $[13] = citation;
245
+ $[14] = content;
246
+ $[15] = label;
247
+ $[16] = onOpen;
248
+ $[17] = t6;
249
+ } else {
250
+ t6 = $[17];
251
+ }
252
+ let t7;
253
+ if ($[18] !== citation.index || $[19] !== t6) {
254
+ t7 = /*#__PURE__*/_jsx("li", {
255
+ "data-slot": "sources-item",
256
+ "data-index": citation.index,
257
+ children: t6
258
+ });
259
+ $[18] = citation.index;
260
+ $[19] = t6;
261
+ $[20] = t7;
262
+ } else {
263
+ t7 = $[20];
264
+ }
265
+ return t7;
86
266
  }
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  import { defaultRangeExtractor, useVirtualizer } from "@tanstack/react-virtual";
2
4
  import { useCallback, useState } from "react";
3
5
  export const virtualizeAboveCount = 50;