@ahmetilhn/hanui 4.1.0 → 5.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/README.md +259 -39
  2. package/build/charts.cjs +2 -0
  3. package/build/charts.cjs.map +1 -0
  4. package/build/charts.css +1 -0
  5. package/build/charts.js +1843 -0
  6. package/build/charts.js.map +1 -0
  7. package/build/chat.cjs +3 -0
  8. package/build/chat.cjs.map +1 -0
  9. package/build/chat.css +1 -0
  10. package/build/chat.js +707 -0
  11. package/build/chat.js.map +1 -0
  12. package/build/index.cjs +7 -7
  13. package/build/index.cjs.map +1 -1
  14. package/build/index.d.ts +472 -222
  15. package/build/index.js +3336 -3096
  16. package/build/index.js.map +1 -1
  17. package/build/scss/_colors.generated.scss +119 -0
  18. package/build/scss/_index.scss +6 -0
  19. package/build/scss/_metrics.generated.scss +49 -0
  20. package/build/scss/_mixins.scss +675 -0
  21. package/build/scss/_variables.scss +51 -0
  22. package/build/styles.css +1 -1
  23. package/build/types/charts/AreaChart/index.d.ts +14 -0
  24. package/build/types/charts/BarChart/index.d.ts +16 -0
  25. package/build/types/charts/BoxPlot/index.d.ts +43 -0
  26. package/build/types/charts/ComposedChart/index.d.ts +16 -0
  27. package/build/types/charts/Heatmap/index.d.ts +30 -0
  28. package/build/types/charts/Histogram/index.d.ts +29 -0
  29. package/build/types/charts/LineChart/index.d.ts +14 -0
  30. package/build/types/charts/PieChart/index.d.ts +36 -0
  31. package/build/types/charts/RadarChart/index.d.ts +40 -0
  32. package/build/types/charts/ScatterPlot/index.d.ts +41 -0
  33. package/build/types/charts/core/CartesianChart.d.ts +43 -0
  34. package/build/types/charts/core/ChartFrame.d.ts +55 -0
  35. package/build/types/charts/core/axes.d.ts +34 -0
  36. package/build/types/charts/core/cartesian.d.ts +79 -0
  37. package/build/types/charts/core/format.d.ts +9 -0
  38. package/build/types/charts/core/margins.d.ts +9 -0
  39. package/build/types/charts/core/palette.d.ts +13 -0
  40. package/build/types/charts/core/path.d.ts +24 -0
  41. package/build/types/charts/core/scale.d.ts +40 -0
  42. package/build/types/charts/core/series.d.ts +11 -0
  43. package/build/types/charts/core/spatial.d.ts +12 -0
  44. package/build/types/charts/core/stats.d.ts +34 -0
  45. package/build/types/charts/core/types.d.ts +31 -0
  46. package/build/types/charts/core/useChartWidth.d.ts +7 -0
  47. package/build/types/charts/index.d.ts +21 -0
  48. package/build/types/chat/ActionList/index.d.ts +46 -0
  49. package/build/types/chat/AppBar/index.d.ts +21 -0
  50. package/build/types/chat/ChatMessage/index.d.ts +24 -0
  51. package/build/types/chat/ChatThread/index.d.ts +24 -0
  52. package/build/types/chat/Citation/index.d.ts +15 -0
  53. package/build/types/chat/CodeBlock/index.d.ts +27 -0
  54. package/build/types/chat/DescriptionList/index.d.ts +16 -0
  55. package/build/types/chat/Legend/index.d.ts +20 -0
  56. package/build/types/chat/MessageActions/index.d.ts +21 -0
  57. package/build/types/chat/PromptInput/index.d.ts +47 -0
  58. package/build/types/chat/PromptSuggestions/index.d.ts +25 -0
  59. package/build/types/chat/Prose/index.d.ts +15 -0
  60. package/build/types/chat/ReasoningBlock/index.d.ts +24 -0
  61. package/build/types/chat/ReasoningText/index.d.ts +14 -0
  62. package/build/types/chat/SegmentBar/index.d.ts +46 -0
  63. package/build/types/chat/SourceList/index.d.ts +25 -0
  64. package/build/types/chat/TerminalOutput/index.d.ts +25 -0
  65. package/build/types/chat/ToolCall/index.d.ts +41 -0
  66. package/build/types/chat/index.d.ts +26 -0
  67. package/build/types/helpers/class-name.helper.d.ts +3 -0
  68. package/build/types/helpers/component.helper.d.ts +13 -0
  69. package/build/types/helpers/label.helper.d.ts +12 -0
  70. package/build/types/theme/palette.d.ts +203 -0
  71. package/build/types/theme/tokens.d.ts +208 -0
  72. package/build/types/types/common-element-props.type.d.ts +8 -0
  73. package/build/types/types/link.type.d.ts +14 -0
  74. package/build/types/types/theme.type.d.ts +223 -0
  75. package/package.json +19 -2
