@mgamadeus/ddd-agents 0.1.36 → 0.1.38

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 (36) hide show
  1. package/README.md +20 -0
  2. package/dist/chat.js +6 -6
  3. package/dist/chunks/{ConversationMessageInputComposerWidgets-CMJL6lua.js → ConversationMessageInputComposerWidgets-CI1GZIz7.js} +4 -4
  4. package/dist/chunks/{ConversationMessageInputComposerWidgets-CMJL6lua.js.map → ConversationMessageInputComposerWidgets-CI1GZIz7.js.map} +1 -1
  5. package/dist/chunks/{WebSearchResultsConversationWidget-DMAzB2yP.js → WebSearchResultsConversationWidget-qp4zrauN.js} +691 -187
  6. package/dist/chunks/WebSearchResultsConversationWidget-qp4zrauN.js.map +1 -0
  7. package/dist/chunks/{canvas-reducers-yUzQbRiW.js → canvas-reducers-f_ld2U0X.js} +2 -2
  8. package/dist/chunks/{canvas-reducers-yUzQbRiW.js.map → canvas-reducers-f_ld2U0X.js.map} +1 -1
  9. package/dist/chunks/{canvas-title-slot-context-B3hRpP4c.js → canvas-title-slot-context-CTMVP_js.js} +3 -3
  10. package/dist/chunks/{canvas-title-slot-context-B3hRpP4c.js.map → canvas-title-slot-context-CTMVP_js.js.map} +1 -1
  11. package/dist/chunks/{canvasBodies-ByvWqkGP.js → canvasBodies-DtjJM249.js} +3 -3
  12. package/dist/chunks/{canvasBodies-ByvWqkGP.js.map → canvasBodies-DtjJM249.js.map} +1 -1
  13. package/dist/chunks/{widget-name-resolver-qt2GgCFE.js → widget-name-resolver-COqzO2QW.js} +27 -17
  14. package/dist/chunks/widget-name-resolver-COqzO2QW.js.map +1 -0
  15. package/dist/client-testing.js +3 -3
  16. package/dist/files/i18n-keys.json +158 -0
  17. package/dist/files/widgets/DriveFilesConversationWidget/DriveFilesConversationWidget.md +59 -0
  18. package/dist/files/widgets/DriveFilesConversationWidget/drive-files.preview-fixtures.json +39 -0
  19. package/dist/image-render.js +7 -7
  20. package/dist/index.js +7 -6
  21. package/dist/kit.js +2 -2
  22. package/dist/preview.js +108 -101
  23. package/dist/preview.js.map +1 -1
  24. package/dist/renderer.js +43 -43
  25. package/dist/styles.css +150 -63
  26. package/dist/types/entries/index.d.ts +2 -0
  27. package/dist/types/entries/widgets.d.ts +3 -0
  28. package/dist/types/widgets/DriveFilesConversationWidget/DriveFilesConversationWidget.d.ts +8 -0
  29. package/dist/types/widgets/DriveFilesConversationWidget/shared/drive-file-cards-source.d.ts +37 -0
  30. package/dist/types/widgets/DriveFilesConversationWidget/shared/drive-files.d.ts +88 -0
  31. package/dist/widgets.js +59 -99
  32. package/dist/widgets.js.map +1 -1
  33. package/package.json +3 -1
  34. package/public-api.json +24 -0
  35. package/dist/chunks/WebSearchResultsConversationWidget-DMAzB2yP.js.map +0 -1
  36. package/dist/chunks/widget-name-resolver-qt2GgCFE.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
3
- import { Y as getWidgetSelfHydrationKeyFieldName, aa as useAgentsStateSelector, a9 as useAgentsStateDispatch, ae as WidgetHydrationSlice, n as Skeleton, F as classNames, o as SkeletonText, x as WidgetText, H as HeroRow, g as HeroValue, B as Button, I as Icon, s as Text, J as escapePlainTextForText, a8 as useAgentsOwnerSettings, l as RangeSlider, a1 as translateText, V as getSandboxLegacyAliases, j as Markdown, A as AgentsLink, u as TextInput, t as TextArea, a2 as useAgentsActiveAgentSpaceKey, N as getAgentsEnvironment, z as buildUnnamedAgentSpaceLabel, E as buildWidgetOfAnotherAgentSpaceExplanation, v as Tooltip, h as InteractiveSurface, C as Checkbox, y as appendAnotherAgentSpaceToOwnerText, b as ConversationSearchResultsList } from "./link-navigation-DH3f2g9a.js";
3
+ import { Y as getWidgetSelfHydrationKeyFieldName, aa as useAgentsStateSelector, a9 as useAgentsStateDispatch, ae as WidgetHydrationSlice, n as Skeleton, F as classNames, o as SkeletonText, x as WidgetText, H as HeroRow, g as HeroValue, s as Text, B as Button, I as Icon, J as escapePlainTextForText, a8 as useAgentsOwnerSettings, l as RangeSlider, a1 as translateText, V as getSandboxLegacyAliases, a6 as useAgentsLinkNavigation, r as StatusChip, v as Tooltip, j as Markdown, A as AgentsLink, u as TextInput, t as TextArea, a2 as useAgentsActiveAgentSpaceKey, N as getAgentsEnvironment, z as buildUnnamedAgentSpaceLabel, E as buildWidgetOfAnotherAgentSpaceExplanation, h as InteractiveSurface, C as Checkbox, y as appendAnotherAgentSpaceToOwnerText, b as ConversationSearchResultsList } from "./link-navigation-DH3f2g9a.js";
4
4
  import { createContext, useContext, useMemo, useEffect, useId, useRef, useCallback, useState, useLayoutEffect, useSyncExternalStore } from "react";
5
5
  import { t as textKey } from "./text-key-DnoZ4lAk.js";
6
6
  import { visit } from "unist-util-visit";
@@ -332,7 +332,7 @@ const surface = "agents_surface_tMwX2D";
332
332
  const elevated = "agents_elevated_-BbIdM";
333
333
  const flat = "agents_flat_namOKd";
334
334
  const compact = "agents_compact_yOnFdX";
