@adecore/agents-react 0.70.1 → 0.71.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 (82) hide show
  1. package/dist/chat/ui/CodeBlock.d.ts +6 -1
  2. package/dist/chat/ui/CodeBlock.js +39 -23
  3. package/dist/chat/ui/intelligent-ui/UiReply.js +11 -2
  4. package/dist/chat/ui/intelligent-ui/key-caps.d.ts +1 -0
  5. package/dist/chat/ui/intelligent-ui/key-caps.js +45 -0
  6. package/dist/chat/ui/intelligent-ui/link-action.d.ts +9 -0
  7. package/dist/chat/ui/intelligent-ui/link-action.js +32 -0
  8. package/dist/chat/ui/intelligent-ui/node-text.js +1 -1
  9. package/dist/chat/ui/intelligent-ui/patch-clip.d.ts +4 -0
  10. package/dist/chat/ui/intelligent-ui/patch-clip.js +64 -0
  11. package/dist/chat/ui/intelligent-ui/registry.js +31 -5
  12. package/dist/chat/ui/intelligent-ui/render-context.d.ts +13 -0
  13. package/dist/chat/ui/intelligent-ui/renderers/alternatives.d.ts +6 -0
  14. package/dist/chat/ui/intelligent-ui/renderers/alternatives.js +296 -0
  15. package/dist/chat/ui/intelligent-ui/renderers/changes.d.ts +4 -0
  16. package/dist/chat/ui/intelligent-ui/renderers/changes.js +266 -0
  17. package/dist/chat/ui/intelligent-ui/renderers/chart.js +522 -371
  18. package/dist/chat/ui/intelligent-ui/renderers/content.d.ts +1 -1
  19. package/dist/chat/ui/intelligent-ui/renderers/content.js +94 -43
  20. package/dist/chat/ui/intelligent-ui/renderers/data.js +478 -245
  21. package/dist/chat/ui/intelligent-ui/renderers/diff.d.ts +4 -0
  22. package/dist/chat/ui/intelligent-ui/renderers/diff.js +427 -0
  23. package/dist/chat/ui/intelligent-ui/renderers/inputs.d.ts +1 -0
  24. package/dist/chat/ui/intelligent-ui/renderers/inputs.js +354 -110
  25. package/dist/chat/ui/intelligent-ui/renderers/keys.d.ts +3 -0
  26. package/dist/chat/ui/intelligent-ui/renderers/keys.js +60 -0
  27. package/dist/chat/ui/intelligent-ui/renderers/links.d.ts +13 -2
  28. package/dist/chat/ui/intelligent-ui/renderers/links.js +65 -85
  29. package/dist/chat/ui/intelligent-ui/renderers/meter.d.ts +4 -0
  30. package/dist/chat/ui/intelligent-ui/renderers/meter.js +371 -0
  31. package/dist/chat/ui/intelligent-ui/renderers/quote.d.ts +3 -0
  32. package/dist/chat/ui/intelligent-ui/renderers/quote.js +123 -0
  33. package/dist/chat/ui/intelligent-ui/renderers/radio.d.ts +3 -0
  34. package/dist/chat/ui/intelligent-ui/renderers/radio.js +205 -0
  35. package/dist/chat/ui/intelligent-ui/renderers/structure.d.ts +2 -0
  36. package/dist/chat/ui/intelligent-ui/renderers/structure.js +156 -45
  37. package/dist/chat/ui/intelligent-ui/renderers/text.js +365 -215
  38. package/dist/chat/ui/intelligent-ui/renderers/tree.d.ts +5 -0
  39. package/dist/chat/ui/intelligent-ui/renderers/tree.js +284 -0
  40. package/dist/chat/ui/intelligent-ui/table-data.d.ts +9 -2
  41. package/dist/chat/ui/intelligent-ui/table-data.js +68 -3
  42. package/dist/chat/ui/intelligent-ui/tones.d.ts +1 -1
  43. package/dist/chat/ui/intelligent-ui/tones.js +7 -7
  44. package/dist/chat/ui/intelligent-ui/use-ui-diffs.d.ts +4 -0
  45. package/dist/chat/ui/intelligent-ui/use-ui-diffs.js +201 -0
  46. package/dist/host/host.d.ts +2 -1
  47. package/dist/locales/en/agent-chat.d.ts +56 -0
  48. package/dist/locales/en/agent-chat.js +57 -1
  49. package/dist/locales/nl/agent-chat.d.ts +56 -0
  50. package/dist/locales/nl/agent-chat.js +57 -1
  51. package/dist/theme.css +6 -0
  52. package/package.json +9 -9
  53. package/src/chat/ui/CodeBlock.tsx +38 -18
  54. package/src/chat/ui/intelligent-ui/UiReply.tsx +13 -2
  55. package/src/chat/ui/intelligent-ui/key-caps.ts +51 -0
  56. package/src/chat/ui/intelligent-ui/link-action.ts +32 -0
  57. package/src/chat/ui/intelligent-ui/node-text.ts +1 -0
  58. package/src/chat/ui/intelligent-ui/patch-clip.ts +83 -0
  59. package/src/chat/ui/intelligent-ui/registry.ts +31 -4
  60. package/src/chat/ui/intelligent-ui/render-context.ts +21 -0
  61. package/src/chat/ui/intelligent-ui/renderers/alternatives.tsx +76 -0
  62. package/src/chat/ui/intelligent-ui/renderers/changes.tsx +97 -0
  63. package/src/chat/ui/intelligent-ui/renderers/chart.tsx +122 -46
  64. package/src/chat/ui/intelligent-ui/renderers/content.tsx +27 -7
  65. package/src/chat/ui/intelligent-ui/renderers/data.tsx +165 -52
  66. package/src/chat/ui/intelligent-ui/renderers/diff.tsx +144 -0
  67. package/src/chat/ui/intelligent-ui/renderers/inputs.tsx +111 -19
  68. package/src/chat/ui/intelligent-ui/renderers/keys.tsx +26 -0
  69. package/src/chat/ui/intelligent-ui/renderers/links.tsx +40 -24
  70. package/src/chat/ui/intelligent-ui/renderers/meter.tsx +105 -0
  71. package/src/chat/ui/intelligent-ui/renderers/quote.tsx +29 -0
  72. package/src/chat/ui/intelligent-ui/renderers/radio.tsx +130 -0
  73. package/src/chat/ui/intelligent-ui/renderers/structure.tsx +54 -7
  74. package/src/chat/ui/intelligent-ui/renderers/text.tsx +70 -36
  75. package/src/chat/ui/intelligent-ui/renderers/tree.tsx +85 -0
  76. package/src/chat/ui/intelligent-ui/table-data.ts +84 -6
  77. package/src/chat/ui/intelligent-ui/tones.ts +7 -7
  78. package/src/chat/ui/intelligent-ui/use-ui-diffs.ts +119 -0
  79. package/src/host/host.ts +4 -0
  80. package/src/locales/en/agent-chat.ts +57 -1
  81. package/src/locales/nl/agent-chat.ts +57 -1
  82. package/src/theme.css +6 -0
@@ -1,12 +1,13 @@
1
1
  import { c as _c } from "react/compiler-runtime";
2
- import { Button, ScrollArea, SegmentBar, Tooltip, useMeasuredWidth } from '@adecore/ui';
2
+ import { Button, Icon, ScrollArea, SegmentBar, Tooltip, useMeasuredWidth } from '@adecore/ui';
3
3
  import { formatNumber, formatRounded } from '@adecore/ui/format';
4
4
  import clsx from 'clsx';
5
- import { useState } from 'react';
5
+ import { createContext, useContext, useState } from 'react';
6
6
  import { useTranslation } from 'react-i18next';
7
7
  import { useBlockLocal } from '../block-local.js';
8
8
  import { UI_CHART_CHARACTER, UI_CHART_ROWS, uiChartCharacter, uiChartAxis, uiChartData, uiChartRange, uiChartText, uiChartTextWidth, uiChartValues } from '../chart-data.js';
9
9
  import { uiWithUnit } from '../node-text.js';
10
+ import { UI_TONE_COLOR, UI_TONE_ICONS } from '../tones.js';
10
11
  import { UiFallbackPart } from '../UiFallbackPart.js';
11
12
  import { useTruncated } from '../use-truncated.js';
12
13
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
@@ -22,8 +23,15 @@ const LABEL_BAND = 56;
22
23
  /* Points get a dot up to this many categories; more would crowd the line. */