package/build/chat.js ADDED
@@ -0,0 +1,707 @@
1
+ "use client";
2
+ import { jsxs as u, jsx as t, Fragment as it } from "react/jsx-runtime";
3
+ import { memo as b, useRef as A, useEffect as P, forwardRef as ot, useState as X, Children as lt, isValidElement as ct, cloneElement as rt } from "react";
4
+ import { ArrowDown as _t, StopFill as dt, ArrowUp as mt, CheckLg as ht, ClipboardFill as ut } from "react-bootstrap-icons";
5
+ import { useHanui as w, useAnnounce as tt, useStickToBottom as et, IconButton as G, Textarea as pt, hasOpenSurface as bt, Disclosure as at, Spinner as gt, ScrollArea as yt, StatusDot as vt } from "@ahmetilhn/hanui";
6
+ const h = (...e) => {
7
+ let a = "";
8
+ for (const n of e)
9
+ n && (a = a === "" ? n : `${a} ${n}`);
10
+ return a;
11
+ }, g = (e, a) => Object.assign(e, { displayName: a }), H = /* @__PURE__ */ new Set(), x = (e, ...a) => {
12
+ for (const n of a) if (n !== void 0) return n;
13
+ return process.env.NODE_ENV !== "production" && !H.has(e) && (H.add(e), console.error(
14
+ `[hanui] Eksik metin: ${e}. Prop olarak geçin ya da <HanuiProvider labels={…}> içinde bir kez tanımlayın. Metinsiz bırakılan öğe ekran okuyucuda adsız kalır.`
15
+ )), "";
16
+ }, nt = (e, a, ...n) => a ? a(...n) : x(e), Nt = "hanui-thread-R1LCJ", kt = "hanui-thread__scroll-37EaI", xt = "hanui-thread__column-57FQh", ft = "hanui-thread__dock-y0Tt9", Ct = "hanui-thread__latest-ZNmqY", L = {
17
+ thread: Nt,
18
+ thread__scroll: kt,
19
+ thread__column: xt,
20
+ thread__dock: ft,
21
+ thread__latest: Ct
22
+ }, $t = ({ children: e, dock: a, isStreaming: n, label: i, className: o, testId: l }) => {
23
+ var p, y, N;
24
+ const { labels: s } = w(), d = tt(), c = A(null), { isAtEnd: _, scrollToEnd: r } = et(c), m = A(n);
25
+ return P(() => {
26
+ var f;
27
+ m.current && !n && d(x("ChatThread.replyReady", (f = s == null ? void 0 : s.chat) == null ? void 0 : f.replyReady)), m.current = n;
28
+ }, [d, n, (p = s == null ? void 0 : s.chat) == null ? void 0 : p.replyReady]), /* @__PURE__ */ u("div", { className: h(L.thread, o), "data-testid": l, children: [
29
+ /* @__PURE__ */ t(
30
+ "div",
31
+ {
32
+ ref: c,
33
+ className: L.thread__scroll,
34
+ role: "region",
35
+ "aria-label": x("ChatThread.label", i, (y = s == null ? void 0 : s.chat) == null ? void 0 : y.thread),
36
+ tabIndex: 0,
37
+ children: /* @__PURE__ */ t("div", { className: L.thread__column, children: e })
38
+ }
39
+ ),
40
+ /* @__PURE__ */ u("div", { className: L.thread__dock, children: [
41
+ !_ && /* @__PURE__ */ t(
42
+ G,
43
+ {
44
+ className: L.thread__latest,
45
+ icon: /* @__PURE__ */ t(_t, { "aria-hidden": !0 }),
46
+ label: x("ChatThread.scrollToLatest", (N = s == null ? void 0 : s.chat) == null ? void 0 : N.scrollToLatest),
47
+ variant: "outline",
48
+ shape: "round",
49
+ size: "sm",
50
+ onClick: r
51
+ }
52
+ ),
53
+ a !== void 0 && /* @__PURE__ */ t("div", { className: L.thread__column, children: a })
54
+ ] })
55
+ ] });
56
+ }, Na = /* @__PURE__ */ b(
57
+ /* @__PURE__ */ g($t, "ChatThread")
58
+ ), wt = "hanui-message-z5uVx", Tt = "hanui-message__avatar-QzWck", St = "hanui-message__main-1rh-A", At = "hanui-message__body-Ngiqq", Lt = "hanui-message__actions-dQ0Fn", E = {
59
+ message: wt,
60
+ "message--user": "hanui-message--user-Mq6gb",
61
+ message__avatar: Tt,
62
+ message__main: St,
63
+ "message--assistant": "hanui-message--assistant-ndkmH",
64
+ message__body: At,
65
+ message__actions: Lt
66
+ }, Et = ({
67
+ author: e,
68
+ children: a,
69
+ avatar: n,
70
+ actions: i,
71
+ isStreaming: o,
72
+ className: l,
73
+ testId: s
74
+ }) => /* @__PURE__ */ u(
75
+ "article",
76
+ {
77
+ className: h(E.message, E[`message--${e}`], l),
78
+ "aria-busy": o || void 0,
79
+ "data-testid": s,
80
+ children: [
81
+ e === "assistant" && n !== void 0 && /* @__PURE__ */ t("div", { className: E.message__avatar, children: n }),
82
+ /* @__PURE__ */ u("div", { className: E.message__main, children: [
83
+ /* @__PURE__ */ t("div", { className: E.message__body, children: a }),
84
+ i !== void 0 && /* @__PURE__ */ t("div", { className: E.message__actions, children: i })
85
+ ] })
86
+ ]
87
+ }
88
+ ), ka = /* @__PURE__ */ b(
89
+ /* @__PURE__ */ g(Et, "ChatMessage")
90
+ ), zt = "hanui-prompt-qHV1e", Mt = "hanui-prompt__box-sUQDu", Ot = "hanui-prompt__field-EmvTZ", Bt = "hanui-prompt__start-2tqre", Pt = "hanui-prompt__end-Zp7fi", It = "hanui-prompt__hint-4TpeC", S = {
91
+ prompt: zt,
92
+ prompt__box: Mt,
93
+ "prompt__box--disabled": "hanui-prompt__box--disabled-xu-Yk",
94
+ prompt__field: Ot,
95
+ prompt__start: Bt,
96
+ prompt__end: Pt,
97
+ prompt__hint: It
98
+ }, Dt = /* @__PURE__ */ ot(
99
+ ({
100
+ value: e,
101
+ onChange: a,
102
+ onSubmit: n,
103
+ onStop: i,
104
+ isBusy: o,
105
+ isDisabled: l,
106
+ isSubmitDisabled: s,
107
+ placeholder: d,
108
+ label: c,
109
+ maxRows: _ = 8,
110
+ hint: r,
111
+ start: m,
112
+ end: p,
113
+ className: y,
114
+ testId: N
115
+ }, f) => {
116
+ var j, Q;
117
+ const { labels: C } = w(), V = e.trim() === "";
118
+ P(() => {
119
+ if (!o || !i) return;
120
+ const $ = (U) => {
121
+ U.key !== "Escape" || U.defaultPrevented || bt() || i();
122
+ };
123
+ return document.addEventListener("keydown", $), () => document.removeEventListener("keydown", $);
124
+ }, [o, i]);
125
+ const st = ($) => {
126
+ $.key !== "Enter" || $.shiftKey || $.nativeEvent.isComposing || ($.preventDefault(), !V && !o && !l && !s && n());
127
+ };
128
+ return /* @__PURE__ */ u("div", { className: h(S.prompt, y), "data-testid": N, children: [
129
+ /* @__PURE__ */ u("div", { className: h(S.prompt__box, l && S["prompt__box--disabled"]), children: [
130
+ m !== void 0 && /* @__PURE__ */ t("div", { className: S.prompt__start, children: m }),
131
+ /* @__PURE__ */ t(
132
+ pt,
133
+ {
134
+ ref: f,
135
+ className: S.prompt__field,
136
+ variant: "bare",
137
+ rows: 1,
138
+ isAutoSize: !0,
139
+ maxRows: _,
140
+ value: e,
141
+ placeholder: d,
142
+ "aria-label": c ?? d,
143
+ disabled: l,
144
+ onChange: ($) => a($.target.value),
145
+ onKeyDown: st
146
+ }
147
+ ),
148
+ p !== void 0 && /* @__PURE__ */ t("div", { className: S.prompt__end, children: p }),
149
+ o ? /* @__PURE__ */ t(
150
+ G,
151
+ {
152
+ icon: /* @__PURE__ */ t(dt, { "aria-hidden": !0 }),
153
+ label: x("PromptInput.stop", (j = C == null ? void 0 : C.chat) == null ? void 0 : j.stop),
154
+ variant: "outline",
155
+ shape: "round",
156
+ onClick: i,
157
+ disabled: !i
158
+ }
159
+ ) : /* @__PURE__ */ t(
160
+ G,
161
+ {
162
+ icon: /* @__PURE__ */ t(mt, { "aria-hidden": !0 }),
163
+ label: x("PromptInput.send", (Q = C == null ? void 0 : C.chat) == null ? void 0 : Q.send),
164
+ variant: "solid",
165
+ shape: "round",
166
+ onClick: n,
167
+ disabled: V || l || s
168
+ }
169
+ )
170
+ ] }),
171
+ r !== void 0 && /* @__PURE__ */ t("div", { className: S.prompt__hint, children: r })
172
+ ] });
173
+ }
174
+ ), xa = /* @__PURE__ */ b(
175
+ /* @__PURE__ */ g(Dt, "PromptInput")
176
+ ), Rt = "hanui-grid-4EfQ-", Ft = "hanui-card-KTt0-", Kt = "hanui-card__label-LNLTF", Gt = "hanui-card__description-eIx-0", I = {
177
+ grid: Rt,
178
+ card: Ft,
179
+ card__label: Kt,
180
+ card__description: Gt
181
+ }, qt = ({ label: e, items: a, onPick: n, className: i, testId: o }) => /* @__PURE__ */ t("div", { role: "group", "aria-label": e, className: h(I.grid, i), "data-testid": o, children: a.map((l) => /* @__PURE__ */ u("button", { type: "button", className: I.card, onClick: () => n(l), children: [
182
+ /* @__PURE__ */ t("span", { className: I.card__label, children: l.label }),
183
+ l.description && /* @__PURE__ */ t("span", { className: I.card__description, children: l.description })
184
+ ] }, l.id)) }), fa = /* @__PURE__ */ b(
185
+ /* @__PURE__ */ g(qt, "PromptSuggestions")
186
+ ), Xt = "hanui-prose-kAp6f", Vt = {
187
+ prose: Xt
188
+ }, jt = ({ className: e, testId: a, ...n }) => /* @__PURE__ */ t("div", { className: h(Vt.prose, e), "data-testid": a, ...n }), Ca = /* @__PURE__ */ b(/* @__PURE__ */ g(jt, "Prose")), Qt = "hanui-block-M1yL9", Ut = "hanui-block__header-F2iBP", Ht = "hanui-block__language-lmdS9", Jt = "hanui-block__body-wDCJ2", Zt = "hanui-block__pre--EERi", Yt = "hanui-block__highlighted-JK1Yj", z = {
189
+ block: Qt,
190
+ block__header: Ut,
191
+ block__language: Ht,
192
+ block__body: Jt,
193
+ block__pre: Zt,
194
+ block__highlighted: Yt
195
+ }, Wt = 1600, te = ({ code: e, language: a, html: n, maxHeight: i, className: o, testId: l }) => {
196
+ var y;
197
+ const { labels: s } = w(), d = tt(), [c, _] = X(!1), r = A(void 0);
198
+ P(() => () => window.clearTimeout(r.current), []);
199
+ const m = async () => {
200
+ var N;
201
+ try {
202
+ await navigator.clipboard.writeText(e);
203
+ } catch {
204
+ return;
205
+ }
206
+ _(!0), d(x("CodeBlock.copied", (N = s == null ? void 0 : s.chat) == null ? void 0 : N.codeCopied)), window.clearTimeout(r.current), r.current = window.setTimeout(() => _(!1), Wt);
207
+ }, p = a ?? "";
208
+ return /* @__PURE__ */ u("figure", { className: h(z.block, o), "data-testid": l, children: [
209
+ /* @__PURE__ */ u("figcaption", { className: z.block__header, children: [
210
+ /* @__PURE__ */ t("span", { className: z.block__language, children: p }),
211
+ /* @__PURE__ */ t(
212
+ G,
213
+ {
214
+ icon: c ? /* @__PURE__ */ t(ht, { "aria-hidden": !0 }) : /* @__PURE__ */ t(ut, { "aria-hidden": !0 }),
215
+ label: nt("CodeBlock.copy", (y = s == null ? void 0 : s.chat) == null ? void 0 : y.codeCopy, p),
216
+ size: "sm",
217
+ onClick: m
218
+ }
219
+ )
220
+ ] }),
221
+ /* @__PURE__ */ t(
222
+ "div",
223
+ {
224
+ className: z.block__body,
225
+ style: i === void 0 ? void 0 : { maxBlockSize: i },
226
+ tabIndex: 0,
227
+ role: p ? "region" : void 0,
228
+ "aria-label": p || void 0,
229
+ children: n ? /* @__PURE__ */ t("div", { className: z.block__highlighted, dangerouslySetInnerHTML: { __html: n } }) : /* @__PURE__ */ t("pre", { className: z.block__pre, children: /* @__PURE__ */ t("code", { children: e }) })
230
+ }
231
+ )
232
+ ] });
233
+ }, $a = /* @__PURE__ */ b(/* @__PURE__ */ g(te, "CodeBlock")), ee = "hanui-block-zqPjp", ae = "hanui-block__summary-Kkp-X", ne = "hanui-block__indicator-GuJMa", se = "hanui-block__body-mDvrV", D = {
234
+ block: ee,
235
+ block__summary: ae,
236
+ block__indicator: ne,
237
+ block__body: se
238
+ }, ie = ({
239
+ summary: e,
240
+ isRunning: a = !1,
241
+ indicator: n,
242
+ isDefaultOpen: i = !1,
243
+ children: o,
244
+ className: l,
245
+ testId: s
246
+ }) => {
247
+ const [d, c] = X(a || i), _ = A(!1);
248
+ return P(() => {
249
+ _.current || c(a || i);
250
+ }, [a, i]), /* @__PURE__ */ t(
251
+ at,
252
+ {
253
+ variant: "plain",
254
+ className: h(D.block, l),
255
+ summary: /* @__PURE__ */ u("span", { className: D.block__summary, children: [
256
+ a && /* @__PURE__ */ t("span", { className: D.block__indicator, children: n ?? /* @__PURE__ */ t(gt, { size: "sm" }) }),
257
+ e
258
+ ] }),
259
+ isOpen: d,
260
+ onOpenChange: (r) => {
261
+ _.current = !0, c(r);
262
+ },
263
+ testId: s,
264
+ children: /* @__PURE__ */ t("div", { className: D.block__body, children: o })
265
+ }
266
+ );
267
+ }, wa = /* @__PURE__ */ b(
268
+ /* @__PURE__ */ g(ie, "ReasoningBlock")
269
+ ), oe = "hanui-text-WKVxU", le = "hanui-text__body--uP0k", J = {
270
+ text: oe,
271
+ text__body: le
272
+ }, ce = ({ text: e, label: a, maxHeight: n = 180, className: i, testId: o }) => /* @__PURE__ */ t(
273
+ yt,
274
+ {
275
+ className: h(J.text, i),
276
+ label: a,
277
+ maxHeight: n,
278
+ hasFade: !0,
279
+ isFollowingEnd: !0,
280
+ testId: o,
281
+ children: /* @__PURE__ */ t("p", { className: J.text__body, children: e })
282
+ }
283
+ ), Ta = /* @__PURE__ */ b(
284
+ /* @__PURE__ */ g(ce, "ReasoningText")
285
+ ), re = "hanui-call-tV2P8", _e = "hanui-call__header-8Tw7m", de = "hanui-call__icon-TLzwf", me = "hanui-call__name-EHz6G", he = "hanui-call__summary-M4sLU", ue = "hanui-call__meta-bvpp7", pe = "hanui-call__body-nFK-C", be = "hanui-section-TjSGF", ge = "hanui-section__label-UrgqM", ye = "hanui-section__body-Dy1PX", v = {
286
+ call: re,
287
+ "call--static": "hanui-call--static-Nldru",
288
+ call__header: _e,
289
+ call__icon: de,
290
+ "call__icon--running": "hanui-call__icon--running-Mx1XK",
291
+ call__name: me,
292
+ call__summary: he,
293
+ call__meta: ue,
294
+ call__body: pe,
295
+ section: be,
296
+ section__label: ge,
297
+ section__body: ye
298
+ }, ve = {
299
+ running: "neutral",
300
+ ok: "success",
301
+ error: "danger",
302
+ aborted: "warning",
303
+ interrupted: "danger"
304
+ }, Ne = ({
305
+ icon: e,
306
+ name: a,
307
+ summary: n,
308
+ status: i,
309
+ meta: o,
310
+ isDefaultOpen: l,
311
+ isOpen: s,
312
+ onOpenChange: d,
313
+ children: c,
314
+ className: _,
315
+ testId: r
316
+ }) => {
317
+ var N, f;
318
+ const { labels: m } = w(), p = x(`ToolCall.status.${i}`, (f = (N = m == null ? void 0 : m.chat) == null ? void 0 : N.toolStatus) == null ? void 0 : f[i]), y = /* @__PURE__ */ u("span", { className: v.call__header, children: [
319
+ e !== void 0 && /* @__PURE__ */ t(
320
+ "span",
321
+ {
322
+ className: h(v.call__icon, i === "running" && v["call__icon--running"]),
323
+ "aria-hidden": !0,
324
+ children: e
325
+ }
326
+ ),
327
+ /* @__PURE__ */ t("span", { className: v.call__name, children: a }),
328
+ n !== void 0 && /* @__PURE__ */ t("span", { className: v.call__summary, children: n }),
329
+ /* @__PURE__ */ t(vt, { tone: ve[i], label: p, isPulsing: i === "running" })
330
+ ] });
331
+ return c === void 0 ? /* @__PURE__ */ u("div", { className: h(v.call, v["call--static"], _), "data-testid": r, children: [
332
+ y,
333
+ o !== void 0 && /* @__PURE__ */ t("span", { className: v.call__meta, children: o })
334
+ ] }) : /* @__PURE__ */ t(
335
+ at,
336
+ {
337
+ className: h(v.call, _),
338
+ summary: y,
339
+ meta: o,
340
+ isDefaultOpen: l,
341
+ isOpen: s,
342
+ onOpenChange: d,
343
+ testId: r,
344
+ children: /* @__PURE__ */ t("div", { className: v.call__body, children: c })
345
+ }
346
+ );
347
+ }, Sa = ({ label: e, children: a, className: n }) => (
348
+ /*
349
+ * Başlık bir HEADING değil: sohbet akışında başlık düzeyi tüketicinin sayfasına bağlı ve sabit bir
350
+ * `h4` hiyerarşiyi bozuyordu. Bölüm de bir landmark değil (her araç kartında bir "bölge" gürültü).
351
+ */
352
+ /* @__PURE__ */ u("div", { className: h(v.section, n), children: [
353
+ /* @__PURE__ */ t("span", { className: v.section__label, children: e }),
354
+ /* @__PURE__ */ t("div", { className: v.section__body, children: a })
355
+ ] })
356
+ ), Aa = /* @__PURE__ */ b(/* @__PURE__ */ g(Ne, "ToolCall")), ke = "hanui-terminal-D4Bz8", xe = "hanui-terminal__command-A7PG2", fe = "hanui-terminal__prompt-9N1g2", Ce = "hanui-terminal__stderr-qCNFe", $e = "hanui-terminal__srOnly-2pmQA", M = {
357
+ terminal: ke,
358
+ terminal__command: xe,
359
+ terminal__prompt: fe,
360
+ terminal__stderr: Ce,
361
+ terminal__srOnly: $e
362
+ }, we = ({
363
+ command: e,
364
+ chunks: a,
365
+ label: n,
366
+ maxHeight: i = 300,
367
+ className: o,
368
+ testId: l
369
+ }) => {
370
+ var _;
371
+ const { labels: s } = w(), d = A(null);
372
+ et(d);
373
+ const c = x("TerminalOutput.stderr", (_ = s == null ? void 0 : s.chat) == null ? void 0 : _.stderr);
374
+ return /* @__PURE__ */ u(
375
+ "pre",
376
+ {
377
+ ref: d,
378
+ className: h(M.terminal, o),
379
+ style: { maxBlockSize: i },
380
+ tabIndex: 0,
381
+ role: "region",
382
+ "aria-label": n,
383
+ "data-testid": l,
384
+ children: [
385
+ e !== void 0 && /* @__PURE__ */ u("span", { className: M.terminal__command, children: [
386
+ /* @__PURE__ */ u("span", { className: M.terminal__prompt, "aria-hidden": !0, children: [
387
+ "$",
388
+ " "
389
+ ] }),
390
+ e,
391
+ `
392
+ `
393
+ ] }),
394
+ a.map(
395
+ (r, m) => r.stream === "stderr" ? /* @__PURE__ */ u("span", { className: M.terminal__stderr, children: [
396
+ /* @__PURE__ */ t("span", { className: M.terminal__srOnly, children: `${c}: ` }),
397
+ r.text
398
+ ] }, m) : /* @__PURE__ */ t("span", { children: r.text }, m)
399
+ )
400
+ ]
401
+ }
402
+ );
403
+ }, La = /* @__PURE__ */ b(
404
+ /* @__PURE__ */ g(we, "TerminalOutput")
405
+ ), Te = "hanui-list-GC4NK", Se = "hanui-list__item-N8DAn", Ae = "hanui-list__index-VrSMs", Le = "hanui-list__text-4tll-", Ee = "hanui-list__title-seHfJ", ze = "hanui-list__plain-ZcCvx", Me = "hanui-list__domain-sJLI7", T = {
406
+ list: Te,
407
+ list__item: Se,
408
+ list__index: Ae,
409
+ list__text: Le,
410
+ list__title: Ee,
411
+ list__plain: ze,
412
+ list__domain: Me
413
+ }, Oe = ({ items: e, label: a, className: n, testId: i }) => {
414
+ var l;
415
+ const { labels: o } = w();
416
+ return /* @__PURE__ */ t(
417
+ "ol",
418
+ {
419
+ className: h(T.list, n),
420
+ "aria-label": x("SourceList.label", a, (l = o == null ? void 0 : o.chat) == null ? void 0 : l.sources),
421
+ "data-testid": i,
422
+ children: e.map((s, d) => /* @__PURE__ */ u("li", { className: T.list__item, children: [
423
+ /* @__PURE__ */ t("span", { className: T.list__index, "aria-hidden": !0, children: d + 1 }),
424
+ /* @__PURE__ */ u("span", { className: T.list__text, children: [
425
+ s.url ? /* @__PURE__ */ t(
426
+ "a",
427
+ {
428
+ className: T.list__title,
429
+ href: s.url,
430
+ target: "_blank",
431
+ rel: "noopener noreferrer",
432
+ children: s.title
433
+ }
434
+ ) : s.onSelect ? /* @__PURE__ */ t("button", { type: "button", className: T.list__title, onClick: s.onSelect, children: s.title }) : /* @__PURE__ */ t("span", { className: T.list__plain, children: s.title }),
435
+ s.domain && /* @__PURE__ */ t("span", { className: T.list__domain, children: s.domain })
436
+ ] })
437
+ ] }, s.id))
438
+ }
439
+ );
440
+ }, Ea = /* @__PURE__ */ b(
441
+ /* @__PURE__ */ g(Oe, "SourceList")
442
+ ), Be = "hanui-citation-XrGMb", Pe = "hanui-citation__srOnly-GnMQp", O = {
443
+ citation: Be,
444
+ citation__srOnly: Pe,
445
+ "citation--static": "hanui-citation--static-8gXHs"
446
+ }, Ie = ({ index: e, href: a, onClick: n, className: i }) => {
447
+ var s;
448
+ const { labels: o } = w(), l = nt("Citation.label", (s = o == null ? void 0 : o.chat) == null ? void 0 : s.citation, e);
449
+ return a ? /* @__PURE__ */ t("a", { className: h(O.citation, i), href: a, "aria-label": l, children: e }) : n ? /* @__PURE__ */ t(
450
+ "button",
451
+ {
452
+ type: "button",
453
+ className: h(O.citation, i),
454
+ onClick: n,
455
+ "aria-label": l,
456
+ children: e
457
+ }
458
+ ) : /* @__PURE__ */ u("span", { className: h(O.citation, O["citation--static"], i), children: [
459
+ /* @__PURE__ */ t("span", { "aria-hidden": !0, children: e }),
460
+ /* @__PURE__ */ t("span", { className: O.citation__srOnly, children: l })
461
+ ] });
462
+ }, za = /* @__PURE__ */ b(/* @__PURE__ */ g(Ie, "Citation")), De = "hanui-actions-c8XlJ", Re = "hanui-actions__meta-j-X3I", Z = {
463
+ actions: De,
464
+ actions__meta: Re
465
+ }, Fe = "button:not(:disabled), a[href]", Ke = ({ children: e, meta: a, label: n, className: i, testId: o }) => {
466
+ var c;
467
+ const { labels: l } = w(), s = A(null), d = (_) => {
468
+ var C;
469
+ const r = [...((C = s.current) == null ? void 0 : C.querySelectorAll(Fe)) ?? []], m = r.indexOf(document.activeElement);
470
+ if (m < 0 || r.length === 0) return;
471
+ const p = getComputedStyle(_.currentTarget).direction === "rtl", y = p ? "ArrowLeft" : "ArrowRight", N = p ? "ArrowRight" : "ArrowLeft", f = _.key === y ? r[(m + 1) % r.length] : _.key === N ? r[(m - 1 + r.length) % r.length] : _.key === "Home" ? r[0] : _.key === "End" ? r[r.length - 1] : null;
472
+ f && (_.preventDefault(), f.focus());
473
+ };
474
+ return /* @__PURE__ */ u(
475
+ "div",
476
+ {
477
+ ref: s,
478
+ role: "toolbar",
479
+ "aria-label": x("MessageActions.label", n, (c = l == null ? void 0 : l.chat) == null ? void 0 : c.messageActions),
480
+ className: h(Z.actions, i),
481
+ onKeyDown: d,
482
+ "data-testid": o,
483
+ children: [
484
+ e,
485
+ a !== void 0 && /* @__PURE__ */ t("span", { className: Z.actions__meta, children: a })
486
+ ]
487
+ }
488
+ );
489
+ }, Ma = /* @__PURE__ */ b(
490
+ /* @__PURE__ */ g(Ke, "MessageActions")
491
+ ), Ge = "hanui-bar-UJGDL", qe = "hanui-bar__brand-ZUcIw", Xe = "hanui-bar__start-nvmHH", Ve = "hanui-bar__end-NNQve", R = {
492
+ bar: Ge,
493
+ bar__brand: qe,
494
+ bar__start: Xe,
495
+ bar__end: Ve
496
+ }, Y = "--hanui-header-height", je = ({ brand: e, start: a, end: n, className: i, testId: o }) => {
497
+ const l = A(null);
498
+ return P(() => {
499
+ const s = l.current;
500
+ if (!s || typeof ResizeObserver > "u") return;
501
+ const d = document.documentElement, c = new ResizeObserver(
502
+ ([_]) => {
503
+ var r, m;
504
+ return d.style.setProperty(
505
+ Y,
506
+ `${Math.round(((m = (r = _.borderBoxSize) == null ? void 0 : r[0]) == null ? void 0 : m.blockSize) ?? s.offsetHeight)}px`
507
+ );
508
+ }
509
+ );
510
+ return c.observe(s), () => {
511
+ c.disconnect(), d.style.removeProperty(Y);
512
+ };
513
+ }, []), /* @__PURE__ */ u("header", { ref: l, className: h(R.bar, i), "data-testid": o, children: [
514
+ /* @__PURE__ */ t("div", { className: R.bar__brand, children: e }),
515
+ a !== void 0 && /* @__PURE__ */ t("div", { className: R.bar__start, children: a }),
516
+ n !== void 0 && /* @__PURE__ */ t("div", { className: R.bar__end, children: n })
517
+ ] });
518
+ }, Oa = /* @__PURE__ */ b(/* @__PURE__ */ g(je, "AppBar")), Qe = "hanui-list-e54gu", Ue = "hanui-list__window-ESrZX", He = "hanui-list__slot-DxSnX", Je = "hanui-item-DKEGh", Ze = "hanui-item__start-Yb3xf", Ye = "hanui-item__body-kD4Qk", We = "hanui-item__end-3SCT-", k = {
519
+ list: Qe,
520
+ "list--virtual": "hanui-list--virtual-zxqy5",
521
+ list__window: Ue,
522
+ list__slot: He,
523
+ item: Je,
524
+ "item--selected": "hanui-item--selected-AMl3I",
525
+ "item--muted": "hanui-item--muted-XBeA3",
526
+ item__start: Ze,
527
+ item__body: Ye,
528
+ item__end: We
529
+ }, W = 6, ta = ({
530
+ label: e,
531
+ children: a,
532
+ rowHeight: n,
533
+ maxHeight: i = 320,
534
+ className: o,
535
+ testId: l
536
+ }) => {
537
+ const s = lt.toArray(a).filter(ct), [d, c] = X(0);
538
+ if (!n)
539
+ return /* @__PURE__ */ t("ul", { className: h(k.list, o), "aria-label": e, "data-testid": l, children: s });
540
+ const _ = Math.max(0, Math.floor(d / n) - W), r = Math.min(s.length, Math.ceil((d + i) / n) + W);
541
+ return /* @__PURE__ */ t(
542
+ "div",
543
+ {
544
+ className: h(k.list, k["list--virtual"], o),
545
+ style: { maxBlockSize: i, "--hanui-row-height": `${n}px` },
546
+ onScroll: (m) => c(m.currentTarget.scrollTop),
547
+ "data-testid": l,
548
+ children: /* @__PURE__ */ t(
549
+ "ul",
550
+ {
551
+ "aria-label": e,
552
+ className: k.list__window,
553
+ style: {
554
+ blockSize: s.length * n,
555
+ paddingBlockStart: _ * n
556
+ },
557
+ children: s.slice(_, r).map(
558
+ (m, p) => rt(m, {
559
+ "aria-posinset": _ + p + 1,
560
+ "aria-setsize": s.length
561
+ })
562
+ )
563
+ }
564
+ )
565
+ }
566
+ );
567
+ }, Ba = ({
568
+ children: e,
569
+ start: a,
570
+ end: n,
571
+ onClick: i,
572
+ href: o,
573
+ isSelected: l,
574
+ isMuted: s,
575
+ testId: d,
576
+ "aria-posinset": c,
577
+ "aria-setsize": _
578
+ }) => {
579
+ const { linkComponent: r } = w(), m = h(
580
+ k.item,
581
+ l && k["item--selected"],
582
+ s && k["item--muted"]
583
+ ), p = /* @__PURE__ */ u(it, { children: [
584
+ a !== void 0 && /* @__PURE__ */ t("span", { className: k.item__start, children: a }),
585
+ /* @__PURE__ */ t("span", { className: k.item__body, children: e }),
586
+ n !== void 0 && /* @__PURE__ */ t("span", { className: k.item__end, children: n })
587
+ ] }), y = r ?? "a";
588
+ return /* @__PURE__ */ t("li", { className: k.list__slot, "aria-posinset": c, "aria-setsize": _, children: o ? /* @__PURE__ */ t(y, { href: o, className: m, "data-testid": d, children: p }) : /* @__PURE__ */ t(
589
+ "button",
590
+ {
591
+ type: "button",
592
+ className: m,
593
+ onClick: i,
594
+ "aria-pressed": l,
595
+ "data-testid": d,
596
+ children: p
597
+ }
598
+ ) });
599
+ }, Pa = /* @__PURE__ */ b(
600
+ /* @__PURE__ */ g(ta, "ActionList")
601
+ ), ea = "hanui-bar-OZjXz", aa = "hanui-bar__segment-hexbp", na = "hanui-bar__marker-E0FeF", F = {
602
+ bar: ea,
603
+ bar__segment: aa,
604
+ bar__marker: na,
605
+ "bar__marker--danger": "hanui-bar__marker--danger-245FK"
606
+ }, K = (e, a) => a <= 0 ? 0 : Math.min(100, Math.max(0, e / a * 100)), sa = (e) => e === "muted" ? "var(--hanui-text-3)" : `var(--hanui-${e})`, ia = ({ label: e, max: a, segments: n, markers: i = [], className: o, testId: l }) => {
607
+ const s = [
608
+ ...n.map((c) => c.label),
609
+ ...i.map((c) => c.label)
610
+ ];
611
+ let d = 0;
612
+ return /* @__PURE__ */ u(
613
+ "div",
614
+ {
615
+ role: "img",
616
+ "aria-label": `${e}: ${s.join(", ")}`,
617
+ className: h(F.bar, o),
618
+ "data-testid": l,
619
+ children: [
620
+ n.map((c) => {
621
+ const _ = c.from ?? d, r = c.to ?? _ + (c.value ?? 0);
622
+ return d = r, /* @__PURE__ */ t(
623
+ "span",
624
+ {
625
+ className: F.bar__segment,
626
+ title: c.label,
627
+ style: {
628
+ insetInlineStart: `${K(_, a)}%`,
629
+ inlineSize: `${K(r, a) - K(_, a)}%`,
630
+ backgroundColor: sa(c.tone)
631
+ }
632
+ },
633
+ c.id
634
+ );
635
+ }),
636
+ i.map((c) => /* @__PURE__ */ t(
637
+ "span",
638
+ {
639
+ className: h(
640
+ F.bar__marker,
641
+ c.tone === "danger" && F["bar__marker--danger"]
642
+ ),
643
+ title: c.label,
644
+ style: { insetInlineStart: `${K(c.at, a)}%` }
645
+ },
646
+ c.id
647
+ ))
648
+ ]
649
+ }
650
+ );
651
+ }, Ia = /* @__PURE__ */ b(
652
+ /* @__PURE__ */ g(ia, "SegmentBar")
653
+ ), oa = "hanui-legend-zryov", la = "hanui-legend__item-GGrR-", ca = "hanui-legend__swatch-2MkAR", q = {
654
+ legend: oa,
655
+ legend__item: la,
656
+ legend__swatch: ca
657
+ }, ra = (e) => e === "muted" ? "var(--hanui-text-3)" : `var(--hanui-${e})`, _a = ({ items: e, className: a, testId: n }) => /* @__PURE__ */ t("ul", { className: h(q.legend, a), "data-testid": n, children: e.map((i) => /* @__PURE__ */ u("li", { className: q.legend__item, children: [
658
+ /* @__PURE__ */ t(
659
+ "span",
660
+ {
661
+ "aria-hidden": !0,
662
+ className: q.legend__swatch,
663
+ style: { backgroundColor: ra(i.tone) }
664
+ }
665
+ ),
666
+ i.label
667
+ ] }, i.id)) }), Da = /* @__PURE__ */ b(/* @__PURE__ */ g(_a, "Legend")), da = "hanui-list-KSLu5", ma = "hanui-list__row-k7aHp", ha = "hanui-list__term-vsD5B", ua = "hanui-list__value-6GY6z", B = {
668
+ list: da,
669
+ list__row: ma,
670
+ list__term: ha,
671
+ list__value: ua,
672
+ "list__value--technical": "hanui-list__value--technical-I-UYE"
673
+ }, pa = ({ items: e, className: a, testId: n }) => /* @__PURE__ */ t("dl", { className: h(B.list, a), "data-testid": n, children: e.map((i, o) => /* @__PURE__ */ u("div", { className: B.list__row, children: [
674
+ /* @__PURE__ */ t("dt", { className: B.list__term, children: i.term }),
675
+ /* @__PURE__ */ t(
676
+ "dd",
677
+ {
678
+ className: h(B.list__value, i.isTechnical && B["list__value--technical"]),
679
+ children: i.description
680
+ }
681
+ )
682
+ ] }, o)) }), Ra = /* @__PURE__ */ b(
683
+ /* @__PURE__ */ g(pa, "DescriptionList")
684
+ );
685
+ export {
686
+ Pa as ActionList,
687
+ Ba as ActionListItem,
688
+ Oa as AppBar,
689
+ ka as ChatMessage,
690
+ Na as ChatThread,
691
+ za as Citation,
692
+ $a as CodeBlock,
693
+ Ra as DescriptionList,
694
+ Da as Legend,
695
+ Ma as MessageActions,
696
+ xa as PromptInput,
697
+ fa as PromptSuggestions,
698
+ Ca as Prose,
699
+ wa as ReasoningBlock,
700
+ Ta as ReasoningText,
701
+ Ia as SegmentBar,
702
+ Ea as SourceList,
703
+ La as TerminalOutput,
704
+ Aa as ToolCall,
705
+ Sa as ToolCallSection
706
+ };
707
+ //# sourceMappingURL=chat.js.map