335
- const styles$m = {
335
+ const styles$p = {
336
336
  surface,
337
337
  elevated,
338
338
  flat,
@@ -345,7 +345,7 @@ const WidgetSurface = (props) => {
345
345
  {
346
346
  "data-surface-level": level,
347
347
  "data-testid": testId2,
348
- className: classNames(styles$m.surface, styles$m[level], compact2 && styles$m.compact, className),
348
+ className: classNames(styles$p.surface, styles$p[level], compact2 && styles$p.compact, className),
349
349
  children
350
350
  }
351
351
  );
@@ -356,7 +356,7 @@ const unitRow = "agents_unitRow_85Fm3Y";
356
356
  const valueBlock = "agents_valueBlock_6ElGqo";
357
357
  const textBlock = "agents_textBlock_WoVPQc";
358
358
  const textValue = "agents_textValue_oHvUdR";
359
- const styles$l = {
359
+ const styles$o = {
360
360
  kpi,
361
361
  labelRow,
362
362
  unitRow,
@@ -367,26 +367,80 @@ const styles$l = {
367
367
  const WidgetKpiValue = (props) => {
368
368
  const { label: label2, value, unit, delta, loading = false, valuePresentation = "hero", accent, meter, testId: testId2 } = props;
369
369
  const labelText = /* @__PURE__ */ jsx(WidgetText, { variant: "caption", tone: "light", translate: false, testId: testId2 && `${testId2}-label`, children: label2 });
370
- return /* @__PURE__ */ jsxs("div", { className: styles$l.kpi, children: [
371
- accent ? /* @__PURE__ */ jsxs("div", { className: styles$l.labelRow, children: [
370
+ return /* @__PURE__ */ jsxs("div", { className: styles$o.kpi, children: [
371
+ accent ? /* @__PURE__ */ jsxs("div", { className: styles$o.labelRow, children: [
372
372
  labelText,
373
373
  accent
374
374
  ] }) : labelText,
375
375
  /* @__PURE__ */ jsx(
376
376
  "div",
377
377
  {
378
- className: classNames(styles$l.valueBlock, valuePresentation === "text" && styles$l.textBlock),
378
+ className: classNames(styles$o.valueBlock, valuePresentation === "text" && styles$o.textBlock),
379
379
  "data-testid": testId2 && `${testId2}-value-block`,
380
- children: loading ? /* @__PURE__ */ jsx(SkeletonText, { width: "3em", height: 48 }) : valuePresentation === "text" ? /* @__PURE__ */ jsx(WidgetText, { variant: "title", translate: false, className: styles$l.textValue, children: value }) : /* @__PURE__ */ jsx(HeroRow, { children: /* @__PURE__ */ jsx(HeroValue, { children: value }) })
380
+ children: loading ? /* @__PURE__ */ jsx(SkeletonText, { width: "3em", height: 48 }) : valuePresentation === "text" ? /* @__PURE__ */ jsx(WidgetText, { variant: "title", translate: false, className: styles$o.textValue, children: value }) : /* @__PURE__ */ jsx(HeroRow, { children: /* @__PURE__ */ jsx(HeroValue, { children: value }) })
381
381
  }
382
382
  ),
383
383
  meter && !loading ? meter : null,
384
- (unit || delta) && !loading ? /* @__PURE__ */ jsxs("div", { className: styles$l.unitRow, children: [
384
+ (unit || delta) && !loading ? /* @__PURE__ */ jsxs("div", { className: styles$o.unitRow, children: [
385
385
  unit ? /* @__PURE__ */ jsx(WidgetText, { variant: "caption", tone: "light", translate: false, testId: testId2 && `${testId2}-unit`, children: unit }) : null,
386
386
  delta
387
387
  ] }) : null
388
388
  ] });
389
389
  };
390
+ const row$4 = "agents_row_3Kb6Jj";
391
+ const withoutLeading = "agents_withoutLeading_7XTCP7";
392
+ const clickable = "agents_clickable_-T4Zgc";
393
+ const text$2 = "agents_text_fJd93m";
394
+ const trailing = "agents_trailing_FOCyQL";
395
+ const styles$n = {
396
+ row: row$4,
397
+ withoutLeading,
398
+ clickable,
399
+ text: text$2,
400
+ trailing
401
+ };
402
+ const WidgetListRow = (props) => {
403
+ const { title: title2, meta: meta2, leading, trailing: trailing2, onClick, className, testId: testId2 } = props;
404
+ const rowClassName = classNames(
405
+ styles$n.row,
406
+ leading === void 0 && styles$n.withoutLeading,
407
+ onClick && styles$n.clickable,
408
+ className
409
+ );
410
+ const content2 = /* @__PURE__ */ jsxs(Fragment, { children: [
411
+ leading,
412
+ /* @__PURE__ */ jsxs("span", { className: styles$n.text, children: [
413
+ /* @__PURE__ */ jsx(Text, { role: "body", weight: "bold", translate: false, children: title2 }),
414
+ meta2 ? /* @__PURE__ */ jsx(Text, { role: "caption", color: "var(--agents-fg-light)", translate: false, children: meta2 }) : null
415
+ ] }),
416
+ trailing2 ? /* @__PURE__ */ jsx("span", { className: styles$n.trailing, children: trailing2 }) : /* @__PURE__ */ jsx("span", {})
417
+ ] });
418
+ if (onClick) {
419
+ return /* @__PURE__ */ jsx("button", { type: "button", className: rowClassName, onClick, "data-testid": testId2, children: content2 });
420
+ }
421
+ return /* @__PURE__ */ jsx("div", { className: rowClassName, "data-testid": testId2, children: content2 });
422
+ };
423
+ const rows$1 = "agents_rows_ZeurFw";
424
+ const row$3 = "agents_row_2esTMM";
425
+ const rowText = "agents_rowText_TlYKqo";
426
+ const styles$m = {
427
+ rows: rows$1,
428
+ row: row$3,
429
+ rowText
430
+ };
431
+ const WidgetSurfaceSkeleton = (props) => {
432
+ const { title: title2, rowCount = 3, level = "elevated", testId: testId2 } = props;
433
+ return /* @__PURE__ */ jsxs(WidgetSurface, { level, testId: testId2, children: [
434
+ title2 ? /* @__PURE__ */ jsx(Text, { role: "intro", weight: "bold", translate: false, children: title2 }) : null,
435
+ /* @__PURE__ */ jsx("div", { className: styles$m.rows, "aria-busy": "true", children: Array.from({ length: rowCount }, (unused, rowIndex) => /* @__PURE__ */ jsxs("div", { className: styles$m.row, children: [
436
+ /* @__PURE__ */ jsx(SkeletonCircle, { size: 32 }),
437
+ /* @__PURE__ */ jsxs("span", { className: styles$m.rowText, children: [
438
+ /* @__PURE__ */ jsx(SkeletonLine, { width: "60%", height: 12 }),
439
+ /* @__PURE__ */ jsx(SkeletonLine, { width: "35%", height: 10 })
440
+ ] })
441
+ ] }, rowIndex)) })
442
+ ] });
443
+ };
390
444
  const readTextNodeContent = (value) => {
391
445
  if (value === void 0 || value === null) return { kind: "missing" };
392
446
  if (typeof value === "string") return value.trim() === "" ? { kind: "missing" } : { kind: "text", text: value };
@@ -438,7 +492,7 @@ const ConversationWidgetActions = (props) => {
438
492
  };
439
493
  const ConversationWidgetButton = (props) => /* @__PURE__ */ jsx(ConversationWidgetActions, { children: /* @__PURE__ */ jsx(Button, { ...props }) });
440
494
  const pill$2 = "agents_pill_-vfSSk";
441
- const styles$k = {
495
+ const styles$l = {
442
496
  pill: pill$2
443
497
  };
444
498
  const DonePill = (props) => {
@@ -447,7 +501,7 @@ const DonePill = (props) => {
447
501
  useEffect(() => {
448
502
  if (document.activeElement === document.body) ref.current?.focus();
449
503
  }, []);
450
- return /* @__PURE__ */ jsxs("div", { ref, tabIndex: -1, className: styles$k.pill, "data-testid": testId2, children: [
504
+ return /* @__PURE__ */ jsxs("div", { ref, tabIndex: -1, className: styles$l.pill, "data-testid": testId2, children: [
451
505
  status === "success" && /* @__PURE__ */ jsx(Icon, { pixelSize: 14, color: "var(--agents-success-500)", name: "check" }),
452
506
  /* @__PURE__ */ jsx(Text, { role: "help", weight: "medium", color: "var(--agents-fg-light)", translate, children })
453
507
  ] });
@@ -608,7 +662,7 @@ const TIME_ZONE_KEYS = ["timeZone", "timezone", "tz", "tz_name", "tzName", "zone
608
662
  const LABEL_KEYS = ["label", "city", "location", "name", "place"];
609
663
  const ABBREVIATION_KEYS = ["abbreviation", "tz_alias", "tzAlias", "alias"];
610
664
  const TIME_FORMAT_KEYS = ["timeFormat", "time_format", "hourCycle"];
611
- const isRecord$2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
665
+ const isRecord$3 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
612
666
  const readCappedString$1 = (value, maxLength) => {
613
667
  if (typeof value !== "string") return void 0;
614
668
  const trimmedValue = value.trim();
@@ -635,8 +689,8 @@ const readClockEntry = (rawEntry) => {
635
689
  const timeZone2 = readCappedString$1(rawEntry, MAX_TIME_ZONE_LENGTH);
636
690
  return timeZone2 ? { timeZone: timeZone2 } : void 0;
637
691
  }
638
- if (!isRecord$2(rawEntry)) return void 0;
639
- const entryRecord = isRecord$2(rawEntry.parameters) ? { ...rawEntry.parameters, ...rawEntry } : rawEntry;
692
+ if (!isRecord$3(rawEntry)) return void 0;
693
+ const entryRecord = isRecord$3(rawEntry.parameters) ? { ...rawEntry.parameters, ...rawEntry } : rawEntry;
640
694
  const timeZone = readFirstString$2(entryRecord, TIME_ZONE_KEYS, MAX_TIME_ZONE_LENGTH);
641
695
  if (!timeZone) return void 0;
642
696
  const label2 = readFirstString$2(entryRecord, LABEL_KEYS, MAX_LABEL_LENGTH);
@@ -656,7 +710,7 @@ const parseClockPayload = (payload) => {
656
710
  } catch {
657
711
  return { clocks: [] };
658
712
  }
659
- if (!isRecord$2(parsedPayload)) return { clocks: [] };
713
+ if (!isRecord$3(parsedPayload)) return { clocks: [] };
660
714
  const clocks = readClockList(parsedPayload).slice(0, MAX_CLOCKS).map(readClockEntry).filter((clockEntry) => clockEntry !== void 0);
661
715
  const title2 = readCappedString$1(parsedPayload.title, MAX_TITLE_LENGTH$2);
662
716
  const timeFormat = readTimeFormat(parsedPayload);
@@ -723,7 +777,7 @@ const hourHand = "agents_hourHand_NawHe6";
723
777
  const minuteHand = "agents_minuteHand_WbdO1W";
724
778
  const secondHand = "agents_secondHand_TycNnA";
725
779
  const dialHub = "agents_dialHub_JfCse6";
726
- const styles$j = {
780
+ const styles$k = {
727
781
  root: root$2,
728
782
  rows,
729
783
  row: row$2,
@@ -750,12 +804,12 @@ const TICK_INDICES = Array.from({ length: 12 }, (unused, tickIndex) => tickIndex
750
804
  const AnalogClockFace = (props) => {
751
805
  const { wallClock, accessibleLabel } = props;
752
806
  const handAngles = readHandAngles(wallClock);
753
- return /* @__PURE__ */ jsxs("svg", { className: styles$j.dial, viewBox: "0 0 100 100", role: "img", "aria-label": accessibleLabel, children: [
754
- /* @__PURE__ */ jsx("circle", { className: styles$j.dialFace, cx: CENTER, cy: CENTER, r: 48 }),
807
+ return /* @__PURE__ */ jsxs("svg", { className: styles$k.dial, viewBox: "0 0 100 100", role: "img", "aria-label": accessibleLabel, children: [
808
+ /* @__PURE__ */ jsx("circle", { className: styles$k.dialFace, cx: CENTER, cy: CENTER, r: 48 }),
755
809
  TICK_INDICES.map((tickIndex) => /* @__PURE__ */ jsx(
756
810
  "line",
757
811
  {
758
- className: tickIndex % 3 === 0 ? styles$j.dialQuarterTick : styles$j.dialTick,
812
+ className: tickIndex % 3 === 0 ? styles$k.dialQuarterTick : styles$k.dialTick,
759
813
  x1: CENTER,
760
814
  y1: tickIndex % 3 === 0 ? 7 : 9,
761
815
  x2: CENTER,
@@ -767,7 +821,7 @@ const AnalogClockFace = (props) => {
767
821
  /* @__PURE__ */ jsx(
768
822
  "line",
769
823
  {
770
- className: styles$j.hourHand,
824
+ className: styles$k.hourHand,
771
825
  x1: CENTER,
772
826
  y1: CENTER + 6,
773
827
  x2: CENTER,
@@ -778,7 +832,7 @@ const AnalogClockFace = (props) => {
778
832
  /* @__PURE__ */ jsx(
779
833
  "line",
780
834
  {
781
- className: styles$j.minuteHand,
835
+ className: styles$k.minuteHand,
782
836
  x1: CENTER,
783
837
  y1: CENTER + 7,
784
838
  x2: CENTER,
@@ -789,7 +843,7 @@ const AnalogClockFace = (props) => {
789
843
  /* @__PURE__ */ jsx(
790
844
  "line",
791
845
  {
792
- className: styles$j.secondHand,
846
+ className: styles$k.secondHand,
793
847
  "data-testid": "clock-second-hand",
794
848
  x1: CENTER,
795
849
  y1: CENTER + 10,
@@ -798,19 +852,19 @@ const AnalogClockFace = (props) => {
798
852
  transform: `rotate(${handAngles.second} ${CENTER} ${CENTER})`
799
853
  }
800
854
  ),
801
- /* @__PURE__ */ jsx("circle", { className: styles$j.dialHub, cx: CENTER, cy: CENTER, r: 2.5 })
855
+ /* @__PURE__ */ jsx("circle", { className: styles$k.dialHub, cx: CENTER, cy: CENTER, r: 2.5 })
802
856
  ] });
803
857
  };
804
858
  const SUN_RAY_ANGLES = [0, 45, 90, 135, 180, 225, 270, 315];
805
859
  const DayNightGlyph = (props) => {
806
860
  const { isDaytime: isDaytime2 } = props;
807
861
  if (isDaytime2) {
808
- return /* @__PURE__ */ jsxs("svg", { className: styles$j.dayNightGlyph, viewBox: "0 0 16 16", "aria-hidden": "true", "data-testid": "clock-sun", children: [
809
- /* @__PURE__ */ jsx("circle", { className: styles$j.sunDisc, cx: 8, cy: 8, r: 3.2 }),
862
+ return /* @__PURE__ */ jsxs("svg", { className: styles$k.dayNightGlyph, viewBox: "0 0 16 16", "aria-hidden": "true", "data-testid": "clock-sun", children: [
863
+ /* @__PURE__ */ jsx("circle", { className: styles$k.sunDisc, cx: 8, cy: 8, r: 3.2 }),
810
864
  SUN_RAY_ANGLES.map((rayAngle) => /* @__PURE__ */ jsx(
811
865
  "line",
812
866
  {
813
- className: styles$j.sunRay,
867
+ className: styles$k.sunRay,
814
868
  x1: 8,
815
869
  y1: 1.5,
816
870
  x2: 8,
@@ -821,7 +875,7 @@ const DayNightGlyph = (props) => {
821
875
  ))
822
876
  ] });
823
877
  }
824
- return /* @__PURE__ */ jsx("svg", { className: styles$j.dayNightGlyph, viewBox: "0 0 16 16", "aria-hidden": "true", "data-testid": "clock-moon", children: /* @__PURE__ */ jsx("path", { className: styles$j.moon, d: "M10.8 2.2a6 6 0 1 0 3 9.6 5 5 0 0 1-3-9.6z" }) });
878
+ return /* @__PURE__ */ jsx("svg", { className: styles$k.dayNightGlyph, viewBox: "0 0 16 16", "aria-hidden": "true", "data-testid": "clock-moon", children: /* @__PURE__ */ jsx("path", { className: styles$k.moon, d: "M10.8 2.2a6 6 0 1 0 3 9.6 5 5 0 0 1-3-9.6z" }) });
825
879
  };
826
880
  const RELATIVE_DAY_KEYS = {
827
881
  today: textKey("Today, %hourDifference% h"),
@@ -839,9 +893,9 @@ const ClockRow = (props) => {
839
893
  const isDaytimeThere = isDaytime(wallClock);
840
894
  const dateLine = [formatZonedDate(now, clock.timeZone, dateLocale), formatUtcOffset(wallClock.utcOffsetMinutes)].filter((linePart) => linePart !== "").join(" · ");
841
895
  const digitalTime2 = dayPeriod ? `${time} ${dayPeriod}` : time;
842
- return /* @__PURE__ */ jsxs("div", { className: styles$j.row, "data-testid": "clock-row", "data-time-zone": clock.timeZone, children: [
843
- /* @__PURE__ */ jsxs("div", { className: styles$j.readout, children: [
844
- /* @__PURE__ */ jsxs("span", { className: styles$j.digitalTime, "data-testid": "clock-digital-time", children: [
896
+ return /* @__PURE__ */ jsxs("div", { className: styles$k.row, "data-testid": "clock-row", "data-time-zone": clock.timeZone, children: [
897
+ /* @__PURE__ */ jsxs("div", { className: styles$k.readout, children: [
898
+ /* @__PURE__ */ jsxs("span", { className: styles$k.digitalTime, "data-testid": "clock-digital-time", children: [
845
899
  /* @__PURE__ */ jsx(HeroValue, { children: time }),
846
900
  dayPeriod ? /* @__PURE__ */ jsx(Text, { role: "intro", weight: "bold", translate: false, children: dayPeriod }) : null
847
901
  ] }),
@@ -851,7 +905,7 @@ const ClockRow = (props) => {
851
905
  role: "body",
852
906
  weight: "bold",
853
907
  translate: false,
854
- className: styles$j.wrappingText,
908
+ className: styles$k.wrappingText,
855
909
  testId: `${testId2}-place`,
856
910
  children: escapePlainTextForText(placeLine)
857
911
  }
@@ -866,7 +920,7 @@ const ClockRow = (props) => {
866
920
  children: RELATIVE_DAY_KEYS[readRelativeDay(wallClock, ownerWallClock)]
867
921
  }
868
922
  ),
869
- /* @__PURE__ */ jsxs("span", { className: styles$j.metaLine, children: [
923
+ /* @__PURE__ */ jsxs("span", { className: styles$k.metaLine, children: [
870
924
  /* @__PURE__ */ jsx(
871
925
  Text,
872
926
  {
@@ -877,7 +931,7 @@ const ClockRow = (props) => {
877
931
  children: dateLine
878
932
  }
879
933
  ),
880
- /* @__PURE__ */ jsxs("span", { className: styles$j.dayNight, children: [
934
+ /* @__PURE__ */ jsxs("span", { className: styles$k.dayNight, children: [
881
935
  /* @__PURE__ */ jsx(DayNightGlyph, { isDaytime: isDaytimeThere }),
882
936
  /* @__PURE__ */ jsx(Text, { role: "caption", color: "var(--agents-fg-light)", children: isDaytimeThere ? "Day" : "Night" })
883
937
  ] })
@@ -898,19 +952,19 @@ const ClockWidget = (props) => {
898
952
  captureMoment,
899
953
  testId: testId2 = "clock-widget"
900
954
  } = props;
901
- return /* @__PURE__ */ jsxs(WidgetSurface, { className: styles$j.root, testId: testId2, children: [
955
+ return /* @__PURE__ */ jsxs(WidgetSurface, { className: styles$k.root, testId: testId2, children: [
902
956
  title2 ? /* @__PURE__ */ jsx(
903
957
  Text,
904
958
  {
905
959
  role: "intro",
906
960
  weight: "bold",
907
961
  translate: false,
908
- className: styles$j.wrappingText,
962
+ className: styles$k.wrappingText,
909
963
  testId: `${testId2}-title`,
910
964
  children: escapePlainTextForText(title2)
911
965
  }
912
966
  ) : null,
913
- /* @__PURE__ */ jsx("div", { className: styles$j.rows, "data-testid": `${testId2}-rows`, children: clocks.map((clock, clockIndex) => /* @__PURE__ */ jsx(
967
+ /* @__PURE__ */ jsx("div", { className: styles$k.rows, "data-testid": `${testId2}-rows`, children: clocks.map((clock, clockIndex) => /* @__PURE__ */ jsx(
914
968
  ClockRow,
915
969
  {
916
970
  testId: `${testId2}-row-${clock.timeZone}`,
@@ -936,7 +990,7 @@ const ClockWidget = (props) => {
936
990
  ] });
937
991
  };
938
992
  const notice$2 = "agents_notice_2XMkZe";
939
- const styles$i = {
993
+ const styles$j = {
940
994
  notice: notice$2
941
995
  };
942
996
  const resolveClocks = (payloadClocks) => {
@@ -982,7 +1036,7 @@ const ClockConversationWidget = (props) => {
982
1036
  {
983
1037
  role: "help",
984
1038
  color: "var(--agents-fg-light)",
985
- className: styles$i.notice,
1039
+ className: styles$j.notice,
986
1040
  testId: `${testId2}-empty`,
987
1041
  children: "No time zone to show."
988
1042
  }
@@ -994,7 +1048,7 @@ const ClockConversationWidget = (props) => {
994
1048
  {
995
1049
  role: "help",
996
1050
  color: "var(--agents-fg-light)",
997
- className: styles$i.notice,
1051
+ className: styles$j.notice,
998
1052
  testId: `${testId2}-error`,
999
1053
  children: "The time zones of this clock are unknown."
1000
1054
  }
@@ -1136,7 +1190,7 @@ const pillRow = "agents_pillRow_rL6o6f";
1136
1190
  const pill$1 = "agents_pill_AOGKJY";
1137
1191
  const pillSelected = "agents_pillSelected_7e-VPg";
1138
1192
  const footer$2 = "agents_footer_Oxf5Dg";
1139
- const styles$h = {
1193
+ const styles$i = {
1140
1194
  widget: widget$2,
1141
1195
  header: header$3,
1142
1196
  wrappingText: wrappingText$1,
@@ -1172,14 +1226,14 @@ const ConceptExplainerWidget = (props) => {
1172
1226
  const lastStepIndex = steps.length - 1;
1173
1227
  const showsStepButtons = !isStatic && steps.length > 1 && steps.length <= MAX_LABELLED_STEPS;
1174
1228
  const footerLine = valuesReading.carriesBlockNumbers ? definition.computedLine : definition.illustrationLine;
1175
- return /* @__PURE__ */ jsxs(WidgetSurface, { className: styles$h.widget, testId: testId2, children: [
1176
- /* @__PURE__ */ jsxs("header", { className: styles$h.header, children: [
1229
+ return /* @__PURE__ */ jsxs(WidgetSurface, { className: styles$i.widget, testId: testId2, children: [
1230
+ /* @__PURE__ */ jsxs("header", { className: styles$i.header, children: [
1177
1231
  modelTitle ? /* @__PURE__ */ jsx(
1178
1232
  ModelText,
1179
1233
  {
1180
1234
  role: "intro",
1181
1235
  weight: "bold",
1182
- className: styles$h.wrappingText,
1236
+ className: styles$i.wrappingText,
1183
1237
  testId: `${testId2}-title`,
1184
1238
  children: modelTitle
1185
1239
  }
@@ -1189,7 +1243,7 @@ const ConceptExplainerWidget = (props) => {
1189
1243
  text: definition.defaultTitle,
1190
1244
  role: "intro",
1191
1245
  weight: "bold",
1192
- className: styles$h.wrappingText,
1246
+ className: styles$i.wrappingText,
1193
1247
  testId: `${testId2}-title`
1194
1248
  }
1195
1249
  ),
@@ -1199,11 +1253,11 @@ const ConceptExplainerWidget = (props) => {
1199
1253
  text: definition.subtitle,
1200
1254
  role: "help",
1201
1255
  color: "var(--agents-fg-light)",
1202
- className: styles$h.wrappingText
1256
+ className: styles$i.wrappingText
1203
1257
  }
1204
1258
  )
1205
1259
  ] }),
1206
- /* @__PURE__ */ jsx("div", { className: styles$h.scene, "data-testid": "concept-explainer-scene", children: /* @__PURE__ */ jsx(
1260
+ /* @__PURE__ */ jsx("div", { className: styles$i.scene, "data-testid": "concept-explainer-scene", children: /* @__PURE__ */ jsx(
1207
1261
  Visual,
1208
1262
  {
1209
1263
  values: valuesReading.values,
@@ -1214,14 +1268,14 @@ const ConceptExplainerWidget = (props) => {
1214
1268
  languageCode
1215
1269
  }
1216
1270
  ) }),
1217
- currentStep ? /* @__PURE__ */ jsxs("div", { className: styles$h.caption, "aria-live": "polite", "data-testid": "concept-explainer-caption", children: [
1271
+ currentStep ? /* @__PURE__ */ jsxs("div", { className: styles$i.caption, "aria-live": "polite", "data-testid": "concept-explainer-caption", children: [
1218
1272
  /* @__PURE__ */ jsx(
1219
1273
  ConceptExplainerTextView,
1220
1274
  {
1221
1275
  text: currentStep.caption,
1222
1276
  role: "body",
1223
1277
  weight: "bold",
1224
- className: styles$h.wrappingText
1278
+ className: styles$i.wrappingText
1225
1279
  }
1226
1280
  ),
1227
1281
  /* @__PURE__ */ jsx(
@@ -1230,11 +1284,11 @@ const ConceptExplainerWidget = (props) => {
1230
1284
  text: currentStep.description,
1231
1285
  role: "help",
1232
1286
  color: "var(--agents-fg-light)",
1233
- className: styles$h.wrappingText
1287
+ className: styles$i.wrappingText
1234
1288
  }
1235
1289
  )
1236
1290
  ] }) : null,
1237
- !isStatic && variants.length > 1 && definition.variantLabel ? /* @__PURE__ */ jsxs("div", { className: styles$h.controlBlock, children: [
1291
+ !isStatic && variants.length > 1 && definition.variantLabel ? /* @__PURE__ */ jsxs("div", { className: styles$i.controlBlock, children: [
1238
1292
  /* @__PURE__ */ jsx(
1239
1293
  ConceptExplainerTextView,
1240
1294
  {
@@ -1243,21 +1297,21 @@ const ConceptExplainerWidget = (props) => {
1243
1297
  color: "var(--agents-fg-light)"
1244
1298
  }
1245
1299
  ),
1246
- /* @__PURE__ */ jsx("div", { className: styles$h.pillRow, role: "group", children: variants.map((variant) => /* @__PURE__ */ jsx(
1300
+ /* @__PURE__ */ jsx("div", { className: styles$i.pillRow, role: "group", children: variants.map((variant) => /* @__PURE__ */ jsx(
1247
1301
  "button",
1248
1302
  {
1249
1303
  type: "button",
1250
1304
  "data-testid": `concept-explainer-variant-${variant.id}`,
1251
1305
  "aria-pressed": variant.id === variantId,
1252
- className: classNames(styles$h.pill, variant.id === variantId && styles$h.pillSelected),
1306
+ className: classNames(styles$i.pill, variant.id === variantId && styles$i.pillSelected),
1253
1307
  onClick: () => onVariantIdChange(variant.id),
1254
1308
  children: /* @__PURE__ */ jsx(ConceptExplainerTextView, { text: variant.label, role: "help" })
1255
1309
  },
1256
1310
  variant.id
1257
1311
  )) })
1258
1312
  ] }) : null,
1259
- !isStatic && steps.length > 1 && currentStep ? /* @__PURE__ */ jsxs("div", { className: styles$h.controlBlock, children: [
1260
- /* @__PURE__ */ jsxs("div", { className: styles$h.sliderRow, children: [
1313
+ !isStatic && steps.length > 1 && currentStep ? /* @__PURE__ */ jsxs("div", { className: styles$i.controlBlock, children: [
1314
+ /* @__PURE__ */ jsxs("div", { className: styles$i.sliderRow, children: [
1261
1315
  /* @__PURE__ */ jsx(ConceptExplainerTextView, { text: definition.controlLabel, role: "help" }),
1262
1316
  /* @__PURE__ */ jsx(
1263
1317
  ConceptExplainerTextView,
@@ -1265,12 +1319,12 @@ const ConceptExplainerWidget = (props) => {
1265
1319
  text: currentStep.label,
1266
1320
  role: "help",
1267
1321
  weight: "medium",
1268
- className: styles$h.sliderValue,
1322
+ className: styles$i.sliderValue,
1269
1323
  testId: `${testId2}-current-step`
1270
1324
  }
1271
1325
  )
1272
1326
  ] }),
1273
- /* @__PURE__ */ jsx("div", { className: styles$h.sliderTrack, "data-testid": "concept-explainer-slider", children: /* @__PURE__ */ jsx(
1327
+ /* @__PURE__ */ jsx("div", { className: styles$i.sliderTrack, "data-testid": "concept-explainer-slider", children: /* @__PURE__ */ jsx(
1274
1328
  RangeSlider,
1275
1329
  {
1276
1330
  value: stepIndex,
@@ -1282,27 +1336,27 @@ const ConceptExplainerWidget = (props) => {
1282
1336
  }
1283
1337
  }
1284
1338
  ) }),
1285
- showsStepButtons ? /* @__PURE__ */ jsx("div", { className: styles$h.pillRow, role: "group", children: steps.map((step, index) => /* @__PURE__ */ jsx(
1339
+ showsStepButtons ? /* @__PURE__ */ jsx("div", { className: styles$i.pillRow, role: "group", children: steps.map((step, index) => /* @__PURE__ */ jsx(
1286
1340
  "button",
1287
1341
  {
1288
1342
  type: "button",
1289
1343
  "data-testid": `concept-explainer-step-${step.id}`,
1290
1344
  "aria-pressed": index === stepIndex,
1291
- className: classNames(styles$h.pill, index === stepIndex && styles$h.pillSelected),
1345
+ className: classNames(styles$i.pill, index === stepIndex && styles$i.pillSelected),
1292
1346
  onClick: () => onStepIndexChange(index),
1293
1347
  children: /* @__PURE__ */ jsx(ConceptExplainerTextView, { text: step.label, role: "help" })
1294
1348
  },
1295
1349
  step.id
1296
1350
  )) }) : null
1297
1351
  ] }) : null,
1298
- /* @__PURE__ */ jsxs("footer", { className: styles$h.footer, children: [
1352
+ /* @__PURE__ */ jsxs("footer", { className: styles$i.footer, children: [
1299
1353
  definition.sourceLine ? /* @__PURE__ */ jsx(
1300
1354
  ConceptExplainerTextView,
1301
1355
  {
1302
1356
  text: definition.sourceLine,
1303
1357
  role: "caption",
1304
1358
  color: "var(--agents-fg-lightest)",
1305
- className: styles$h.wrappingText
1359
+ className: styles$i.wrappingText
1306
1360
  }
1307
1361
  ) : null,
1308
1362
  footerLine ? /* @__PURE__ */ jsx(
@@ -1311,7 +1365,7 @@ const ConceptExplainerWidget = (props) => {
1311
1365
  text: footerLine,
1312
1366
  role: "caption",
1313
1367
  color: "var(--agents-fg-lightest)",
1314
- className: styles$h.wrappingText,
1368
+ className: styles$i.wrappingText,
1315
1369
  testId: "concept-explainer-data-line"
1316
1370
  }
1317
1371
  ) : null
@@ -1319,7 +1373,7 @@ const ConceptExplainerWidget = (props) => {
1319
1373
  ] });
1320
1374
  };
1321
1375
  const notice$1 = "agents_notice_Q0qNKx";
1322
- const styles$g = {
1376
+ const styles$h = {
1323
1377
  notice: notice$1
1324
1378
  };
1325
1379
  const MAX_QUOTED_TYPE_ID_LENGTH = 40;
@@ -1393,7 +1447,7 @@ const ConceptExplainerConversationWidget = (props) => {
1393
1447
  {
1394
1448
  role: "help",
1395
1449
  color: "var(--agents-fg-light)",
1396
- className: styles$g.notice,
1450
+ className: styles$h.notice,
1397
1451
  testId: `${testId2}-empty`,
1398
1452
  children: "No explanation to show."
1399
1453
  }
@@ -1405,7 +1459,7 @@ const ConceptExplainerConversationWidget = (props) => {
1405
1459
  {
1406
1460
  role: "help",
1407
1461
  color: "var(--agents-fg-light)",
1408
- className: styles$g.notice,
1462
+ className: styles$h.notice,
1409
1463
  testId: `${testId2}-error`,
1410
1464
  children: "This explanation is not available."
1411
1465
  }
@@ -1570,16 +1624,16 @@ const parseTypedAmount = (typedText, locale = "en") => {
1570
1624
  const currency = "agents_currency_CR9unA";
1571
1625
  const flag = "agents_flag_6dGtG2";
1572
1626
  const text$1 = "agents_text_Cec7cq";
1573
- const styles$f = {
1627
+ const styles$g = {
1574
1628
  currency,
1575
1629
  flag,
1576
1630
  text: text$1
1577
1631
  };
1578
1632
  const CurrencyLabel = (props) => {
1579
1633
  const { currencyCode, locale, nameId, testId: testId2 } = props;
1580
- return /* @__PURE__ */ jsxs("div", { className: styles$f.currency, "data-testid": testId2, children: [
1581
- /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: styles$f.flag, children: readCurrencyFlag(currencyCode) }),
1582
- /* @__PURE__ */ jsxs("div", { className: styles$f.text, children: [
1634
+ return /* @__PURE__ */ jsxs("div", { className: styles$g.currency, "data-testid": testId2, children: [
1635
+ /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: styles$g.flag, children: readCurrencyFlag(currencyCode) }),
1636
+ /* @__PURE__ */ jsxs("div", { className: styles$g.text, children: [
1583
1637
  /* @__PURE__ */ jsx(Text, { role: "help", weight: "bold", translate: false, children: currencyCode }),
1584
1638
  /* @__PURE__ */ jsx("span", { id: nameId, children: /* @__PURE__ */ jsx(Text, { role: "caption", color: "var(--agents-fg-light)", ellipsis: true, translate: false, children: readCurrencyName(currencyCode, locale) }) })
1585
1639
  ] })
@@ -1598,7 +1652,7 @@ const heroRow = "agents_heroRow_XRyMo-";
1598
1652
  const divider = "agents_divider_tSMuNB";
1599
1653
  const swap = "agents_swap_mI6Ugc";
1600
1654
  const footer$1 = "agents_footer_2UNCNT";
1601
- const styles$e = {
1655
+ const styles$f = {
1602
1656
  widget: widget$1,
1603
1657
  title,
1604
1658
  row: row$1,
@@ -1629,10 +1683,10 @@ const CurrencyConverterWidget = (props) => {
1629
1683
  const toSymbol = readCurrencySymbol(toCurrency, locale);
1630
1684
  const rateDateText = conversion.rateDate ? formatRateDate(conversion.rateDate, locale) : void 0;
1631
1685
  const fieldWidth = { width: `${Math.max(typedAmount.length, 1) + 0.5}ch` };
1632
- return /* @__PURE__ */ jsxs("section", { className: styles$e.widget, "data-testid": testId2, children: [
1633
- /* @__PURE__ */ jsx("div", { className: styles$e.title, children: /* @__PURE__ */ jsx(Text, { role: "intro", weight: "bold", testId: `${testId2}-title`, children: "Currency converter" }) }),
1686
+ return /* @__PURE__ */ jsxs("section", { className: styles$f.widget, "data-testid": testId2, children: [
1687
+ /* @__PURE__ */ jsx("div", { className: styles$f.title, children: /* @__PURE__ */ jsx(Text, { role: "intro", weight: "bold", testId: `${testId2}-title`, children: "Currency converter" }) }),
1634
1688
  /* @__PURE__ */ jsxs(WidgetSurface, { children: [
1635
- /* @__PURE__ */ jsxs("div", { className: styles$e.row, children: [
1689
+ /* @__PURE__ */ jsxs("div", { className: styles$f.row, children: [
1636
1690
  /* @__PURE__ */ jsx(
1637
1691
  CurrencyLabel,
1638
1692
  {
@@ -1642,19 +1696,19 @@ const CurrencyConverterWidget = (props) => {
1642
1696
  testId: `${testId2}-from-currency`
1643
1697
  }
1644
1698
  ),
1645
- isStatic ? /* @__PURE__ */ jsxs("div", { className: styles$e.amount, children: [
1699
+ isStatic ? /* @__PURE__ */ jsxs("div", { className: styles$f.amount, children: [
1646
1700
  /* @__PURE__ */ jsx(Text, { role: "title", translate: false, testId: `${testId2}-amount-static`, children: amount2 === void 0 ? "–" : formatCurrencyAmount(amount2, fromCurrency, locale) }),
1647
1701
  /* @__PURE__ */ jsx(Text, { role: "intro", color: "var(--agents-fg-light)", translate: false, children: fromSymbol })
1648
1702
  ] }) : /* @__PURE__ */ jsxs(
1649
1703
  "div",
1650
1704
  {
1651
- className: classNames(styles$e.amount, styles$e.field, isInvalid && styles$e.fieldInvalid),
1705
+ className: classNames(styles$f.amount, styles$f.field, isInvalid && styles$f.fieldInvalid),
1652
1706
  "data-testid": "currency-converter-amount",
1653
1707
  children: [
1654
1708
  /* @__PURE__ */ jsx(
1655
1709
  "input",
1656
1710
  {
1657
- className: styles$e.input,
1711
+ className: styles$f.input,
1658
1712
  "data-testid": `${testId2}-input-amount`,
1659
1713
  type: "text",
1660
1714
  inputMode: "decimal",
@@ -1672,25 +1726,25 @@ const CurrencyConverterWidget = (props) => {
1672
1726
  }
1673
1727
  )
1674
1728
  ] }),
1675
- /* @__PURE__ */ jsx("div", { className: styles$e.divider, children: isStatic ? null : /* @__PURE__ */ jsx(
1729
+ /* @__PURE__ */ jsx("div", { className: styles$f.divider, children: isStatic ? null : /* @__PURE__ */ jsx(
1676
1730
  "button",
1677
1731
  {
1678
1732
  type: "button",
1679
- className: styles$e.swap,
1733
+ className: styles$f.swap,
1680
1734
  "aria-label": translateText("Swap currencies"),
1681
1735
  "data-testid": "currency-converter-swap",
1682
1736
  onClick: () => setIsSwapped((wasSwapped) => !wasSwapped),
1683
1737
  children: /* @__PURE__ */ jsx(Icon, { name: "sorting" })
1684
1738
  }
1685
1739
  ) }),
1686
- /* @__PURE__ */ jsxs("div", { className: styles$e.row, children: [
1740
+ /* @__PURE__ */ jsxs("div", { className: styles$f.row, children: [
1687
1741
  /* @__PURE__ */ jsx(CurrencyLabel, { currencyCode: toCurrency, locale, testId: `${testId2}-to-currency` }),
1688
- /* @__PURE__ */ jsxs("div", { className: classNames(styles$e.amount, styles$e.result), "data-testid": "currency-converter-result", children: [
1689
- /* @__PURE__ */ jsx("span", { className: styles$e.heroSlot, children: /* @__PURE__ */ jsx("span", { className: styles$e.heroRow, "data-hero-row": "", children: /* @__PURE__ */ jsx(HeroValue, { children: convertedAmount === void 0 ? "–" : formatCurrencyAmount(convertedAmount, toCurrency, locale) }) }) }),
1742
+ /* @__PURE__ */ jsxs("div", { className: classNames(styles$f.amount, styles$f.result), "data-testid": "currency-converter-result", children: [
1743
+ /* @__PURE__ */ jsx("span", { className: styles$f.heroSlot, children: /* @__PURE__ */ jsx("span", { className: styles$f.heroRow, "data-hero-row": "", children: /* @__PURE__ */ jsx(HeroValue, { children: convertedAmount === void 0 ? "–" : formatCurrencyAmount(convertedAmount, toCurrency, locale) }) }) }),
1690
1744
  /* @__PURE__ */ jsx(Text, { role: "intro", color: "var(--agents-fg-light)", translate: false, children: toSymbol })
1691
1745
  ] })
1692
1746
  ] }),
1693
- /* @__PURE__ */ jsxs("div", { className: styles$e.footer, children: [
1747
+ /* @__PURE__ */ jsxs("div", { className: styles$f.footer, children: [
1694
1748
  /* @__PURE__ */ jsx(
1695
1749
  Text,
1696
1750
  {
@@ -1963,7 +2017,7 @@ const frameArea = "agents_frameArea_oTAxfc";
1963
2017
  const frameBox = "agents_frameBox_SO1EpU";
1964
2018
  const frame$1 = "agents_frame_uN2yj-";
1965
2019
  const loadingCover = "agents_loadingCover_G8fy2S";
1966
- const styles$d = {
2020
+ const styles$e = {
1967
2021
  frameArea,
1968
2022
  frameBox,
1969
2023
  frame: frame$1,
@@ -1983,7 +2037,7 @@ const CustomVisualizationFrame = (props) => {
1983
2037
  const [librarySources, setLibrarySources] = useState(payload.libraries.length === 0 ? [] : null);
1984
2038
  const [isFrameLoaded, setIsFrameLoaded] = useState(false);
1985
2039
  const [phase, setPhase] = useState("loading");
1986
- const [failure, setFailure] = useState(null);
2040
+ const [failure2, setFailure] = useState(null);
1987
2041
  const [frameHeight, setFrameHeight] = useState(payload.initialHeight);
1988
2042
  const renderMessageSentRef = useRef(false);
1989
2043
  const mountedAtRef = useRef(Date.now());
@@ -2055,7 +2109,7 @@ const CustomVisualizationFrame = (props) => {
2055
2109
  return () => window.removeEventListener("message", receiveFrameMessage);
2056
2110
  }, [instanceToken]);
2057
2111
  useEffect(() => {
2058
- if (failure?.frameRemoved) return void 0;
2112
+ if (failure2?.frameRemoved) return void 0;
2059
2113
  const restartDeadlinesWhenShown = () => {
2060
2114
  if (document.visibilityState !== "visible") return;
2061
2115
  const now = Date.now();
@@ -2080,19 +2134,19 @@ const CustomVisualizationFrame = (props) => {
2080
2134
  window.clearInterval(watchdogInterval);
2081
2135
  document.removeEventListener("visibilitychange", restartDeadlinesWhenShown);
2082
2136
  };
2083
- }, [phase, failure?.frameRemoved]);
2137
+ }, [phase, failure2?.frameRemoved]);
2084
2138
  const renderReport = FRAME_RENDER_REPORTS[phase];
2085
- useReportWidgetRenderStatus(renderReport.status, renderReport.code, failure?.detail);
2086
- if (failure?.frameRemoved) {
2139
+ useReportWidgetRenderStatus(renderReport.status, renderReport.code, failure2?.detail);
2140
+ if (failure2?.frameRemoved) {
2087
2141
  return /* @__PURE__ */ jsx(Text, { role: "help", color: "var(--agents-fg-light)", testId: `${testId2}-closed`, children: "The visualization stopped working and was closed." });
2088
2142
  }
2089
- return /* @__PURE__ */ jsxs("div", { ref: themeScopeRef, className: styles$d.frameArea, children: [
2090
- /* @__PURE__ */ jsxs("div", { className: styles$d.frameBox, "data-frame-phase": phase, "data-testid": `${testId2}-frame-box`, children: [
2143
+ return /* @__PURE__ */ jsxs("div", { ref: themeScopeRef, className: styles$e.frameArea, children: [
2144
+ /* @__PURE__ */ jsxs("div", { className: styles$e.frameBox, "data-frame-phase": phase, "data-testid": `${testId2}-frame-box`, children: [
2091
2145
  /* @__PURE__ */ jsx(
2092
2146
  "iframe",
2093
2147
  {
2094
2148
  ref: iframeRef,
2095
- className: styles$d.frame,
2149
+ className: styles$e.frame,
2096
2150
  "data-testid": `${testId2}-frame`,
2097
2151
  style: { height: frameHeight },
2098
2152
  src: frameUrl,
@@ -2103,7 +2157,7 @@ const CustomVisualizationFrame = (props) => {
2103
2157
  onLoad: () => setIsFrameLoaded(true)
2104
2158
  }
2105
2159
  ),
2106
- phase === "loading" ? /* @__PURE__ */ jsx("span", { className: styles$d.loadingCover, "aria-busy": "true", "data-testid": `${testId2}-skeleton`, children: /* @__PURE__ */ jsx(SkeletonLine, { height: frameHeight, radius: 12 }) }) : null
2160
+ phase === "loading" ? /* @__PURE__ */ jsx("span", { className: styles$e.loadingCover, "aria-busy": "true", "data-testid": `${testId2}-skeleton`, children: /* @__PURE__ */ jsx(SkeletonLine, { height: frameHeight, radius: 12 }) }) : null
2107
2161
  ] }),
2108
2162
  phase === "failed" ? /* @__PURE__ */ jsx(Text, { role: "caption", color: "var(--agents-fg-light)", testId: `${testId2}-error`, children: "Part of this visualization could not run." }) : null
2109
2163
  ] });
@@ -2113,7 +2167,7 @@ const content = "agents_content_lKDfwn";
2113
2167
  const header$2 = "agents_header_G4HmWs";
2114
2168
  const staticPreviewTile = "agents_staticPreviewTile_p0CkBm";
2115
2169
  const staticPreviewIcon = "agents_staticPreviewIcon_YIgGKQ";
2116
- const styles$c = {
2170
+ const styles$d = {
2117
2171
  widget,
2118
2172
  content,
2119
2173
  header: header$2,
@@ -2123,14 +2177,14 @@ const styles$c = {
2123
2177
  const CustomVisualizationHeader = (props) => {
2124
2178
  const { title: title2, description, testId: testId2 } = props;
2125
2179
  if (title2 === "" && description === "") return null;
2126
- return /* @__PURE__ */ jsxs("div", { className: styles$c.header, children: [
2180
+ return /* @__PURE__ */ jsxs("div", { className: styles$d.header, children: [
2127
2181
  title2 !== "" ? /* @__PURE__ */ jsx(ModelText, { role: "intro", weight: "bold", testId: `${testId2}-title`, children: title2 }) : null,
2128
2182
  description !== "" ? /* @__PURE__ */ jsx(ModelText, { role: "caption", color: "var(--agents-fg-light)", testId: `${testId2}-description`, children: description }) : null
2129
2183
  ] });
2130
2184
  };
2131
2185
  const CustomVisualizationSurface = (props) => {
2132
2186
  const { children, testId: testId2 } = props;
2133
- return /* @__PURE__ */ jsx(WidgetSurface, { className: styles$c.widget, testId: testId2, children: /* @__PURE__ */ jsx("div", { className: styles$c.content, children }) });
2187
+ return /* @__PURE__ */ jsx(WidgetSurface, { className: styles$d.widget, testId: testId2, children: /* @__PURE__ */ jsx("div", { className: styles$d.content, children }) });
2134
2188
  };
2135
2189
  const CustomVisualizationWidget = (props) => {
2136
2190
  const { payload, testId: testId2 = "custom-visualization-widget" } = props;
@@ -2143,8 +2197,8 @@ const CustomVisualizationStaticPreview = (props) => {
2143
2197
  const { title: title2, description, testId: testId2 = "custom-visualization-widget" } = props;
2144
2198
  return /* @__PURE__ */ jsxs(CustomVisualizationSurface, { testId: testId2, children: [
2145
2199
  /* @__PURE__ */ jsx(CustomVisualizationHeader, { title: title2, description, testId: testId2 }),
2146
- /* @__PURE__ */ jsxs("div", { className: styles$c.staticPreviewTile, "data-testid": `${testId2}-static-preview`, children: [
2147
- /* @__PURE__ */ jsx(Icon, { className: styles$c.staticPreviewIcon, name: "barChart" }),
2200
+ /* @__PURE__ */ jsxs("div", { className: styles$d.staticPreviewTile, "data-testid": `${testId2}-static-preview`, children: [
2201
+ /* @__PURE__ */ jsx(Icon, { className: styles$d.staticPreviewIcon, name: "barChart" }),
2148
2202
  /* @__PURE__ */ jsx(Text, { role: "help", color: "var(--agents-fg-light)", children: "Interactive visualization — open the conversation to use it." })
2149
2203
  ] })
2150
2204
  ] });
@@ -2183,6 +2237,438 @@ const CustomVisualizationConversationWidget = (props) => {
2183
2237
  }
2184
2238
  return /* @__PURE__ */ jsx(CustomVisualizationWidget, { payload: parsedPayload.payload, testId: testId2 }, payload);
2185
2239
  };
2240
+ const DRIVE_FILES_WIDGET_TYPE = "DriveFiles";
2241
+ const DRIVE_FILES_MAX_FILES = 20;
2242
+ const DRIVE_FILES_TITLE_MAX_LENGTH = 160;
2243
+ const isRecord$2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
2244
+ const toSelfHydrationKey = (value) => {
2245
+ const key = typeof value === "string" && value.trim() !== "" ? Number(value) : value;
2246
+ return typeof key === "number" && Number.isInteger(key) && key > 0 ? key : null;
2247
+ };
2248
+ const readPayloadObject = (payload) => {
2249
+ if (typeof payload !== "string" || payload.trim() === "") return null;
2250
+ try {
2251
+ const parsed = JSON.parse(payload);
2252
+ return isRecord$2(parsed) ? parsed : null;
2253
+ } catch {
2254
+ return null;
2255
+ }
2256
+ };
2257
+ const readReferences = (value) => {
2258
+ if (!Array.isArray(value)) return [];
2259
+ const references2 = [];
2260
+ for (const candidate of value) {
2261
+ if (typeof candidate !== "string") continue;
2262
+ const reference = candidate.trim();
2263
+ if (reference === "" || references2.includes(reference)) continue;
2264
+ references2.push(reference);
2265
+ if (references2.length === DRIVE_FILES_MAX_FILES) break;
2266
+ }
2267
+ return references2;
2268
+ };
2269
+ const parseDriveFilesPayload = (payload, selfHydrationKeyFieldName, selfHydrationKeyAttribute) => {
2270
+ const fields = readPayloadObject(payload);
2271
+ if (fields === null) return null;
2272
+ const store = typeof fields.store === "string" ? fields.store.trim() : "";
2273
+ const references2 = readReferences(fields.references);
2274
+ if (store === "" || references2.length === 0) return null;
2275
+ const title2 = typeof fields.title === "string" ? fields.title.trim().slice(0, DRIVE_FILES_TITLE_MAX_LENGTH) : "";
2276
+ return {
2277
+ store,
2278
+ references: references2,
2279
+ title: title2 === "" ? null : title2,
2280
+ widgetSelfHydrationKey: toSelfHydrationKey(selfHydrationKeyAttribute ?? fields[selfHydrationKeyFieldName])
2281
+ };
2282
+ };
2283
+ const buildDriveFilesHydrationKey = (type, request) => `${type}:${request.store}:${request.widgetSelfHydrationKey ?? ""}:${request.references.join(",")}`;
2284
+ const nodeIdOfReference = (reference) => {
2285
+ const match = /^[\w-]+\/([\w-]+)$/.exec(reference.trim());
2286
+ return match?.[1] ?? null;
2287
+ };
2288
+ const safeDriveFileOpenLink = (link, origin) => {
2289
+ const trimmed = (link ?? "").trim();
2290
+ if (trimmed === "") return null;
2291
+ if (trimmed.startsWith("/")) return trimmed.startsWith("//") || trimmed.includes("\\") ? null : trimmed;
2292
+ if (origin === null) return null;
2293
+ try {
2294
+ const url = new URL(trimmed);
2295
+ return (url.protocol === "https:" || url.protocol === "http:") && url.origin === origin ? trimmed : null;
2296
+ } catch {
2297
+ return null;
2298
+ }
2299
+ };
2300
+ const parseDriveDateTimeMs = (value) => {
2301
+ const trimmed = (value ?? "").trim();
2302
+ if (trimmed === "") return null;
2303
+ const match = /^(\d{4})-(\d{2})-(\d{2})[ T](\d{2}):(\d{2})(?::(\d{2}))?$/.exec(trimmed);
2304
+ if (match) {
2305
+ const [, year, month, day, hour, minute, second] = match;
2306
+ return Date.UTC(Number(year), Number(month) - 1, Number(day), Number(hour), Number(minute), Number(second ?? 0));
2307
+ }
2308
+ const parsed = Date.parse(trimmed);
2309
+ return Number.isNaN(parsed) ? null : parsed;
2310
+ };
2311
+ const URL_EXPIRY_MARGIN_MS = 3e4;
2312
+ const isDriveFileCardExpired = (card2, nowMs) => {
2313
+ const expiresAtMs = parseDriveDateTimeMs(card2.urlsExpireAt);
2314
+ return expiresAtMs === null || expiresAtMs - URL_EXPIRY_MARGIN_MS <= nowMs;
2315
+ };
2316
+ const extensionOfName = (name2) => {
2317
+ const dot = name2.lastIndexOf(".");
2318
+ return dot > 0 && dot < name2.length - 1 ? name2.slice(dot + 1).toLowerCase() : "";
2319
+ };
2320
+ const FAMILY_BY_EXTENSION = {
2321
+ pdf: "PDF",
2322
+ xls: "SPREADSHEET",
2323
+ xlsx: "SPREADSHEET",
2324
+ ods: "SPREADSHEET",
2325
+ csv: "SPREADSHEET",
2326
+ doc: "DOCUMENT",
2327
+ docx: "DOCUMENT",
2328
+ odt: "DOCUMENT",
2329
+ rtf: "DOCUMENT",
2330
+ ppt: "PRESENTATION",
2331
+ pptx: "PRESENTATION",
2332
+ odp: "PRESENTATION",
2333
+ key: "PRESENTATION",
2334
+ svg: "VECTOR",
2335
+ ai: "VECTOR",
2336
+ eps: "VECTOR",
2337
+ zip: "ARCHIVE",
2338
+ gz: "ARCHIVE",
2339
+ tar: "ARCHIVE",
2340
+ "7z": "ARCHIVE",
2341
+ rar: "ARCHIVE"
2342
+ };
2343
+ const driveFileFamilyOf = (file) => {
2344
+ const contentType = (file.contentType ?? "").toLowerCase();
2345
+ if (contentType === "image/svg+xml") return "VECTOR";
2346
+ if (contentType.startsWith("image/")) return "IMAGE";
2347
+ if (contentType.startsWith("video/")) return "VIDEO";
2348
+ if (contentType === "application/pdf") return "PDF";
2349
+ const byExtension = FAMILY_BY_EXTENSION[extensionOfName(file.name ?? "")];
2350
+ if (byExtension) return byExtension;
2351
+ if (contentType.includes("spreadsheet") || contentType.includes("excel")) return "SPREADSHEET";
2352
+ if (contentType.includes("presentation") || contentType.includes("powerpoint")) return "PRESENTATION";
2353
+ if (contentType.includes("wordprocessing") || contentType.includes("msword")) return "DOCUMENT";
2354
+ if (contentType.includes("zip") || contentType.includes("compressed")) return "ARCHIVE";
2355
+ return "TEXT";
2356
+ };
2357
+ const driveFileTypeLabelOf = (file) => {
2358
+ const extension = extensionOfName(file.name ?? "");
2359
+ return extension === "" ? null : extension.toUpperCase();
2360
+ };
2361
+ const BROWSER_VIEWABLE_FAMILIES = ["PDF", "IMAGE", "VECTOR", "VIDEO", "TEXT"];
2362
+ const stemOfCard = (file) => {
2363
+ const path = file.path ?? file.name ?? "";
2364
+ const extension = extensionOfName(path);
2365
+ return extension === "" ? path : path.slice(0, -(extension.length + 1));
2366
+ };
2367
+ const driveFileCardToOpen = (card2, cards) => {
2368
+ if (card2.isFolder) return null;
2369
+ if (BROWSER_VIEWABLE_FAMILIES.includes(driveFileFamilyOf(card2))) return card2;
2370
+ const stem = stemOfCard(card2);
2371
+ return cards.find(
2372
+ (other) => other !== card2 && !other.isFolder && driveFileFamilyOf(other) === "PDF" && stemOfCard(other) === stem
2373
+ ) ?? null;
2374
+ };
2375
+ const formatDriveFileSize = (sizeBytes, locale) => {
2376
+ const units = ["B", "KB", "MB", "GB", "TB"];
2377
+ let value = sizeBytes;
2378
+ let unitIndex = 0;
2379
+ while (value >= 1024 && unitIndex < units.length - 1) {
2380
+ value /= 1024;
2381
+ unitIndex++;
2382
+ }
2383
+ const formatted = new Intl.NumberFormat(locale ?? void 0, {
2384
+ maximumFractionDigits: unitIndex === 0 ? 0 : 1
2385
+ }).format(value);
2386
+ return `${formatted} ${units[unitIndex]}`;
2387
+ };
2388
+ const DRIVE_FILE_CARDS_SOURCE_MISSING = "DRIVE_FILE_CARDS_SOURCE_MISSING";
2389
+ let registeredSource = null;
2390
+ const registerDriveFileCardsSource = (source) => {
2391
+ registeredSource = source;
2392
+ };
2393
+ const readDriveFileCardsSource = () => registeredSource;
2394
+ const unregisterDriveFileCardsSource = () => {
2395
+ registeredSource = null;
2396
+ };
2397
+ const registerDriveFilesHydrator = () => {
2398
+ registerWidgetHydrator(DRIVE_FILES_WIDGET_TYPE, {
2399
+ hydrator: (request, { signal }) => {
2400
+ const source = readDriveFileCardsSource();
2401
+ if (source === null) return Promise.reject(new Error(DRIVE_FILE_CARDS_SOURCE_MISSING));
2402
+ return source.readFileCards(request, signal);
2403
+ },
2404
+ deriveKey: buildDriveFilesHydrationKey,
2405
+ isPayloadEqual: (previous, next) => previous !== void 0 && buildDriveFilesHydrationKey(DRIVE_FILES_WIDGET_TYPE, previous) === buildDriveFilesHydrationKey(DRIVE_FILES_WIDGET_TYPE, next)
2406
+ });
2407
+ };
2408
+ const stack = "agents_stack_-DCHyS";
2409
+ const list = "agents_list_vjc4ux";
2410
+ const tile = "agents_tile_LbYH0z";
2411
+ const tileThumbnail = "agents_tileThumbnail_t8qagr";
2412
+ const tileFolder = "agents_tileFolder_9GSzCJ";
2413
+ const tilePdf = "agents_tilePdf_MvAe2u";
2414
+ const tileSpreadsheet = "agents_tileSpreadsheet_00vxMM";
2415
+ const tileDocument = "agents_tileDocument_pLmQaO";
2416
+ const tilePresentation = "agents_tilePresentation_pvdoEg";
2417
+ const tileImage = "agents_tileImage_PSEQ19";
2418
+ const tileVideo = "agents_tileVideo_8BQdNt";
2419
+ const tileText = "agents_tileText_xjPSe2";
2420
+ const tileArchive = "agents_tileArchive_zPZ4gE";
2421
+ const meta$1 = "agents_meta_-i6woG";
2422
+ const facts = "agents_facts_6Ki6Tj";
2423
+ const failure = "agents_failure_sEhw7-";
2424
+ const actions$1 = "agents_actions_8Fqa9-";
2425
+ const styles$c = {
2426
+ stack,
2427
+ list,
2428
+ tile,
2429
+ tileThumbnail,
2430
+ tileFolder,
2431
+ tilePdf,
2432
+ tileSpreadsheet,
2433
+ tileDocument,
2434
+ tilePresentation,
2435
+ tileImage,
2436
+ tileVideo,
2437
+ tileText,
2438
+ tileArchive,
2439
+ meta: meta$1,
2440
+ facts,
2441
+ failure,
2442
+ actions: actions$1
2443
+ };
2444
+ const TEST_ID = "drive-files-widget";
2445
+ const DriveFilesHeadline = ({ request }) => request.title !== null ? /* @__PURE__ */ jsx(Text, { role: "intro", weight: "bold", translate: false, testId: `${TEST_ID}-title`, children: escapePlainTextForText(request.title) }) : /* @__PURE__ */ jsx(Text, { role: "intro", weight: "bold", replacements: { count: request.references.length }, testId: `${TEST_ID}-title`, children: request.references.length === 1 ? "1 file from the drive" : "%count% files from the drive" });
2446
+ const FAMILY_TILE_CLASS = {
2447
+ PDF: styles$c.tilePdf,
2448
+ SPREADSHEET: styles$c.tileSpreadsheet,
2449
+ DOCUMENT: styles$c.tileDocument,
2450
+ PRESENTATION: styles$c.tilePresentation,
2451
+ TEXT: styles$c.tileText,
2452
+ IMAGE: styles$c.tileImage,
2453
+ VECTOR: styles$c.tileImage,
2454
+ VIDEO: styles$c.tileVideo,
2455
+ ARCHIVE: styles$c.tileArchive
2456
+ };
2457
+ const FolderGlyph = () => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", width: "20", height: "20", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ jsx(
2458
+ "path",
2459
+ {
2460
+ fill: "currentColor",
2461
+ d: "M3 6.5A2.5 2.5 0 0 1 5.5 4h3.6c.6 0 1.2.24 1.65.66L12.2 6H18.5A2.5 2.5 0 0 1 21 8.5v9A2.5 2.5 0 0 1 18.5 20h-13A2.5 2.5 0 0 1 3 17.5v-11Z"
2462
+ }
2463
+ ) });
2464
+ const DriveFileTile = ({ card: card2 }) => {
2465
+ const [failedSource, setFailedSource] = useState(null);
2466
+ const thumbnailUrl = card2.thumbnailUrl ?? null;
2467
+ const source = thumbnailUrl && failedSource !== thumbnailUrl ? thumbnailUrl : null;
2468
+ if (card2.isFolder) {
2469
+ return /* @__PURE__ */ jsx("span", { className: `${styles$c.tile} ${styles$c.tileFolder}`, "data-testid": `${TEST_ID}-folder-tile`, children: /* @__PURE__ */ jsx(FolderGlyph, {}) });
2470
+ }
2471
+ if (source) {
2472
+ return /* @__PURE__ */ jsx("span", { className: `${styles$c.tile} ${styles$c.tileThumbnail}`, children: /* @__PURE__ */ jsx("img", { src: source, alt: "", loading: "lazy", draggable: false, onError: () => setFailedSource(source) }) });
2473
+ }
2474
+ const typeLabel = driveFileTypeLabelOf(card2) ?? "";
2475
+ return /* @__PURE__ */ jsx("span", { className: `${styles$c.tile} ${FAMILY_TILE_CLASS[driveFileFamilyOf(card2)]}`, "aria-hidden": "true", children: typeLabel.slice(0, 4) });
2476
+ };
2477
+ const startDownload = (url, fileName) => {
2478
+ const anchor2 = document.createElement("a");
2479
+ anchor2.href = url;
2480
+ anchor2.download = fileName;
2481
+ anchor2.rel = "noopener";
2482
+ document.body.appendChild(anchor2);
2483
+ anchor2.click();
2484
+ anchor2.remove();
2485
+ };
2486
+ const readOrigin = () => typeof window === "undefined" ? null : window.location.origin;
2487
+ const useCardFacts = (card2) => {
2488
+ const { dateLocale, locale } = useAgentsOwnerSettings();
2489
+ const facts2 = [];
2490
+ const typeLabel = card2.isFolder ? translateText("Folder") : driveFileTypeLabelOf(card2);
2491
+ if (typeLabel) facts2.push(typeLabel);
2492
+ if (card2.isFolder) {
2493
+ if (typeof card2.childCount === "number") {
2494
+ facts2.push(
2495
+ card2.childCount === 1 ? translateText("1 entry") : translateText("%count% entries", { count: card2.childCount })
2496
+ );
2497
+ }
2498
+ } else if (typeof card2.sizeBytes === "number") {
2499
+ facts2.push(formatDriveFileSize(card2.sizeBytes, locale ?? dateLocale));
2500
+ }
2501
+ const modifiedAtMs = parseDriveDateTimeMs(card2.modifiedAt);
2502
+ if (modifiedAtMs !== null) {
2503
+ facts2.push(new Intl.DateTimeFormat(dateLocale ?? locale ?? void 0, { dateStyle: "medium" }).format(modifiedAtMs));
2504
+ }
2505
+ return facts2.join(" · ");
2506
+ };
2507
+ const DriveFileCardRow = ({ card: card2, openCard, source, onCardsExpired }) => {
2508
+ const [busy, setBusy] = useState(false);
2509
+ const [failure2, setFailure] = useState(null);
2510
+ const { openLink } = useAgentsLinkNavigation();
2511
+ const facts2 = useCardFacts(card2);
2512
+ const name2 = card2.name ?? "";
2513
+ const openName = openCard?.name ?? name2;
2514
+ const driveHref = safeDriveFileOpenLink(card2.openLink, readOrigin()) ?? source?.buildDriveScreenHref?.(card2) ?? null;
2515
+ const readContent = async (disposition, target) => {
2516
+ if (source === null) throw new Error(DRIVE_FILE_CARDS_SOURCE_MISSING);
2517
+ const expired = isDriveFileCardExpired(target, Date.now());
2518
+ const content2 = await source.readFileContent(target, disposition);
2519
+ if (expired) onCardsExpired();
2520
+ return content2;
2521
+ };
2522
+ const openFile = async () => {
2523
+ if (openCard === null) return;
2524
+ const tab = window.open("", "_blank");
2525
+ setBusy(true);
2526
+ setFailure(null);
2527
+ try {
2528
+ const content2 = await readContent("inline", openCard);
2529
+ if (tab) {
2530
+ tab.opener = null;
2531
+ tab.location.href = content2.url;
2532
+ }
2533
+ } catch {
2534
+ tab?.close();
2535
+ setFailure(translateText("%name% could not be opened.", { name: openName }));
2536
+ } finally {
2537
+ setBusy(false);
2538
+ }
2539
+ };
2540
+ const downloadFile = async () => {
2541
+ setBusy(true);
2542
+ setFailure(null);
2543
+ try {
2544
+ const content2 = await readContent("attachment", card2);
2545
+ startDownload(content2.url, content2.fileName || name2);
2546
+ } catch {
2547
+ setFailure(translateText("%name% could not be downloaded.", { name: name2 }));
2548
+ } finally {
2549
+ setBusy(false);
2550
+ }
2551
+ };
2552
+ const meta2 = /* @__PURE__ */ jsxs("span", { className: styles$c.meta, children: [
2553
+ facts2 !== "" ? /* @__PURE__ */ jsx("span", { className: styles$c.facts, children: facts2 }) : null,
2554
+ card2.state ? /* @__PURE__ */ jsx(StatusChip, { tone: "warning", compact: true, translate: false, children: escapePlainTextForText(card2.state) }) : null,
2555
+ failure2 !== null ? /* @__PURE__ */ jsx("span", { role: "alert", className: styles$c.failure, children: failure2 }) : null
2556
+ ] });
2557
+ const actions2 = /* @__PURE__ */ jsxs("span", { className: styles$c.actions, children: [
2558
+ !card2.isFolder && openCard !== null ? /* @__PURE__ */ jsx(Tooltip, { text: "Open %name%", replacements: { name: openName }, children: /* @__PURE__ */ jsx(
2559
+ Button,
2560
+ {
2561
+ variant: "muted",
2562
+ size: "small",
2563
+ icon: "newTab",
2564
+ ariaLabel: translateText("Open %name%", { name: openName }),
2565
+ disabled: busy,
2566
+ onClick: () => void openFile(),
2567
+ testId: `${TEST_ID}-open`
2568
+ }
2569
+ ) }) : null,
2570
+ !card2.isFolder ? /* @__PURE__ */ jsx(Tooltip, { text: "Download %name%", replacements: { name: name2 }, children: /* @__PURE__ */ jsx(
2571
+ Button,
2572
+ {
2573
+ variant: "muted",
2574
+ size: "small",
2575
+ icon: "download",
2576
+ ariaLabel: translateText("Download %name%", { name: name2 }),
2577
+ disabled: busy,
2578
+ onClick: () => void downloadFile(),
2579
+ testId: `${TEST_ID}-download`
2580
+ }
2581
+ ) }) : null,
2582
+ driveHref !== null ? /* @__PURE__ */ jsx(Tooltip, { text: "Show %name% in the drive", replacements: { name: name2 }, children: /* @__PURE__ */ jsx(
2583
+ Button,
2584
+ {
2585
+ variant: "muted",
2586
+ size: "small",
2587
+ icon: "details",
2588
+ ariaLabel: translateText("Show %name% in the drive", { name: name2 }),
2589
+ onClick: (event) => openLink(driveHref, event),
2590
+ testId: `${TEST_ID}-show-in-drive`
2591
+ }
2592
+ ) }) : null
2593
+ ] });
2594
+ return /* @__PURE__ */ jsx("div", { role: "listitem", "data-testid": `${TEST_ID}-card`, title: card2.path ?? void 0, children: /* @__PURE__ */ jsx(
2595
+ WidgetListRow,
2596
+ {
2597
+ leading: /* @__PURE__ */ jsx(DriveFileTile, { card: card2 }),
2598
+ title: escapePlainTextForText(name2),
2599
+ meta: meta2,
2600
+ trailing: actions2
2601
+ }
2602
+ ) });
2603
+ };
2604
+ const HydratedDriveFiles = ({ request, justDelivered }) => {
2605
+ const hydration = useWidgetHydration(DRIVE_FILES_WIDGET_TYPE, request, {
2606
+ forceRefresh: justDelivered
2607
+ });
2608
+ const cards = hydration.data ?? [];
2609
+ const hasData = hydration.status === "success";
2610
+ const notConnected = hydration.isError && hydration.error === DRIVE_FILE_CARDS_SOURCE_MISSING;
2611
+ const source = readDriveFileCardsSource();
2612
+ useReportWidgetRenderStatus(
2613
+ hydration.isError ? "failed" : !hasData ? "pending" : cards.length === 0 ? "empty" : "mounted",
2614
+ hydration.isError ? "HYDRATION_FAILED" : hasData && cards.length === 0 ? "NO_DATA" : void 0,
2615
+ notConnected ? "No drive is connected to this frontend; the DriveFiles card cannot read its files." : hydration.isError ? "The DriveFiles card could not read its files." : hasData && cards.length === 0 ? "The DriveFiles card shows no file: none of its references is readable for the viewer." : void 0
2616
+ );
2617
+ if (notConnected) {
2618
+ return /* @__PURE__ */ jsx(WidgetSurface, { testId: TEST_ID, children: /* @__PURE__ */ jsxs("div", { className: styles$c.stack, children: [
2619
+ /* @__PURE__ */ jsx(DriveFilesHeadline, { request }),
2620
+ /* @__PURE__ */ jsx(Text, { role: "body", weight: "bold", children: "The drive is not connected yet" }),
2621
+ /* @__PURE__ */ jsx(Text, { role: "help", children: "These files show here once the drive is part of this app." })
2622
+ ] }) });
2623
+ }
2624
+ if (hydration.isError) {
2625
+ return /* @__PURE__ */ jsx(WidgetSurface, { testId: TEST_ID, children: /* @__PURE__ */ jsxs("div", { className: styles$c.stack, children: [
2626
+ /* @__PURE__ */ jsx(DriveFilesHeadline, { request }),
2627
+ /* @__PURE__ */ jsx(Text, { role: "body", children: "The files could not be loaded." }),
2628
+ /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(Button, { variant: "default", size: "small", onClick: () => hydration.refetch(), testId: `${TEST_ID}-retry`, children: "Try again" }) })
2629
+ ] }) });
2630
+ }
2631
+ if (!hasData) {
2632
+ return /* @__PURE__ */ jsx(
2633
+ WidgetSurfaceSkeleton,
2634
+ {
2635
+ title: /* @__PURE__ */ jsx(DriveFilesHeadline, { request }),
2636
+ rowCount: Math.min(request.references.length, 3),
2637
+ testId: TEST_ID
2638
+ }
2639
+ );
2640
+ }
2641
+ return /* @__PURE__ */ jsx(WidgetSurface, { testId: TEST_ID, children: /* @__PURE__ */ jsxs("div", { className: styles$c.stack, children: [
2642
+ /* @__PURE__ */ jsx(DriveFilesHeadline, { request }),
2643
+ cards.length === 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
2644
+ /* @__PURE__ */ jsx(Text, { role: "body", weight: "bold", children: "No file to show" }),
2645
+ /* @__PURE__ */ jsx(Text, { role: "help", children: "These files were removed, or you may not open them." })
2646
+ ] }) : /* @__PURE__ */ jsx("div", { role: "list", className: styles$c.list, children: cards.map((card2) => /* @__PURE__ */ jsx(
2647
+ DriveFileCardRow,
2648
+ {
2649
+ card: card2,
2650
+ openCard: driveFileCardToOpen(card2, cards),
2651
+ source,
2652
+ onCardsExpired: () => hydration.refetch()
2653
+ },
2654
+ card2.reference || card2.path || card2.name
2655
+ )) })
2656
+ ] }) });
2657
+ };
2658
+ const InvalidDriveFilesBlock = () => {
2659
+ useReportWidgetRenderStatus("failed", "INVALID_PROP", "The DriveFiles block names no store or no file reference.");
2660
+ return null;
2661
+ };
2662
+ const DriveFilesConversationWidget = (props) => {
2663
+ const { payload, justDelivered = false } = props;
2664
+ const selfHydrationKeyAttribute = readWidgetAgentSpaceKeyAttribute(props);
2665
+ const request = useMemo(
2666
+ () => parseDriveFilesPayload(payload, getWidgetSelfHydrationKeyFieldName(), selfHydrationKeyAttribute),
2667
+ [payload, selfHydrationKeyAttribute]
2668
+ );
2669
+ if (request === null) return /* @__PURE__ */ jsx(InvalidDriveFilesBlock, {});
2670
+ return /* @__PURE__ */ jsx(HydratedDriveFiles, { request, justDelivered });
2671
+ };
2186
2672
  const ENTITY_TYPE_ICONS = {
2187
2673
  competitor: "business",
2188
2674
  review: "star",
@@ -4039,109 +4525,127 @@ const WebSearchResultsConversationWidget = (props) => {
4039
4525
  );
4040
4526
  };
4041
4527
  export {
4042
- CUSTOM_VISUALIZATION_SANDBOX_CONFIG as $,
4043
- readWidgetAgentSpaceKeyAttribute as A,
4044
- sameCanvasAnchor as B,
4528
+ ClockConversationWidget as $,
4529
+ pageAnchor as A,
4530
+ readWidgetAgentSpaceKeyAttribute as B,
4045
4531
  ConversationWidgetActions as C,
4046
- shortStringHash as D,
4047
- useConversationWidgetContext as E,
4048
- useIsEmailWidgetRender as F,
4049
- useReportWidgetRenderStatus as G,
4050
- useWidgetHydration as H,
4051
- useWidgetMemory as I,
4052
- useWidgetRenderReporter as J,
4053
- WidgetImageReadinessContext as K,
4532
+ sameCanvasAnchor as D,
4533
+ shortStringHash as E,
4534
+ useConversationWidgetContext as F,
4535
+ useIsEmailWidgetRender as G,
4536
+ useReportWidgetRenderStatus as H,
4537
+ useWidgetHydration as I,
4538
+ useWidgetMemory as J,
4539
+ useWidgetRenderReporter as K,
4054
4540
  LEGACY_CARD_CLICK_ORIGIN as L,
4055
4541
  ModelText as M,
4056
- WidgetImageRenderContext as N,
4057
- WidgetImageLiveHydrationContext as O,
4058
- readFrozenHydration as P,
4059
- useWidgetImageLiveHydration as Q,
4542
+ WidgetImageReadinessContext as N,
4543
+ WidgetImageRenderContext as O,
4544
+ WidgetImageLiveHydrationContext as P,
4545
+ readFrozenHydration as Q,
4060
4546
  ReadOnlyConversationWidgetProvider as R,
4061
4547
  StandaloneConversationWidgetProvider as S,
4062
- useWidgetImageRender as T,
4063
- CanvasViabilityContext as U,
4064
- readCanvasViable as V,
4548
+ useWidgetImageLiveHydration as T,
4549
+ useWidgetImageRender as U,
4550
+ CANVAS_VIABLE_MIN_WIDTH as V,
4065
4551
  WidgetRenderReportContext as W,
4066
- WidgetSurface as X,
4067
- SkeletonCircle as Y,
4068
- SkeletonLine as Z,
4069
- CANVAS_VIABLE_MIN_WIDTH as _,
4552
+ CUSTOM_VISUALIZATION_SANDBOX_CONFIG as X,
4553
+ CanvasLauncherWidget as Y,
4554
+ CanvasViabilityContext as Z,
4555
+ CanvasWidgetSwitch as _,
4070
4556
  registerConceptExplainerTypes as a,
4071
- CanvasLauncherWidget as a0,
4072
- CanvasWidgetSwitch as a1,
4073
- ClockConversationWidget as a2,
4074
- ConceptExplainerConversationWidget as a3,
4075
- ConversationSearchResultsConversationWidget as a4,
4076
- CurrencyConverterConversationWidget as a5,
4077
- CustomVisualizationConversationWidget as a6,
4557
+ readTextNodeRenderState as a$,
4558
+ ConceptExplainerConversationWidget as a0,
4559
+ ConversationSearchResultsConversationWidget as a1,
4560
+ CurrencyConverterConversationWidget as a2,
4561
+ CustomVisualizationConversationWidget as a3,
4562
+ DRIVE_FILES_MAX_FILES as a4,
4563
+ DRIVE_FILES_WIDGET_TYPE as a5,
4564
+ DRIVE_FILE_CARDS_SOURCE_MISSING as a6,
4078
4565
  DonePill as a7,
4079
- ElementWidthCanvasViability as a8,
4080
- EntityMentionConversationWidget as a9,
4081
- ENTITY_MENTION_WIDGET_NAME as aA,
4082
- buildEntityMentionFields as aB,
4083
- normalizeEntityMentionFields as aC,
4084
- entityMentionKey as aD,
4085
- MAX_ENTITY_MENTIONS_PER_MESSAGE as aE,
4086
- toEntityMentionWireFields as aF,
4087
- ConversationWidgetButton as aG,
4088
- readTextNodeContent as aH,
4089
- readAllowedValue as aI,
4090
- useReportTextNodeRenderState as aJ,
4091
- readTextNodeRenderState as aK,
4092
- buildFaviconUrl as aL,
4093
- readSiteHostname as aM,
4094
- readSafeHttpUrl as aN,
4095
- MultiChoiceConversationWidget as aa,
4096
- QuickRepliesConversationWidget as ab,
4097
- SkeletonPill as ac,
4098
- SkeletonWidgetLabel as ad,
4099
- SuggestedActions as ae,
4100
- ToolTraceConversationWidget as af,
4101
- WebSearchResultsConversationWidget as ag,
4102
- WidgetKpiValue as ah,
4103
- WritingDraftConversationWidget as ai,
4104
- canvasForMessageWidget as aj,
4105
- formatConceptExplainerNumber as ak,
4106
- normalizeSearchHitExcerpt as al,
4107
- pickAllowed as am,
4108
- pickAllowedValue as an,
4109
- pickReviewExternalId as ao,
4110
- pickSafeAlias as ap,
4111
- pickSafeAliases as aq,
4112
- pickText as ar,
4113
- readConceptExplainerNumber as as,
4114
- readConceptExplainerValue as at,
4115
- resolveCustomVisualizationFrameUrl as au,
4116
- useCanvasViable as av,
4117
- parseConversationSearchResultsPayload as aw,
4118
- WebSearchAnswer as ax,
4119
- WebSearchSourcesList as ay,
4120
- parseWebSearchResultsPayload as az,
4121
- registerWidgetHydrator as b,
4122
- abandonWidgetHydrationReads as c,
4123
- useResolvedConversationWidgetAgentSpaceKey as d,
4124
- ConversationWidgetAgentSpaceFrame as e,
4125
- ConversationWidgetAgentSpaceHeader as f,
4566
+ DriveFilesConversationWidget as a8,
4567
+ ElementWidthCanvasViability as a9,
4568
+ pickAllowedValue as aA,
4569
+ pickReviewExternalId as aB,
4570
+ pickSafeAlias as aC,
4571
+ pickSafeAliases as aD,
4572
+ pickText as aE,
4573
+ readCanvasViable as aF,
4574
+ readConceptExplainerNumber as aG,
4575
+ readConceptExplainerValue as aH,
4576
+ readDriveFileCardsSource as aI,
4577
+ resolveCustomVisualizationFrameUrl as aJ,
4578
+ safeDriveFileOpenLink as aK,
4579
+ unregisterDriveFileCardsSource as aL,
4580
+ useCanvasViable as aM,
4581
+ parseConversationSearchResultsPayload as aN,
4582
+ WebSearchAnswer as aO,
4583
+ WebSearchSourcesList as aP,
4584
+ parseWebSearchResultsPayload as aQ,
4585
+ ENTITY_MENTION_WIDGET_NAME as aR,
4586
+ buildEntityMentionFields as aS,
4587
+ normalizeEntityMentionFields as aT,
4588
+ entityMentionKey as aU,
4589
+ MAX_ENTITY_MENTIONS_PER_MESSAGE as aV,
4590
+ toEntityMentionWireFields as aW,
4591
+ ConversationWidgetButton as aX,
4592
+ readTextNodeContent as aY,
4593
+ readAllowedValue as aZ,
4594
+ useReportTextNodeRenderState as a_,
4595
+ EntityMentionConversationWidget as aa,
4596
+ MultiChoiceConversationWidget as ab,
4597
+ QuickRepliesConversationWidget as ac,
4598
+ SkeletonCircle as ad,
4599
+ SkeletonLine as ae,
4600
+ SkeletonPill as af,
4601
+ SkeletonWidgetLabel as ag,
4602
+ SuggestedActions as ah,
4603
+ ToolTraceConversationWidget as ai,
4604
+ WebSearchResultsConversationWidget as aj,
4605
+ WidgetKpiValue as ak,
4606
+ WidgetListRow as al,
4607
+ WidgetSurface as am,
4608
+ WidgetSurfaceSkeleton as an,
4609
+ WritingDraftConversationWidget as ao,
4610
+ canvasForMessageWidget as ap,
4611
+ driveFileCardToOpen as aq,
4612
+ driveFileFamilyOf as ar,
4613
+ driveFileTypeLabelOf as as,
4614
+ formatConceptExplainerNumber as at,
4615
+ formatDriveFileSize as au,
4616
+ isDriveFileCardExpired as av,
4617
+ nodeIdOfReference as aw,
4618
+ normalizeSearchHitExcerpt as ax,
4619
+ parseDriveFilesPayload as ay,
4620
+ pickAllowed as az,
4621
+ registerDriveFileCardsSource as b,
4622
+ buildFaviconUrl as b0,
4623
+ readSiteHostname as b1,
4624
+ readSafeHttpUrl as b2,
4625
+ registerDriveFilesHydrator as b3,
4626
+ registerWidgetHydrator as c,
4627
+ abandonWidgetHydrationReads as d,
4628
+ useResolvedConversationWidgetAgentSpaceKey as e,
4629
+ ConversationWidgetAgentSpaceFrame as f,
4126
4630
  getWidgetHydrator as g,
4127
- ConversationWidgetContext as h,
4128
- ConversationWidgetRenderContext as i,
4129
- buildWidgetAgentSpaceKeyProps as j,
4130
- canvasInstanceIdForActiveAgentSpace as k,
4631
+ ConversationWidgetAgentSpaceHeader as h,
4632
+ ConversationWidgetContext as i,
4633
+ ConversationWidgetRenderContext as j,
4634
+ buildWidgetAgentSpaceKeyProps as k,
4131
4635
  listWidgetHydratorTypes as l,
4132
- canvasInstanceIdForAgentSpace as m,
4133
- canvasInstanceIdForEntity as n,
4134
- canvasInstanceIdForMessage as o,
4636
+ canvasInstanceIdForActiveAgentSpace as m,
4637
+ canvasInstanceIdForAgentSpace as n,
4638
+ canvasInstanceIdForEntity as o,
4135
4639
  payloadHashOfInstanceId as p,
4136
- canvasInstanceIdForMessagePayload as q,
4640
+ canvasInstanceIdForMessage as q,
4137
4641
  readConceptExplainerTypeDefinitions as r,
4138
4642
  sameCanvasIdentity as s,
4139
- defaultConversationWidgetCallbacks as t,
4643
+ canvasInstanceIdForMessagePayload as t,
4140
4644
  unregisterWidgetHydrator as u,
4141
- entityIdOfInstanceId as v,
4142
- hasWidgetHydrator as w,
4143
- isCanvasAnchorLoaded as x,
4144
- messageAnchor as y,
4145
- pageAnchor as z
4645
+ defaultConversationWidgetCallbacks as v,
4646
+ entityIdOfInstanceId as w,
4647
+ hasWidgetHydrator as x,
4648
+ isCanvasAnchorLoaded as y,
4649
+ messageAnchor as z
4146
4650
  };
4147
- //# sourceMappingURL=WebSearchResultsConversationWidget-DMAzB2yP.js.map
4651
+ //# sourceMappingURL=WebSearchResultsConversationWidget-qp4zrauN.js.map