23
24
  const DOTS_UP_TO = 30;
24
25
  const GROW = 'transition-[scale,opacity] duration-400 ease-out motion-reduce:transition-none';
25
- function seriesColor(index) {
26
- return `var(--chart-${index + 1})`;
26
+ /* The tones a chart gives its series, by series key, for every part that colors one. */
27
+ const TonesContext = createContext(undefined);
28
+ function seriesTone(key, tones) {
29
+ return tones !== undefined && Object.hasOwn(tones, key) ? tones[key] : undefined;
30
+ }
31
+ /* A series wears its tone where the chart names one, and otherwise the palette color of its place. */
32
+ function seriesColor(index, key, tones) {
33
+ const tone = seriesTone(key, tones);
34
+ return tone === undefined ? `var(--chart-${index + 1})` : UI_TONE_COLOR[tone];
27
35
  }
28
36
  function valueText(value, unit) {
29
37
  return value === null ? '' : uiWithUnit(formatRounded(value, 2), unit);
@@ -109,47 +117,68 @@ function chartSummary(values, unit, t) {
109
117
  value: valueText(top.value, unit)
110
118
  });
111
119
  }
120
+ /* A series with a tone shows the tone's icon in place of its square, so the tone is never its color alone. */
112
121
  function Legend(t0) {
113
- const $ = _c(4);
122
+ const $ = _c(7);
114
123
  const {
115
124
  chart
116
125
  } = t0;
126
+ const tones = useContext(TonesContext);
117
127
  let t1;
118
- if ($[0] !== chart.series) {
119
- t1 = chart.series.map(_temp2);
128
+ if ($[0] !== chart.series || $[1] !== tones) {
129
+ let t2;
130
+ if ($[3] !== tones) {
131
+ t2 = (series, index) => {
132
+ const tone = seriesTone(series.key, tones);
133
+ const color = seriesColor(index, series.key, tones);
134
+ return /*#__PURE__*/_jsxs("span", {
135
+ className: "flex items-center gap-1.5",
136
+ children: [tone === undefined ? /*#__PURE__*/_jsx("span", {
137
+ className: "size-2 rounded-sm",
138
+ style: {
139
+ backgroundColor: color
140
+ }
141
+ }) : /*#__PURE__*/_jsx("span", {
142
+ className: "flex",
143
+ style: {
144
+ color
145
+ },
146
+ children: /*#__PURE__*/_jsx(Icon, {
147
+ icon: UI_TONE_ICONS[tone],
148
+ size: 12
149
+ })
150
+ }), series.key]
151
+ }, series.key);
152
+ };
153
+ $[3] = tones;
154
+ $[4] = t2;
155
+ } else {
156
+ t2 = $[4];
157
+ }
158
+ t1 = chart.series.map(t2);
120
159
  $[0] = chart.series;
121
- $[1] = t1;
160
+ $[1] = tones;
161
+ $[2] = t1;
122
162
  } else {
123
- t1 = $[1];
163
+ t1 = $[2];
124
164
  }
125
165
  let t2;
126
- if ($[2] !== t1) {
166
+ if ($[5] !== t1) {
127
167
  t2 = /*#__PURE__*/_jsx("div", {
128
168
  "aria-hidden": true,
129
169
  className: "flex flex-wrap gap-x-3 gap-y-1 text-xs text-text-muted",
130
170
  children: t1
131
171
  });
132
- $[2] = t1;
133
- $[3] = t2;
172
+ $[5] = t1;
173
+ $[6] = t2;
134
174
  } else {
135
- t2 = $[3];
175
+ t2 = $[6];
136
176
  }
137
177
  return t2;
138
178
  }
139
179
  /* Every number of the data, for a screen reader, and on screen once a person opens it. */
140
- function _temp2(series, index) {
141
- return /*#__PURE__*/_jsxs("span", {
142
- className: "flex items-center gap-1.5",
143
- children: [/*#__PURE__*/_jsx("span", {
144
- className: "size-2 rounded-sm",
145
- style: {
146
- backgroundColor: seriesColor(index)
147
- }
148
- }), series.key]
149
- }, series.key);
150
- }
151
180
  function ValuesTable(t0) {
152
- const $ = _c(36);
181
+ const $ = _c(40);
153
182
  const {
154
183
  values,
155
184
  unit,
@@ -158,6 +187,7 @@ function ValuesTable(t0) {
158
187
  const {
159
188
  t
160
189
  } = useTranslation("agent-chat");
190
+ const tones = useContext(TonesContext);
161
191
  const t1 = shown ? "w-full border-collapse text-xs tabular-nums" : undefined;
162
192
  const t2 = shown ? "sr-only" : undefined;
163
193
  let t3;
@@ -189,52 +219,62 @@ function ValuesTable(t0) {
189
219
  t6 = $[5];
190
220
  }
191
221
  let t7;
192
- if ($[6] !== shown || $[7] !== values.series) {
222
+ if ($[6] !== shown || $[7] !== t || $[8] !== tones || $[9] !== values.series) {
193
223
  let t8;
194
- if ($[9] !== shown) {
195
- t8 = series => /*#__PURE__*/_jsx("th", {
196
- scope: "col",
197
- className: shown ? "h-8 px-2 text-right font-medium whitespace-nowrap text-text-muted" : undefined,
198
- children: series.key
199
- }, series.key);
200
- $[9] = shown;
201
- $[10] = t8;
224
+ if ($[11] !== shown || $[12] !== t || $[13] !== tones) {
225
+ t8 = series => {
226
+ const tone = seriesTone(series.key, tones);
227
+ return /*#__PURE__*/_jsxs("th", {
228
+ scope: "col",
229
+ className: shown ? "h-8 px-2 text-right font-medium whitespace-nowrap text-text-muted" : undefined,
230
+ children: [series.key, tone !== undefined && /*#__PURE__*/_jsxs("span", {
231
+ className: "sr-only",
232
+ children: [", ", t(`blocks.event.tone.${tone}`)]
233
+ })]
234
+ }, series.key);
235
+ };
236
+ $[11] = shown;
237
+ $[12] = t;
238
+ $[13] = tones;
239
+ $[14] = t8;
202
240
  } else {
203
- t8 = $[10];
241
+ t8 = $[14];
204
242
  }
205
243
  t7 = values.series.map(t8);
206
244
  $[6] = shown;
207
- $[7] = values.series;
208
- $[8] = t7;
245
+ $[7] = t;
246
+ $[8] = tones;
247
+ $[9] = values.series;
248
+ $[10] = t7;
209
249
  } else {
210
- t7 = $[8];
250
+ t7 = $[10];
211
251
  }
212
252
  let t8;
213
- if ($[11] !== t7) {
253
+ if ($[15] !== t7) {
214
254
  t8 = /*#__PURE__*/_jsxs("tr", {
215
255
  children: [t6, t7]
216
256
  });
217
- $[11] = t7;
218
- $[12] = t8;
257
+ $[15] = t7;
258
+ $[16] = t8;
219
259
  } else {
220
- t8 = $[12];
260
+ t8 = $[16];
221
261
  }
222
262
  let t9;
223
- if ($[13] !== t5 || $[14] !== t8) {
263
+ if ($[17] !== t5 || $[18] !== t8) {
224
264
  t9 = /*#__PURE__*/_jsx("thead", {
225
265
  className: t5,
226
266
  children: t8
227
267
  });
228
- $[13] = t5;
229
- $[14] = t8;
230
- $[15] = t9;
268
+ $[17] = t5;
269
+ $[18] = t8;
270
+ $[19] = t9;
231
271
  } else {
232
- t9 = $[15];
272
+ t9 = $[19];
233
273
  }
234
274
  let t10;
235
- if ($[16] !== shown || $[17] !== unit || $[18] !== values.labels || $[19] !== values.series) {
275
+ if ($[20] !== shown || $[21] !== unit || $[22] !== values.labels || $[23] !== values.series) {
236
276
  let t11;
237
- if ($[21] !== shown || $[22] !== unit || $[23] !== values.series) {
277
+ if ($[25] !== shown || $[26] !== unit || $[27] !== values.series) {
238
278
  t11 = (label, index) => /*#__PURE__*/_jsxs("tr", {
239
279
  className: shown ? "border-t border-border-soft" : undefined,
240
280
  children: [/*#__PURE__*/_jsx("th", {
@@ -246,83 +286,84 @@ function ValuesTable(t0) {
246
286
  children: valueText(series_0.values[index] ?? null, unit)
247
287
  }, series_0.key))]
248
288
  }, index);
249
- $[21] = shown;
250
- $[22] = unit;
251
- $[23] = values.series;
252
- $[24] = t11;
289
+ $[25] = shown;
290
+ $[26] = unit;
291
+ $[27] = values.series;
292
+ $[28] = t11;
253
293
  } else {
254
- t11 = $[24];
294
+ t11 = $[28];
255
295
  }
256
296
  t10 = values.labels.map(t11);
257
- $[16] = shown;
258
- $[17] = unit;
259
- $[18] = values.labels;
260
- $[19] = values.series;
261
- $[20] = t10;
297
+ $[20] = shown;
298
+ $[21] = unit;
299
+ $[22] = values.labels;
300
+ $[23] = values.series;
301
+ $[24] = t10;
262
302
  } else {
263
- t10 = $[20];
303
+ t10 = $[24];
264
304
  }
265
305
  let t11;
266
- if ($[25] !== t10) {
306
+ if ($[29] !== t10) {
267
307
  t11 = /*#__PURE__*/_jsx("tbody", {
268
308
  children: t10
269
309
  });
270
- $[25] = t10;
271
- $[26] = t11;
310
+ $[29] = t10;
311
+ $[30] = t11;
272
312
  } else {
273
- t11 = $[26];
313
+ t11 = $[30];
274
314
  }
275
315
  let t12;
276
- if ($[27] !== t1 || $[28] !== t11 || $[29] !== t4 || $[30] !== t9) {
316
+ if ($[31] !== t1 || $[32] !== t11 || $[33] !== t4 || $[34] !== t9) {
277
317
  t12 = /*#__PURE__*/_jsxs("table", {
278
318
  className: t1,
279
319
  children: [t4, t9, t11]
280
320
  });
281
- $[27] = t1;
282
- $[28] = t11;
283
- $[29] = t4;
284
- $[30] = t9;
285
- $[31] = t12;
321
+ $[31] = t1;
322
+ $[32] = t11;
323
+ $[33] = t4;
324
+ $[34] = t9;
325
+ $[35] = t12;
286
326
  } else {
287
- t12 = $[31];
327
+ t12 = $[35];
288
328
  }
289
329
  const table = t12;
290
330
  if (!shown) {
291
331
  let t13;
292
- if ($[32] !== table) {
332
+ if ($[36] !== table) {
293
333
  t13 = /*#__PURE__*/_jsx("div", {
294
334
  className: "sr-only",
295
335
  children: table
296
336
  });
297
- $[32] = table;
298
- $[33] = t13;
337
+ $[36] = table;
338
+ $[37] = t13;
299
339
  } else {
300
- t13 = $[33];
340
+ t13 = $[37];
301
341
  }
302
342
  return t13;
303
343
  }
304
344
  let t13;
305
- if ($[34] !== table) {
345
+ if ($[38] !== table) {
306
346
  t13 = /*#__PURE__*/_jsx(ScrollArea, {
307
347
  axis: "both",
308
348
  className: "max-h-80 w-full rounded-md border border-border-soft",
309
349
  children: table
310
350
  });
311
- $[34] = table;
312
- $[35] = t13;
351
+ $[38] = table;
352
+ $[39] = t13;
313
353
  } else {
314
- t13 = $[35];
354
+ t13 = $[39];
315
355
  }
316
356
  return t13;
317
357
  }
318
358
  function Readout(t0) {
319
- const $ = _c(16);
359
+ const $ = _c(18);
320
360
  const {
321
361
  chart,
322
362
  index,
323
363
  left,
324
364
  unit
325
365
  } = t0;
366
+ const tones = useContext(TonesContext);
326
367
  let t1;
327
368
  if ($[0] !== left) {
328
369
  t1 = {
@@ -346,15 +387,15 @@ function Readout(t0) {
346
387
  t3 = $[3];
347
388
  }
348
389
  let t4;
349
- if ($[4] !== chart.series || $[5] !== index || $[6] !== unit) {
390
+ if ($[4] !== chart.series || $[5] !== index || $[6] !== tones || $[7] !== unit) {
350
391
  let t5;
351
- if ($[8] !== chart.series.length || $[9] !== index || $[10] !== unit) {
392
+ if ($[9] !== chart.series.length || $[10] !== index || $[11] !== tones || $[12] !== unit) {
352
393
  t5 = (series, at) => /*#__PURE__*/_jsxs("span", {
353
394
  className: "flex items-center gap-1.5 text-text-muted tabular-nums",
354
395
  children: [/*#__PURE__*/_jsx("span", {
355
396
  className: "size-2 rounded-sm",
356
397
  style: {
357
- backgroundColor: seriesColor(at)
398
+ backgroundColor: seriesColor(at, series.key, tones)
358
399
  }
359
400
  }), chart.series.length > 1 && /*#__PURE__*/_jsx("span", {
360
401
  children: series.key
@@ -363,40 +404,42 @@ function Readout(t0) {
363
404
  children: valueText(series.values[index] ?? null, unit)
364
405
  })]
365
406
  }, series.key);
366
- $[8] = chart.series.length;
367
- $[9] = index;
368
- $[10] = unit;
369
- $[11] = t5;
407
+ $[9] = chart.series.length;
408
+ $[10] = index;
409
+ $[11] = tones;
410
+ $[12] = unit;
411
+ $[13] = t5;
370
412
  } else {
371
- t5 = $[11];
413
+ t5 = $[13];
372
414
  }
373
415
  t4 = chart.series.map(t5);
374
416
  $[4] = chart.series;
375
417
  $[5] = index;
376
- $[6] = unit;
377
- $[7] = t4;
418
+ $[6] = tones;
419
+ $[7] = unit;
420
+ $[8] = t4;
378
421
  } else {
379
- t4 = $[7];
422
+ t4 = $[8];
380
423
  }
381
424
  let t5;
382
- if ($[12] !== t1 || $[13] !== t3 || $[14] !== t4) {
425
+ if ($[14] !== t1 || $[15] !== t3 || $[16] !== t4) {
383
426
  t5 = /*#__PURE__*/_jsxs("div", {
384
427
  "aria-hidden": true,
385
428
  className: "pointer-events-none absolute top-0 z-1 flex w-max max-w-56 -translate-x-1/2 flex-col gap-0.5 rounded-md bg-surface-raised px-2 py-1 text-xs shadow-raised",
386
429
  style: t1,
387
430
  children: [t3, t4]
388
431
  });
389
- $[12] = t1;
390
- $[13] = t3;
391
- $[14] = t4;
392
- $[15] = t5;
432
+ $[14] = t1;
433
+ $[15] = t3;
434
+ $[16] = t4;
435
+ $[17] = t5;
393
436
  } else {
394
- t5 = $[15];
437
+ t5 = $[17];
395
438
  }
396
439
  return t5;
397
440
  }
398
441
  function VerticalChart(t0) {
399
- const $ = _c(81);
442
+ const $ = _c(88);
400
443
  const {
401
444
  chart,
402
445
  kind,
@@ -405,6 +448,8 @@ function VerticalChart(t0) {
405
448
  character
406
449
  } = t0;
407
450
  const [hover, setHover] = useState(null);
451
+ const tones = useContext(TonesContext);
452
+ let areas;
408
453
  let axisWidth;
409
454
  let band;
410
455
  let barWidth;
@@ -436,65 +481,92 @@ function VerticalChart(t0) {
436
481
  band = t10;
437
482
  const plotHeight = HEIGHT - PLOT_TOP - Math.round(LABEL_ROOM * character / UI_CHART_CHARACTER);
438
483
  let t11;
439
- if ($[21] !== high || $[22] !== low || $[23] !== plotHeight) {
484
+ if ($[22] !== high || $[23] !== low || $[24] !== plotHeight) {
440
485
  t11 = value => Math.round(PLOT_TOP + (high - value) / (high - low) * plotHeight);
441
- $[21] = high;
442
- $[22] = low;
443
- $[23] = plotHeight;
444
- $[24] = t11;
486
+ $[22] = high;
487
+ $[23] = low;
488
+ $[24] = plotHeight;
489
+ $[25] = t11;
445
490
  } else {
446
- t11 = $[24];
491
+ t11 = $[25];
447
492
  }
448
493
  y = t11;
449
494
  baseline = y(0);
450
495
  let t12;
451
- if ($[25] !== axisWidth || $[26] !== band) {
496
+ if ($[26] !== axisWidth || $[27] !== band) {
452
497
  t12 = index => Math.round(axisWidth + band * index + band / 2);
453
- $[25] = axisWidth;
454
- $[26] = band;
455
- $[27] = t12;
498
+ $[26] = axisWidth;
499
+ $[27] = band;
500
+ $[28] = t12;
456
501
  } else {
457
- t12 = $[27];
502
+ t12 = $[28];
458
503
  }
459
504
  center = t12;
460
505
  gap = band * 0.2;
461
506
  barWidth = Math.max(1, (band - gap) / chart.series.length);
462
507
  let t13;
463
- if ($[28] !== axisWidth || $[29] !== center || $[30] !== character || $[31] !== width) {
508
+ if ($[29] !== axisWidth || $[30] !== center || $[31] !== character || $[32] !== width) {
464
509
  t13 = (index_0, text) => {
465
510
  const half = uiChartTextWidth(text, character) / 2;
466
511
  return Math.round(Math.min(Math.max(center(index_0), axisWidth + half), width - half));
467
512
  };
468
- $[28] = axisWidth;
469
- $[29] = center;
470
- $[30] = character;
471
- $[31] = width;
472
- $[32] = t13;
513
+ $[29] = axisWidth;
514
+ $[30] = center;
515
+ $[31] = character;
516
+ $[32] = width;
517
+ $[33] = t13;
473
518
  } else {
474
- t13 = $[32];
519
+ t13 = $[33];
475
520
  }
476
521
  const labelAt = t13;
477
522
  let t14;
478
- if ($[33] !== center || $[34] !== y) {
479
- t14 = values => values.map((value_0, index_1) => value_0 === null ? null : `${center(index_1)} ${y(value_0)}`).reduce(_temp3, []).join(" ");
480
- $[33] = center;
481
- $[34] = y;
482
- $[35] = t14;
523
+ if ($[34] !== center || $[35] !== y) {
524
+ t14 = values => values.map((value_0, index_1) => value_0 === null ? null : `${center(index_1)} ${y(value_0)}`).reduce(_temp2, []).join(" ");
525
+ $[34] = center;
526
+ $[35] = y;
527
+ $[36] = t14;
483
528
  } else {
484
- t14 = $[35];
529
+ t14 = $[36];
485
530
  }
486
531
  segments = t14;
532
+ let t15;
533
+ if ($[37] !== baseline || $[38] !== center || $[39] !== y) {
534
+ t15 = values_0 => {
535
+ const shapes = [];
536
+ let run = [];
537
+ let first = 0;
538
+ values_0.forEach((value_1, index_3) => {
539
+ if (value_1 !== null) {
540
+ first = run.length === 0 ? index_3 : first;
541
+ run.push(`L${center(index_3)} ${y(value_1)}`);
542
+ }
543
+ if (run.length > 0 && (value_1 === null || index_3 === values_0.length - 1)) {
544
+ const last = value_1 === null ? index_3 - 1 : index_3;
545
+ shapes.push(`M${center(first)} ${baseline} ${run.join(" ")} L${center(last)} ${baseline} Z`);
546
+ run = [];
547
+ }
548
+ });
549
+ return shapes.join(" ");
550
+ };
551
+ $[37] = baseline;
552
+ $[38] = center;
553
+ $[39] = y;
554
+ $[40] = t15;
555
+ } else {
556
+ t15 = $[40];
557
+ }
558
+ areas = t15;
487
559
  t1 = width;
488
560
  t2 = HEIGHT;
489
561
  t3 = true;
490
562
  t4 = "block overflow-visible";
491
- if ($[36] === Symbol.for("react.memo_cache_sentinel")) {
563
+ if ($[41] === Symbol.for("react.memo_cache_sentinel")) {
492
564
  t5 = () => setHover(null);
493
- $[36] = t5;
565
+ $[41] = t5;
494
566
  } else {
495
- t5 = $[36];
567
+ t5 = $[41];
496
568
  }
497
- if ($[37] !== axisWidth || $[38] !== band || $[39] !== hover || $[40] !== plotHeight) {
569
+ if ($[42] !== axisWidth || $[43] !== band || $[44] !== hover || $[45] !== plotHeight) {
498
570
  t6 = hover !== null && /*#__PURE__*/_jsx("rect", {
499
571
  x: Math.round(axisWidth + band * hover),
500
572
  y: PLOT_TOP,
@@ -502,15 +574,15 @@ function VerticalChart(t0) {
502
574
  height: plotHeight,
503
575
  className: "fill-surface-hover"
504
576
  });
505
- $[37] = axisWidth;
506
- $[38] = band;
507
- $[39] = hover;
508
- $[40] = plotHeight;
509
- $[41] = t6;
577
+ $[42] = axisWidth;
578
+ $[43] = band;
579
+ $[44] = hover;
580
+ $[45] = plotHeight;
581
+ $[46] = t6;
510
582
  } else {
511
- t6 = $[41];
583
+ t6 = $[46];
512
584
  }
513
- t7 = ticks.map((tick, index_3) => /*#__PURE__*/_jsxs("g", {
585
+ t7 = ticks.map((tick, index_4) => /*#__PURE__*/_jsxs("g", {
514
586
  children: [/*#__PURE__*/_jsx("line", {
515
587
  x1: axisWidth,
516
588
  x2: width,
@@ -524,142 +596,151 @@ function VerticalChart(t0) {
524
596
  dy: "0.32em",
525
597
  textAnchor: "end",
526
598
  className: "fill-text-faint text-xs tabular-nums",
527
- children: tickTexts[index_3]
599
+ children: tickTexts[index_4]
528
600
  })]
529
601
  }, tick));
530
- t8 = chart.labels.map((label, index_4) => {
531
- if (index_4 % labelEvery !== 0) {
602
+ t8 = chart.labels.map((label, index_5) => {
603
+ if (index_5 % labelEvery !== 0) {
532
604
  return null;
533
605
  }
534
606
  const text_0 = uiChartText(label, labelRoom, character);
535
607
  return /*#__PURE__*/_jsx("text", {
536
- x: labelAt(index_4, text_0),
608
+ x: labelAt(index_5, text_0),
537
609
  y: HEIGHT - 4,
538
610
  textAnchor: "middle",
539
611
  className: "fill-text-faint text-xs",
540
612
  children: text_0
541
- }, index_4);
613
+ }, index_5);
542
614
  });
543
615
  $[0] = character;
544
616
  $[1] = chart;
545
617
  $[2] = hover;
546
618
  $[3] = unit;
547
619
  $[4] = width;
548
- $[5] = axisWidth;
549
- $[6] = band;
550
- $[7] = barWidth;
551
- $[8] = baseline;
552
- $[9] = center;
553
- $[10] = gap;
554
- $[11] = segments;
555
- $[12] = t1;
556
- $[13] = t2;
557
- $[14] = t3;
558
- $[15] = t4;
559
- $[16] = t5;
560
- $[17] = t6;
561
- $[18] = t7;
562
- $[19] = t8;
563
- $[20] = y;
620
+ $[5] = areas;
621
+ $[6] = axisWidth;
622
+ $[7] = band;
623
+ $[8] = barWidth;
624
+ $[9] = baseline;
625
+ $[10] = center;
626
+ $[11] = gap;
627
+ $[12] = segments;
628
+ $[13] = t1;
629
+ $[14] = t2;
630
+ $[15] = t3;
631
+ $[16] = t4;
632
+ $[17] = t5;
633
+ $[18] = t6;
634
+ $[19] = t7;
635
+ $[20] = t8;
636
+ $[21] = y;
564
637
  } else {
565
- axisWidth = $[5];
566
- band = $[6];
567
- barWidth = $[7];
568
- baseline = $[8];
569
- center = $[9];
570
- gap = $[10];
571
- segments = $[11];
572
- t1 = $[12];
573
- t2 = $[13];
574
- t3 = $[14];
575
- t4 = $[15];
576
- t5 = $[16];
577
- t6 = $[17];
578
- t7 = $[18];
579
- t8 = $[19];
580
- y = $[20];
638
+ areas = $[5];
639
+ axisWidth = $[6];
640
+ band = $[7];
641
+ barWidth = $[8];
642
+ baseline = $[9];
643
+ center = $[10];
644
+ gap = $[11];
645
+ segments = $[12];
646
+ t1 = $[13];
647
+ t2 = $[14];
648
+ t3 = $[15];
649
+ t4 = $[16];
650
+ t5 = $[17];
651
+ t6 = $[18];
652
+ t7 = $[19];
653
+ t8 = $[20];
654
+ y = $[21];
581
655
  }
582
656
  let t9;
583
- if ($[42] !== axisWidth || $[43] !== band || $[44] !== barWidth || $[45] !== baseline || $[46] !== center || $[47] !== chart.labels.length || $[48] !== chart.series || $[49] !== gap || $[50] !== kind || $[51] !== segments || $[52] !== y) {
657
+ if ($[47] !== areas || $[48] !== axisWidth || $[49] !== band || $[50] !== barWidth || $[51] !== baseline || $[52] !== center || $[53] !== chart.labels.length || $[54] !== chart.series || $[55] !== gap || $[56] !== kind || $[57] !== segments || $[58] !== tones || $[59] !== y) {
584
658
  t9 = kind === "bar" ? /*#__PURE__*/_jsx("g", {
585
659
  className: clsx(GROW, "starting:scale-y-0"),
586
660
  style: {
587
661
  transformOrigin: `0px ${baseline}px`
588
662
  },
589
- children: chart.series.map((series, at) => series.values.map((value_1, index_5) => value_1 === null ? null : /*#__PURE__*/_jsx("rect", {
590
- x: Math.round(axisWidth + band * index_5 + gap / 2 + barWidth * at),
591
- y: Math.min(y(value_1), baseline),
663
+ children: chart.series.map((series, at) => series.values.map((value_2, index_6) => value_2 === null ? null : /*#__PURE__*/_jsx("rect", {
664
+ x: Math.round(axisWidth + band * index_6 + gap / 2 + barWidth * at),
665
+ y: Math.min(y(value_2), baseline),
592
666
  width: Math.max(1, Math.round(barWidth) - 1),
593
- height: Math.abs(y(value_1) - baseline),
667
+ height: Math.abs(y(value_2) - baseline),
594
668
  rx: 2,
595
669
  style: {
596
- fill: seriesColor(at)
670
+ fill: seriesColor(at, series.key, tones)
597
671
  }
598
- }, `${series.key}:${index_5}`)))
672
+ }, `${series.key}:${index_6}`)))
599
673
  }) : /*#__PURE__*/_jsx("g", {
600
674
  className: clsx(GROW, "starting:opacity-0"),
601
675
  children: chart.series.map((series_0, at_0) => /*#__PURE__*/_jsxs("g", {
602
676
  style: {
603
- color: seriesColor(at_0)
677
+ color: seriesColor(at_0, series_0.key, tones)
604
678
  },
605
- children: [/*#__PURE__*/_jsx("path", {
679
+ children: [kind === "area" && /*#__PURE__*/_jsx("path", {
680
+ d: areas(series_0.values),
681
+ fill: "currentColor",
682
+ fillOpacity: 0.16,
683
+ stroke: "none"
684
+ }), /*#__PURE__*/_jsx("path", {
606
685
  d: segments(series_0.values),
607
686
  fill: "none",
608
687
  stroke: "currentColor",
609
688
  strokeWidth: 2,
610
689
  strokeLinejoin: "round",
611
690
  strokeLinecap: "round"
612
- }), chart.labels.length <= DOTS_UP_TO && series_0.values.map((value_2, index_6) => value_2 === null ? null : /*#__PURE__*/_jsx("circle", {
613
- cx: center(index_6),
614
- cy: y(value_2),
691
+ }), chart.labels.length <= DOTS_UP_TO && series_0.values.map((value_3, index_7) => value_3 === null ? null : /*#__PURE__*/_jsx("circle", {
692
+ cx: center(index_7),
693
+ cy: y(value_3),
615
694
  r: 3,
616
695
  fill: "currentColor"
617
- }, index_6))]
696
+ }, index_7))]
618
697
  }, series_0.key))
619
698
  });
620
- $[42] = axisWidth;
621
- $[43] = band;
622
- $[44] = barWidth;
623
- $[45] = baseline;
624
- $[46] = center;
625
- $[47] = chart.labels.length;
626
- $[48] = chart.series;
627
- $[49] = gap;
628
- $[50] = kind;
629
- $[51] = segments;
630
- $[52] = y;
631
- $[53] = t9;
699
+ $[47] = areas;
700
+ $[48] = axisWidth;
701
+ $[49] = band;
702
+ $[50] = barWidth;
703
+ $[51] = baseline;
704
+ $[52] = center;
705
+ $[53] = chart.labels.length;
706
+ $[54] = chart.series;
707
+ $[55] = gap;
708
+ $[56] = kind;
709
+ $[57] = segments;
710
+ $[58] = tones;
711
+ $[59] = y;
712
+ $[60] = t9;
632
713
  } else {
633
- t9 = $[53];
714
+ t9 = $[60];
634
715
  }
635
716
  let t10;
636
- if ($[54] !== axisWidth || $[55] !== band || $[56] !== chart.labels) {
717
+ if ($[61] !== axisWidth || $[62] !== band || $[63] !== chart.labels) {
637
718
  let t11;
638
- if ($[58] !== axisWidth || $[59] !== band) {
639
- t11 = (_, index_7) => /*#__PURE__*/_jsx("rect", {
640
- x: Math.round(axisWidth + band * index_7),
719
+ if ($[65] !== axisWidth || $[66] !== band) {
720
+ t11 = (_, index_8) => /*#__PURE__*/_jsx("rect", {
721
+ x: Math.round(axisWidth + band * index_8),
641
722
  y: 0,
642
723
  width: Math.max(1, Math.round(band)),
643
724
  height: HEIGHT,
644
725
  fill: "transparent",
645
- onPointerEnter: () => setHover(index_7)
646
- }, index_7);
647
- $[58] = axisWidth;
648
- $[59] = band;
649
- $[60] = t11;
726
+ onPointerEnter: () => setHover(index_8)
727
+ }, index_8);
728
+ $[65] = axisWidth;
729
+ $[66] = band;
730
+ $[67] = t11;
650
731
  } else {
651
- t11 = $[60];
732
+ t11 = $[67];
652
733
  }
653
734
  t10 = chart.labels.map(t11);
654
- $[54] = axisWidth;
655
- $[55] = band;
656
- $[56] = chart.labels;
657
- $[57] = t10;
735
+ $[61] = axisWidth;
736
+ $[62] = band;
737
+ $[63] = chart.labels;
738
+ $[64] = t10;
658
739
  } else {
659
- t10 = $[57];
740
+ t10 = $[64];
660
741
  }
661
742
  let t11;
662
- if ($[61] !== t1 || $[62] !== t10 || $[63] !== t2 || $[64] !== t3 || $[65] !== t4 || $[66] !== t5 || $[67] !== t6 || $[68] !== t7 || $[69] !== t8 || $[70] !== t9) {
743
+ if ($[68] !== t1 || $[69] !== t10 || $[70] !== t2 || $[71] !== t3 || $[72] !== t4 || $[73] !== t5 || $[74] !== t6 || $[75] !== t7 || $[76] !== t8 || $[77] !== t9) {
663
744
  t11 = /*#__PURE__*/_jsxs("svg", {
664
745
  width: t1,
665
746
  height: t2,
@@ -668,63 +749,64 @@ function VerticalChart(t0) {
668
749
  onPointerLeave: t5,
669
750
  children: [t6, t7, t8, t9, t10]
670
751
  });
671
- $[61] = t1;
672
- $[62] = t10;
673
- $[63] = t2;
674
- $[64] = t3;
675
- $[65] = t4;
676
- $[66] = t5;
677
- $[67] = t6;
678
- $[68] = t7;
679
- $[69] = t8;
680
- $[70] = t9;
681
- $[71] = t11;
752
+ $[68] = t1;
753
+ $[69] = t10;
754
+ $[70] = t2;
755
+ $[71] = t3;
756
+ $[72] = t4;
757
+ $[73] = t5;
758
+ $[74] = t6;
759
+ $[75] = t7;
760
+ $[76] = t8;
761
+ $[77] = t9;
762
+ $[78] = t11;
682
763
  } else {
683
- t11 = $[71];
764
+ t11 = $[78];
684
765
  }
685
766
  let t12;
686
- if ($[72] !== center || $[73] !== chart || $[74] !== hover || $[75] !== unit || $[76] !== width) {
767
+ if ($[79] !== center || $[80] !== chart || $[81] !== hover || $[82] !== unit || $[83] !== width) {
687
768
  t12 = hover !== null && /*#__PURE__*/_jsx(Readout, {
688
769
  chart: chart,
689
770
  index: hover,
690
771
  unit: unit,
691
772
  left: Math.min(Math.max(center(hover), 64), Math.max(64, width - 64))
692
773
  });
693
- $[72] = center;
694
- $[73] = chart;
695
- $[74] = hover;
696
- $[75] = unit;
697
- $[76] = width;
698
- $[77] = t12;
774
+ $[79] = center;
775
+ $[80] = chart;
776
+ $[81] = hover;
777
+ $[82] = unit;
778
+ $[83] = width;
779
+ $[84] = t12;
699
780
  } else {
700
- t12 = $[77];
781
+ t12 = $[84];
701
782
  }
702
783
  let t13;
703
- if ($[78] !== t11 || $[79] !== t12) {
784
+ if ($[85] !== t11 || $[86] !== t12) {
704
785
  t13 = /*#__PURE__*/_jsxs(_Fragment, {
705
786
  children: [t11, t12]
706
787
  });
707
- $[78] = t11;
708
- $[79] = t12;
709
- $[80] = t13;
788
+ $[85] = t11;
789
+ $[86] = t12;
790
+ $[87] = t13;
710
791
  } else {
711
- t13 = $[80];
792
+ t13 = $[87];
712
793
  }
713
794
  return t13;
714
795
  }
715
796
  /* A row of 24px per category, its label beside the bars, which grow from zero to either side. */
716
- function _temp3(paths, point, index_2, all) {
797
+ function _temp2(paths, point, index_2, all) {
717
798
  if (point !== null) {
718
799
  paths.push(`${index_2 === 0 || all[index_2 - 1] === null ? "M" : "L"}${point}`);
719
800
  }
720
801
  return paths;
721
802
  }
722
803
  function HorizontalChart(t0) {
723
- const $ = _c(20);
804
+ const $ = _c(22);
724
805
  const {
725
806
  chart,
726
807
  unit
727
808
  } = t0;
809
+ const tones = useContext(TonesContext);
728
810
  const valueUnit = unitApart(unit) ? undefined : unit;
729
811
  let t1;
730
812
  if ($[0] !== chart.max || $[1] !== chart.min) {
@@ -743,9 +825,9 @@ function HorizontalChart(t0) {
743
825
  const zero = -low / span * 100;
744
826
  const single = chart.series.length === 1;
745
827
  let t2;
746
- if ($[3] !== chart.labels || $[4] !== chart.series || $[5] !== low || $[6] !== single || $[7] !== span || $[8] !== valueUnit || $[9] !== zero) {
828
+ if ($[3] !== chart.labels || $[4] !== chart.series || $[5] !== low || $[6] !== single || $[7] !== span || $[8] !== tones || $[9] !== valueUnit || $[10] !== zero) {
747
829
  let t3;
748
- if ($[11] !== chart.series || $[12] !== low || $[13] !== single || $[14] !== span || $[15] !== valueUnit || $[16] !== zero) {
830
+ if ($[12] !== chart.series || $[13] !== low || $[14] !== single || $[15] !== span || $[16] !== tones || $[17] !== valueUnit || $[18] !== zero) {
749
831
  t3 = (label, index) => /*#__PURE__*/_jsxs("div", {
750
832
  className: "flex h-6 items-center gap-2 text-xs",
751
833
  children: [/*#__PURE__*/_jsx("span", {
@@ -767,7 +849,7 @@ function HorizontalChart(t0) {
767
849
  style: {
768
850
  left: `${(Math.min(value, 0) - low) / span * 100}%`,
769
851
  width: `${Math.abs(value) / span * 100}%`,
770
- backgroundColor: seriesColor(at)
852
+ backgroundColor: seriesColor(at, series.key, tones)
771
853
  }
772
854
  })
773
855
  }, series.key);
@@ -777,15 +859,16 @@ function HorizontalChart(t0) {
777
859
  children: valueText(chart.series[0].values[index] ?? null, valueUnit)
778
860
  })]
779
861
  }, index);
780
- $[11] = chart.series;
781
- $[12] = low;
782
- $[13] = single;
783
- $[14] = span;
784
- $[15] = valueUnit;
785
- $[16] = zero;
786
- $[17] = t3;
862
+ $[12] = chart.series;
863
+ $[13] = low;
864
+ $[14] = single;
865
+ $[15] = span;
866
+ $[16] = tones;
867
+ $[17] = valueUnit;
868
+ $[18] = zero;
869
+ $[19] = t3;
787
870
  } else {
788
- t3 = $[17];
871
+ t3 = $[19];
789
872
  }
790
873
  t2 = chart.labels.map(t3);
791
874
  $[3] = chart.labels;
@@ -793,37 +876,39 @@ function HorizontalChart(t0) {
793
876
  $[5] = low;
794
877
  $[6] = single;
795
878
  $[7] = span;
796
- $[8] = valueUnit;
797
- $[9] = zero;
798
- $[10] = t2;
879
+ $[8] = tones;
880
+ $[9] = valueUnit;
881
+ $[10] = zero;
882
+ $[11] = t2;
799
883
  } else {
800
- t2 = $[10];
884
+ t2 = $[11];
801
885
  }
802
886
  let t3;
803
- if ($[18] !== t2) {
887
+ if ($[20] !== t2) {
804
888
  t3 = /*#__PURE__*/_jsx("div", {
805
889
  "aria-hidden": true,
806
890
  className: "flex flex-col",
807
891
  children: t2
808
892
  });
809
- $[18] = t2;
810
- $[19] = t3;
893
+ $[20] = t2;
894
+ $[21] = t3;
811
895
  } else {
812
- t3 = $[19];
896
+ t3 = $[21];
813
897
  }
814
898
  return t3;
815
899
  }
816
900
  /* A bar per category split into its series, on one scale so the rows compare. */
817
901
  function StackedChart(t0) {
818
- const $ = _c(12);
902
+ const $ = _c(14);
819
903
  const {
820
904
  chart,
821
905
  unit
822
906
  } = t0;
907
+ const tones = useContext(TonesContext);
823
908
  let t1;
824
- if ($[0] !== chart.labels || $[1] !== chart.max || $[2] !== chart.series || $[3] !== unit) {
909
+ if ($[0] !== chart.labels || $[1] !== chart.max || $[2] !== chart.series || $[3] !== tones || $[4] !== unit) {
825
910
  let t2;
826
- if ($[5] !== chart.labels.length || $[6] !== chart.max || $[7] !== chart.series || $[8] !== unit) {
911
+ if ($[6] !== chart.labels.length || $[7] !== chart.max || $[8] !== chart.series || $[9] !== tones || $[10] !== unit) {
827
912
  t2 = (label, index) => /*#__PURE__*/_jsxs("div", {
828
913
  className: "flex items-center gap-2 text-xs",
829
914
  children: [chart.labels.length > 1 && /*#__PURE__*/_jsx("span", {
@@ -836,38 +921,40 @@ function StackedChart(t0) {
836
921
  range: [0, chart.max],
837
922
  parts: chart.series.map((series, at) => ({
838
923
  value: series.values[index] ?? 0,
839
- color: seriesColor(at),
924
+ color: seriesColor(at, series.key, tones),
840
925
  label: `${series.key} ${valueText(series.values[index] ?? 0, unit)}`
841
926
  }))
842
927
  })]
843
928
  }, index);
844
- $[5] = chart.labels.length;
845
- $[6] = chart.max;
846
- $[7] = chart.series;
847
- $[8] = unit;
848
- $[9] = t2;
929
+ $[6] = chart.labels.length;
930
+ $[7] = chart.max;
931
+ $[8] = chart.series;
932
+ $[9] = tones;
933
+ $[10] = unit;
934
+ $[11] = t2;
849
935
  } else {
850
- t2 = $[9];
936
+ t2 = $[11];
851
937
  }
852
938
  t1 = chart.labels.map(t2);
853
939
  $[0] = chart.labels;
854
940
  $[1] = chart.max;
855
941
  $[2] = chart.series;
856
- $[3] = unit;
857
- $[4] = t1;
942
+ $[3] = tones;
943
+ $[4] = unit;
944
+ $[5] = t1;
858
945
  } else {
859
- t1 = $[4];
946
+ t1 = $[5];
860
947
  }
861
948
  let t2;
862
- if ($[10] !== t1) {
949
+ if ($[12] !== t1) {
863
950
  t2 = /*#__PURE__*/_jsx("div", {
864
951
  className: "flex flex-col gap-2",
865
952
  children: t1
866
953
  });
867
- $[10] = t1;
868
- $[11] = t2;
954
+ $[12] = t1;
955
+ $[13] = t2;
869
956
  } else {
870
- t2 = $[11];
957
+ t2 = $[13];
871
958
  }
872
959
  return t2;
873
960
  }
@@ -886,7 +973,7 @@ function ChartNotes(t0) {
886
973
  const {
887
974
  t
888
975
  } = useTranslation("agent-chat");
889
- const [shown, setShown] = useBlockLocal(context, `${nodeId}:values`, _temp4);
976
+ const [shown, setShown] = useBlockLocal(context, `${nodeId}:values`, _temp3);
890
977
  let t1;
891
978
  if ($[0] !== chart.labels || $[1] !== chart.total || $[2] !== chart.truncated || $[3] !== t) {
892
979
  t1 = chart.truncated ? [t("blocks.chart.rowsLeftOut", {
@@ -950,7 +1037,7 @@ function ChartNotes(t0) {
950
1037
  if ($[19] !== notes) {
951
1038
  t6 = notes.length > 0 && /*#__PURE__*/_jsx("div", {
952
1039
  className: "flex flex-col gap-0.5 text-xs text-text-muted",
953
- children: notes.map(_temp5)
1040
+ children: notes.map(_temp4)
954
1041
  });
955
1042
  $[19] = notes;
956
1043
  $[20] = t6;
@@ -1014,21 +1101,23 @@ function ChartNotes(t0) {
1014
1101
  }
1015
1102
  return t10;
1016
1103
  }
1017
- function _temp5(note) {
1104
+ function _temp4(note) {
1018
1105
  return /*#__PURE__*/_jsx("p", {
1019
1106
  children: note
1020
1107
  }, note);
1021
1108
  }
1022
- function _temp4() {
1109
+ function _temp3() {
1023
1110
  return false;
1024
1111
  }
1025
1112
  function DrawnChart(t0) {
1026
- const $ = _c(50);
1113
+ const $ = _c(68);
1027
1114
  const {
1028
1115
  chart,
1029
1116
  requested,
1030
1117
  data,
1031
1118
  unit,
1119
+ title,
1120
+ tones,
1032
1121
  context,
1033
1122
  nodeId
1034
1123
  } = t0;
@@ -1038,6 +1127,7 @@ function DrawnChart(t0) {
1038
1127
  const [measure, width] = useMeasuredWidth();
1039
1128
  const character = useChartCharacter();
1040
1129
  const [measureRows, rowsCut] = useTruncated(true);
1130
+ let T0;
1041
1131
  let kind;
1042
1132
  let t1;
1043
1133
  let t2;
@@ -1045,32 +1135,65 @@ function DrawnChart(t0) {
1045
1135
  let t4;
1046
1136
  let t5;
1047
1137
  let t6;
1138
+ let t7;
1139
+ let t8;
1048
1140
  let values;
1049
- if ($[0] !== chart || $[1] !== data || $[2] !== measure || $[3] !== t || $[4] !== unit) {
1141
+ if ($[0] !== chart || $[1] !== data || $[2] !== measure || $[3] !== t || $[4] !== title || $[5] !== tones || $[6] !== unit) {
1050
1142
  values = uiChartValues(data);
1051
1143
  ({
1052
1144
  kind
1053
1145
  } = chart);
1146
+ let t9;
1147
+ if ($[18] !== chart.series || $[19] !== tones) {
1148
+ let t10;
1149
+ if ($[21] !== tones) {
1150
+ t10 = series => seriesTone(series.key, tones) !== undefined;
1151
+ $[21] = tones;
1152
+ $[22] = t10;
1153
+ } else {
1154
+ t10 = $[22];
1155
+ }
1156
+ t9 = chart.series.some(t10);
1157
+ $[18] = chart.series;
1158
+ $[19] = tones;
1159
+ $[20] = t9;
1160
+ } else {
1161
+ t9 = $[20];
1162
+ }
1163
+ const toned = t9;
1164
+ T0 = TonesContext;
1165
+ t8 = tones;
1054
1166
  t4 = "chat-ui-flat flex flex-col gap-2.5 rounded-xl bg-ui-tile p-3.5";
1055
- if ($[13] !== chart) {
1056
- t5 = chart.series.length > 1 && /*#__PURE__*/_jsx(Legend, {
1167
+ if ($[23] !== title) {
1168
+ t5 = title !== undefined && title !== "" && /*#__PURE__*/_jsx("figcaption", {
1169
+ className: "text-xs font-medium wrap-break-word text-text",
1170
+ children: title
1171
+ });
1172
+ $[23] = title;
1173
+ $[24] = t5;
1174
+ } else {
1175
+ t5 = $[24];
1176
+ }
1177
+ if ($[25] !== chart || $[26] !== toned) {
1178
+ t6 = (chart.series.length > 1 || toned) && /*#__PURE__*/_jsx(Legend, {
1057
1179
  chart: chart
1058
1180
  });
1059
- $[13] = chart;
1060
- $[14] = t5;
1181
+ $[25] = chart;
1182
+ $[26] = toned;
1183
+ $[27] = t6;
1061
1184
  } else {
1062
- t5 = $[14];
1185
+ t6 = $[27];
1063
1186
  }
1064
- if ($[15] !== kind || $[16] !== unit) {
1065
- t6 = kind !== "stacked" && unitApart(unit) && /*#__PURE__*/_jsx("p", {
1187
+ if ($[28] !== kind || $[29] !== unit) {
1188
+ t7 = kind !== "stacked" && unitApart(unit) && /*#__PURE__*/_jsx("p", {
1066
1189
  className: "text-xs text-text-faint",
1067
1190
  children: unit
1068
1191
  });
1069
- $[15] = kind;
1070
- $[16] = unit;
1071
- $[17] = t6;
1192
+ $[28] = kind;
1193
+ $[29] = unit;
1194
+ $[30] = t7;
1072
1195
  } else {
1073
- t6 = $[17];
1196
+ t7 = $[30];
1074
1197
  }
1075
1198
  t1 = measure;
1076
1199
  t2 = "img";
@@ -1079,28 +1202,36 @@ function DrawnChart(t0) {
1079
1202
  $[1] = data;
1080
1203
  $[2] = measure;
1081
1204
  $[3] = t;
1082
- $[4] = unit;
1083
- $[5] = kind;
1084
- $[6] = t1;
1085
- $[7] = t2;
1086
- $[8] = t3;
1087
- $[9] = t4;
1088
- $[10] = t5;
1089
- $[11] = t6;
1090
- $[12] = values;
1205
+ $[4] = title;
1206
+ $[5] = tones;
1207
+ $[6] = unit;
1208
+ $[7] = T0;
1209
+ $[8] = kind;
1210
+ $[9] = t1;
1211
+ $[10] = t2;
1212
+ $[11] = t3;
1213
+ $[12] = t4;
1214
+ $[13] = t5;
1215
+ $[14] = t6;
1216
+ $[15] = t7;
1217
+ $[16] = t8;
1218
+ $[17] = values;
1091
1219
  } else {
1092
- kind = $[5];
1093
- t1 = $[6];
1094
- t2 = $[7];
1095
- t3 = $[8];
1096
- t4 = $[9];
1097
- t5 = $[10];
1098
- t6 = $[11];
1099
- values = $[12];
1220
+ T0 = $[7];
1221
+ kind = $[8];
1222
+ t1 = $[9];
1223
+ t2 = $[10];
1224
+ t3 = $[11];
1225
+ t4 = $[12];
1226
+ t5 = $[13];
1227
+ t6 = $[14];
1228
+ t7 = $[15];
1229
+ t8 = $[16];
1230
+ values = $[17];
1100
1231
  }
1101
- let t7;
1102
- if ($[18] !== character || $[19] !== chart || $[20] !== kind || $[21] !== measureRows || $[22] !== unit || $[23] !== width) {
1103
- t7 = kind === "hbar" || kind === "stacked" ? /*#__PURE__*/_jsx("div", {
1232
+ let t9;
1233
+ if ($[31] !== character || $[32] !== chart || $[33] !== kind || $[34] !== measureRows || $[35] !== unit || $[36] !== width) {
1234
+ t9 = kind === "hbar" || kind === "stacked" ? /*#__PURE__*/_jsx("div", {
1104
1235
  ref: measureRows,
1105
1236
  children: kind === "hbar" ? /*#__PURE__*/_jsx(HorizontalChart, {
1106
1237
  chart: chart,
@@ -1121,90 +1252,104 @@ function DrawnChart(t0) {
1121
1252
  character: character
1122
1253
  })
1123
1254
  });
1124
- $[18] = character;
1125
- $[19] = chart;
1126
- $[20] = kind;
1127
- $[21] = measureRows;
1128
- $[22] = unit;
1129
- $[23] = width;
1130
- $[24] = t7;
1255
+ $[31] = character;
1256
+ $[32] = chart;
1257
+ $[33] = kind;
1258
+ $[34] = measureRows;
1259
+ $[35] = unit;
1260
+ $[36] = width;
1261
+ $[37] = t9;
1131
1262
  } else {
1132
- t7 = $[24];
1263
+ t9 = $[37];
1133
1264
  }
1134
- let t8;
1135
- if ($[25] !== t1 || $[26] !== t2 || $[27] !== t3 || $[28] !== t7) {
1136
- t8 = /*#__PURE__*/_jsx("div", {
1265
+ let t10;
1266
+ if ($[38] !== t1 || $[39] !== t2 || $[40] !== t3 || $[41] !== t9) {
1267
+ t10 = /*#__PURE__*/_jsx("div", {
1137
1268
  ref: t1,
1138
1269
  role: t2,
1139
1270
  "aria-label": t3,
1140
1271
  className: "relative",
1141
- children: t7
1272
+ children: t9
1142
1273
  });
1143
- $[25] = t1;
1144
- $[26] = t2;
1145
- $[27] = t3;
1146
- $[28] = t7;
1147
- $[29] = t8;
1274
+ $[38] = t1;
1275
+ $[39] = t2;
1276
+ $[40] = t3;
1277
+ $[41] = t9;
1278
+ $[42] = t10;
1148
1279
  } else {
1149
- t8 = $[29];
1280
+ t10 = $[42];
1150
1281
  }
1151
- let t9;
1152
- if ($[30] !== character || $[31] !== chart || $[32] !== rowsCut || $[33] !== unit || $[34] !== width) {
1153
- t9 = rowsCut || labelsCut(chart, unit, width, character);
1154
- $[30] = character;
1155
- $[31] = chart;
1156
- $[32] = rowsCut;
1157
- $[33] = unit;
1158
- $[34] = width;
1159
- $[35] = t9;
1282
+ let t11;
1283
+ if ($[43] !== character || $[44] !== chart || $[45] !== rowsCut || $[46] !== unit || $[47] !== width) {
1284
+ t11 = rowsCut || labelsCut(chart, unit, width, character);
1285
+ $[43] = character;
1286
+ $[44] = chart;
1287
+ $[45] = rowsCut;
1288
+ $[46] = unit;
1289
+ $[47] = width;
1290
+ $[48] = t11;
1160
1291
  } else {
1161
- t9 = $[35];
1292
+ t11 = $[48];
1162
1293
  }
1163
- let t10;
1164
- if ($[36] !== chart || $[37] !== context || $[38] !== nodeId || $[39] !== requested || $[40] !== t9 || $[41] !== unit || $[42] !== values) {
1165
- t10 = /*#__PURE__*/_jsx(ChartNotes, {
1294
+ let t12;
1295
+ if ($[49] !== chart || $[50] !== context || $[51] !== nodeId || $[52] !== requested || $[53] !== t11 || $[54] !== unit || $[55] !== values) {
1296
+ t12 = /*#__PURE__*/_jsx(ChartNotes, {
1166
1297
  chart: chart,
1167
1298
  requested: requested,
1168
- cut: t9,
1299
+ cut: t11,
1169
1300
  values: values,
1170
1301
  unit: unit,
1171
1302
  context: context,
1172
1303
  nodeId: nodeId
1173
1304
  });
1174
- $[36] = chart;
1175
- $[37] = context;
1176
- $[38] = nodeId;
1177
- $[39] = requested;
1178
- $[40] = t9;
1179
- $[41] = unit;
1180
- $[42] = values;
1181
- $[43] = t10;
1305
+ $[49] = chart;
1306
+ $[50] = context;
1307
+ $[51] = nodeId;
1308
+ $[52] = requested;
1309
+ $[53] = t11;
1310
+ $[54] = unit;
1311
+ $[55] = values;
1312
+ $[56] = t12;
1182
1313
  } else {
1183
- t10 = $[43];
1314
+ t12 = $[56];
1184
1315
  }
1185
- let t11;
1186
- if ($[44] !== t10 || $[45] !== t4 || $[46] !== t5 || $[47] !== t6 || $[48] !== t8) {
1187
- t11 = /*#__PURE__*/_jsxs("figure", {
1316
+ let t13;
1317
+ if ($[57] !== t10 || $[58] !== t12 || $[59] !== t4 || $[60] !== t5 || $[61] !== t6 || $[62] !== t7) {
1318
+ t13 = /*#__PURE__*/_jsxs("figure", {
1188
1319
  className: t4,
1189
- children: [t5, t6, t8, t10]
1320
+ children: [t5, t6, t7, t10, t12]
1190
1321
  });
1191
- $[44] = t10;
1192
- $[45] = t4;
1193
- $[46] = t5;
1194
- $[47] = t6;
1195
- $[48] = t8;
1196
- $[49] = t11;
1322
+ $[57] = t10;
1323
+ $[58] = t12;
1324
+ $[59] = t4;
1325
+ $[60] = t5;
1326
+ $[61] = t6;
1327
+ $[62] = t7;
1328
+ $[63] = t13;
1197
1329
  } else {
1198
- t11 = $[49];
1330
+ t13 = $[63];
1199
1331
  }
1200
- return t11;
1332
+ let t14;
1333
+ if ($[64] !== T0 || $[65] !== t13 || $[66] !== t8) {
1334
+ t14 = /*#__PURE__*/_jsx(T0, {
1335
+ value: t8,
1336
+ children: t13
1337
+ });
1338
+ $[64] = T0;
1339
+ $[65] = t13;
1340
+ $[66] = t8;
1341
+ $[67] = t14;
1342
+ } else {
1343
+ t14 = $[67];
1344
+ }
1345
+ return t14;
1201
1346
  }
1202
1347
  /*
1203
1348
  * Draws only once its node closed; until then a quiet surface of the height it will take holds its
1204
1349
  * place. It grows in once, and not at all for a person who asked for less motion.
1205
1350
  */
1206
1351
  export function ChartRenderer(t0) {
1207
- const $ = _c(19);
1352
+ const $ = _c(21);
1208
1353
  const {
1209
1354
  node,
1210
1355
  context
@@ -1212,7 +1357,9 @@ export function ChartRenderer(t0) {
1212
1357
  const {
1213
1358
  kind,
1214
1359
  data,
1215
- unit
1360
+ unit,
1361
+ title,
1362
+ tones
1216
1363
  } = node.props;
1217
1364
  let t1;
1218
1365
  if ($[0] !== data || $[1] !== kind || $[2] !== node.complete) {
@@ -1275,12 +1422,14 @@ export function ChartRenderer(t0) {
1275
1422
  return t3;
1276
1423
  }
1277
1424
  let t2;
1278
- if ($[12] !== chart || $[13] !== context || $[14] !== data || $[15] !== kind || $[16] !== node.id || $[17] !== unit) {
1425
+ if ($[12] !== chart || $[13] !== context || $[14] !== data || $[15] !== kind || $[16] !== node.id || $[17] !== title || $[18] !== tones || $[19] !== unit) {
1279
1426
  t2 = /*#__PURE__*/_jsx(DrawnChart, {
1280
1427
  chart: chart,
1281
1428
  requested: kind,
1282
1429
  data: data,
1283
1430
  unit: unit,
1431
+ title: title,
1432
+ tones: tones,
1284
1433
  context: context,
1285
1434
  nodeId: node.id
1286
1435
  });
@@ -1289,10 +1438,12 @@ export function ChartRenderer(t0) {
1289
1438
  $[14] = data;
1290
1439
  $[15] = kind;
1291
1440
  $[16] = node.id;
1292
- $[17] = unit;
1293
- $[18] = t2;
1441
+ $[17] = title;
1442
+ $[18] = tones;
1443
+ $[19] = unit;
1444
+ $[20] = t2;
1294
1445
  } else {
1295
- t2 = $[18];
1446
+ t2 = $[20];
1296
1447
  }
1297
1448
  return t2;
1298
1449
  }