@mediaradar/design-components 0.61.0 → 0.63.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.
package/dist/index.cjs CHANGED
@@ -728,25 +728,286 @@ function Badge({ tone = "neutral", kind = "label", dot = false, highlight = fals
728
728
  }
729
729
 
730
730
  // src/Delta.tsx
731
+ var import_react4 = require("react");
731
732
  var import_lucide_react4 = require("lucide-react");
733
+
734
+ // src/Tooltip.tsx
735
+ var import_react3 = require("react");
736
+ var import_react_dom2 = require("react-dom");
732
737
  var import_jsx_runtime6 = require("react/jsx-runtime");
733
- function Delta({ value, suffix = "%", arrow = false, period, className, testIdPrefix }) {
734
- const up = value >= 0;
738
+ function addDescribedBy(el, id) {
739
+ const ids = (el.getAttribute("aria-describedby") ?? "").split(" ").filter(Boolean);
740
+ if (!ids.includes(id)) el.setAttribute("aria-describedby", [...ids, id].join(" "));
741
+ }
742
+ function removeDescribedBy(el, id) {
743
+ const ids = (el.getAttribute("aria-describedby") ?? "").split(" ").filter((x) => x && x !== id);
744
+ if (ids.length) el.setAttribute("aria-describedby", ids.join(" "));
745
+ else el.removeAttribute("aria-describedby");
746
+ }
747
+ function exitDurationMs(el) {
748
+ if (typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches) return 0;
749
+ const cs = window.getComputedStyle(el);
750
+ if (cs.transitionProperty === "none") return 0;
751
+ const toMs = (v) => {
752
+ const n = parseFloat(v);
753
+ if (!Number.isFinite(n)) return 0;
754
+ return v.trim().endsWith("ms") ? n : n * 1e3;
755
+ };
756
+ const durations = cs.transitionDuration.split(",").map(toMs);
757
+ const delays = cs.transitionDelay.split(",").map(toMs);
758
+ return Math.max(0, ...durations.map((d, i) => d + (delays[i] ?? delays[0] ?? 0)));
759
+ }
760
+ function Tooltip({
761
+ label,
762
+ children,
763
+ anchorRef,
764
+ className,
765
+ whenTruncated = false,
766
+ interactive = false,
767
+ placement = "top",
768
+ align = "center",
769
+ delay = 0,
770
+ variant = "surface",
771
+ testIdPrefix
772
+ }) {
773
+ const [anchor, setAnchor] = (0, import_react3.useState)(null);
774
+ const [boxWidth, setBoxWidth] = (0, import_react3.useState)(null);
775
+ const ref = (0, import_react3.useRef)(null);
776
+ const boxRef = (0, import_react3.useRef)(null);
777
+ const hideTimer = (0, import_react3.useRef)(null);
778
+ const showTimer = (0, import_react3.useRef)(null);
779
+ const exitTimer = (0, import_react3.useRef)(null);
780
+ const [shown, setShown] = (0, import_react3.useState)(false);
781
+ const openRef = (0, import_react3.useRef)(false);
782
+ const mountedRef = (0, import_react3.useRef)(false);
783
+ const id = (0, import_react3.useId)();
784
+ const describedRef = (0, import_react3.useRef)(null);
785
+ const clearHideTimer = () => {
786
+ if (hideTimer.current) {
787
+ clearTimeout(hideTimer.current);
788
+ hideTimer.current = null;
789
+ }
790
+ };
791
+ const clearShowTimer = () => {
792
+ if (showTimer.current) {
793
+ clearTimeout(showTimer.current);
794
+ showTimer.current = null;
795
+ }
796
+ };
797
+ const clearExitTimer = () => {
798
+ if (exitTimer.current) {
799
+ clearTimeout(exitTimer.current);
800
+ exitTimer.current = null;
801
+ }
802
+ };
803
+ (0, import_react3.useEffect)(
804
+ () => () => {
805
+ clearHideTimer();
806
+ clearShowTimer();
807
+ clearExitTimer();
808
+ },
809
+ []
810
+ );
811
+ const reveal = () => {
812
+ const el = anchorRef ? anchorRef.current : ref.current;
813
+ if (!el) return;
814
+ if (whenTruncated && el.scrollWidth <= el.clientWidth) return;
815
+ clearExitTimer();
816
+ openRef.current = true;
817
+ const r = el.getBoundingClientRect();
818
+ if (!mountedRef.current) setBoxWidth(null);
819
+ mountedRef.current = true;
820
+ setAnchor({ top: r.top, left: r.left, width: r.width, height: r.height, bottom: r.bottom, right: r.right });
821
+ const target = anchorRef ? el : describedRef.current;
822
+ if (target) addDescribedBy(target, id);
823
+ };
824
+ const show = () => {
825
+ clearHideTimer();
826
+ clearShowTimer();
827
+ if (delay > 0 && !mountedRef.current) {
828
+ showTimer.current = setTimeout(reveal, delay);
829
+ } else {
830
+ reveal();
831
+ }
832
+ };
833
+ const unmount = () => {
834
+ clearExitTimer();
835
+ if (openRef.current || !mountedRef.current) return;
836
+ mountedRef.current = false;
837
+ setAnchor(null);
838
+ setBoxWidth(null);
839
+ if (anchorRef?.current) removeDescribedBy(anchorRef.current, id);
840
+ if (describedRef.current) removeDescribedBy(describedRef.current, id);
841
+ describedRef.current = null;
842
+ };
843
+ const hideNow = () => {
844
+ clearShowTimer();
845
+ clearHideTimer();
846
+ openRef.current = false;
847
+ if (!mountedRef.current) return;
848
+ setShown(false);
849
+ clearExitTimer();
850
+ const ms = boxRef.current ? exitDurationMs(boxRef.current) : 0;
851
+ if (ms === 0) {
852
+ unmount();
853
+ return;
854
+ }
855
+ exitTimer.current = setTimeout(unmount, ms + 50);
856
+ };
857
+ const keepOpen = () => {
858
+ clearHideTimer();
859
+ if (openRef.current || !mountedRef.current) return;
860
+ clearExitTimer();
861
+ openRef.current = true;
862
+ setShown(true);
863
+ };
864
+ const onBoxTransitionEnd = (e) => {
865
+ if (e.target !== e.currentTarget || e.propertyName !== "opacity") return;
866
+ if (!openRef.current) unmount();
867
+ };
868
+ const hide = () => {
869
+ clearShowTimer();
870
+ if (!interactive) {
871
+ hideNow();
872
+ return;
873
+ }
874
+ clearHideTimer();
875
+ hideTimer.current = setTimeout(hideNow, 120);
876
+ };
877
+ (0, import_react3.useEffect)(() => {
878
+ if (!anchorRef) return;
879
+ const el = anchorRef.current;
880
+ if (!el) return;
881
+ el.addEventListener("mouseenter", show);
882
+ el.addEventListener("mouseleave", hide);
883
+ el.addEventListener("focus", show);
884
+ el.addEventListener("blur", hide);
885
+ return () => {
886
+ el.removeEventListener("mouseenter", show);
887
+ el.removeEventListener("mouseleave", hide);
888
+ el.removeEventListener("focus", show);
889
+ el.removeEventListener("blur", hide);
890
+ };
891
+ }, [anchorRef, placement, delay]);
892
+ (0, import_react3.useEffect)(() => {
893
+ if (!anchor) return;
894
+ const onKey = (e) => e.key === "Escape" && hideNow();
895
+ window.addEventListener("keydown", onKey);
896
+ return () => window.removeEventListener("keydown", onKey);
897
+ }, [anchor]);
898
+ (0, import_react3.useLayoutEffect)(() => {
899
+ if (!anchor) return;
900
+ const el = boxRef.current;
901
+ if (!el) return;
902
+ setBoxWidth(el.getBoundingClientRect().width);
903
+ if (openRef.current) setShown(true);
904
+ }, [anchor, label]);
905
+ const margin = 8;
906
+ let style = { top: 0, left: 0 };
907
+ let translate = "";
908
+ if (anchor) {
909
+ if (placement === "right") {
910
+ style = { top: anchor.top + anchor.height / 2, left: anchor.right + 8 };
911
+ translate = "-translate-y-1/2";
912
+ } else if (placement === "bottom-end") {
913
+ style = { top: anchor.bottom + 8, right: window.innerWidth - anchor.right };
914
+ } else {
915
+ const w = boxWidth ?? anchor.width;
916
+ const desired = align === "start" ? anchor.left : anchor.left + anchor.width / 2 - w / 2;
917
+ const left = Math.min(Math.max(desired, margin), Math.max(margin, window.innerWidth - w - margin));
918
+ style = { left, top: placement === "bottom" ? anchor.bottom : anchor.top };
919
+ translate = placement === "bottom" ? "translate-y-2" : "-translate-y-[calc(100%+8px)]";
920
+ }
921
+ }
922
+ const floating = anchor != null && typeof document !== "undefined" ? (0, import_react_dom2.createPortal)(
923
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
924
+ "span",
925
+ {
926
+ ref: boxRef,
927
+ role: "tooltip",
928
+ id,
929
+ "data-testid": testIdPrefix && `${testIdPrefix}-tooltip`,
930
+ style: { top: style.top, left: style.left, right: style.right, visibility: boxWidth == null ? "hidden" : "visible" },
931
+ onMouseEnter: interactive ? keepOpen : void 0,
932
+ onMouseLeave: interactive ? hide : void 0,
933
+ onTransitionEnd: onBoxTransitionEnd,
934
+ className: cn(
935
+ "fixed z-tooltip w-max max-w-xs whitespace-normal break-words px-2.5 py-1.5 text-xs leading-snug",
936
+ // Fade in/out. The sys duration token rather than a ref one:
937
+ // it is what Button's hover/press transition uses, and a
938
+ // tooltip's fade is the same kind of interactive feedback.
939
+ // design-tokens has no in-out curve (ease-interactive is the
940
+ // decelerating "standard" curve), so ease-in-out is Tailwind's.
941
+ "transition-opacity duration-(--mr-motion-duration-interactive) ease-in-out motion-reduce:transition-none",
942
+ shown ? "opacity-100" : "opacity-0",
943
+ // Non-interactive: never a pointer target, fade-out included.
944
+ interactive ? "pointer-events-auto" : "pointer-events-none",
945
+ variant === "inverted" ? "rounded-control bg-text-primary text-surface" : "rounded-control border border-border-default bg-surface text-text-primary shadow-overlay",
946
+ translate
947
+ ),
948
+ children: label
949
+ }
950
+ ),
951
+ document.body
952
+ ) : null;
953
+ if (anchorRef) return floating;
735
954
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
955
+ "span",
956
+ {
957
+ ref,
958
+ className,
959
+ "data-testid": testIdPrefix,
960
+ onMouseEnter: show,
961
+ onMouseLeave: hide,
962
+ onFocus: (e) => {
963
+ describedRef.current = e.target;
964
+ show();
965
+ },
966
+ onBlur: hide,
967
+ children: [
968
+ children,
969
+ floating
970
+ ]
971
+ }
972
+ );
973
+ }
974
+
975
+ // src/Delta.tsx
976
+ var import_jsx_runtime7 = require("react/jsx-runtime");
977
+ var DeltaBoldContext = (0, import_react4.createContext)(false);
978
+ function Delta({ value, suffix = "%", unit, arrow = false, period, className, testIdPrefix }) {
979
+ const bold = (0, import_react4.useContext)(DeltaBoldContext);
980
+ const abs = Math.abs(value);
981
+ const word = unit === void 0 ? null : typeof unit === "string" ? unit : abs === 1 ? unit.one : unit.other;
982
+ const shown = word !== null && Number.isInteger(abs) ? String(abs) : abs.toFixed(1);
983
+ if (Number(shown) === 0) {
984
+ const exact = value === 0 ? null : `${value > 0 ? "+" : "\u2212"}${abs}${word === null ? suffix : `\xA0${word}`}`;
985
+ const words = /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: cn("text-text-tertiary", bold && "font-semibold", className), "data-testid": testIdPrefix, children: [
986
+ "No change",
987
+ exact && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "sr-only", children: [
988
+ " (",
989
+ exact,
990
+ ")"
991
+ ] })
992
+ ] });
993
+ return exact ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Tooltip, { label: exact, delay: 300, children: words }) : words;
994
+ }
995
+ const up = value > 0;
996
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
736
997
  "span",
737
998
  {
738
999
  className: cn(
739
- "inline-flex items-center gap-0.5 font-medium tabular-nums",
1000
+ "inline-flex items-center gap-0.5 tabular-nums",
1001
+ bold ? "font-semibold" : "font-medium",
740
1002
  up ? "text-text-success" : "text-text-danger",
741
1003
  className
742
1004
  ),
743
1005
  "data-testid": testIdPrefix,
744
1006
  children: [
745
- arrow && (up ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react4.ArrowUpRight, { size: 13, "aria-hidden": "true" }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react4.ArrowDownRight, { size: 13, "aria-hidden": "true" })),
1007
+ arrow && (up ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react4.ArrowUpRight, { size: 13, "aria-hidden": "true" }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react4.ArrowDownRight, { size: 13, "aria-hidden": "true" })),
746
1008
  up ? "+" : "\u2212",
747
- Math.abs(value).toFixed(1),
748
- suffix,
749
- period && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "ml-0.5", children: period })
1009
+ word === null ? `${shown}${suffix}` : `${shown}\xA0${word}`,
1010
+ period && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "ml-0.5", children: period })
750
1011
  ]
751
1012
  }
752
1013
  );
@@ -754,19 +1015,19 @@ function Delta({ value, suffix = "%", arrow = false, period, className, testIdPr
754
1015
 
755
1016
  // src/PrimaryBadge.tsx
756
1017
  var import_lucide_react5 = require("lucide-react");
757
- var import_jsx_runtime7 = require("react/jsx-runtime");
1018
+ var import_jsx_runtime8 = require("react/jsx-runtime");
758
1019
  function PrimaryBadge({ label = "Primary", icon: Icon = import_lucide_react5.Check, title, className, testIdPrefix }) {
759
- const badge = /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Badge, { tone: "brand", className: title ? void 0 : className, testIdPrefix, children: [
760
- Icon && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { size: 11, "aria-hidden": "true" }),
1020
+ const badge = /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Badge, { tone: "brand", className: title ? void 0 : className, testIdPrefix, children: [
1021
+ Icon && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { size: 11, "aria-hidden": "true" }),
761
1022
  label
762
1023
  ] });
763
- return title ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { title, className: cn("inline-flex shrink-0", className), children: badge }) : badge;
1024
+ return title ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { title, className: cn("inline-flex shrink-0", className), children: badge }) : badge;
764
1025
  }
765
1026
 
766
1027
  // src/CheckBox.tsx
767
- var import_react3 = require("react");
1028
+ var import_react5 = require("react");
768
1029
  var import_lucide_react6 = require("lucide-react");
769
- var import_jsx_runtime8 = require("react/jsx-runtime");
1030
+ var import_jsx_runtime9 = require("react/jsx-runtime");
770
1031
  function boxClass(on, disabled) {
771
1032
  return cn(
772
1033
  "flex size-4.5 shrink-0 items-center justify-center rounded-small border transition-colors",
@@ -775,12 +1036,12 @@ function boxClass(on, disabled) {
775
1036
  );
776
1037
  }
777
1038
  function Glyph({ checked, indeterminate }) {
778
- if (indeterminate) return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react6.Minus, { size: 13, strokeWidth: 3 });
779
- return checked ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react6.Check, { size: 13, strokeWidth: 3 }) : null;
1039
+ if (indeterminate) return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react6.Minus, { size: 13, strokeWidth: 3 });
1040
+ return checked ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react6.Check, { size: 13, strokeWidth: 3 }) : null;
780
1041
  }
781
- var CheckBox = (0, import_react3.forwardRef)(function CheckBox2({ checked, indeterminate, onChange, ariaLabel, disabled, stopPropagation = true, testId, testIdPrefix, title, className }, ref) {
1042
+ var CheckBox = (0, import_react5.forwardRef)(function CheckBox2({ checked, indeterminate, onChange, ariaLabel, disabled, stopPropagation = true, testId, testIdPrefix, title, className }, ref) {
782
1043
  const on = checked || !!indeterminate;
783
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1044
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
784
1045
  "button",
785
1046
  {
786
1047
  ref,
@@ -805,29 +1066,29 @@ var CheckBox = (0, import_react3.forwardRef)(function CheckBox2({ checked, indet
805
1066
  disabled && "hover:border-border-interactive",
806
1067
  className
807
1068
  ),
808
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Glyph, { checked, indeterminate })
1069
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Glyph, { checked, indeterminate })
809
1070
  }
810
1071
  );
811
1072
  });
812
1073
  CheckBox.displayName = "CheckBox";
813
- var CheckBoxBox = (0, import_react3.forwardRef)(function CheckBoxBox2({ checked, indeterminate, disabled, className, testIdPrefix }, ref) {
814
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1074
+ var CheckBoxBox = (0, import_react5.forwardRef)(function CheckBoxBox2({ checked, indeterminate, disabled, className, testIdPrefix }, ref) {
1075
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
815
1076
  "span",
816
1077
  {
817
1078
  ref,
818
1079
  "aria-hidden": "true",
819
1080
  "data-testid": testIdPrefix,
820
1081
  className: cn(boxClass(checked || !!indeterminate, disabled), className),
821
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Glyph, { checked, indeterminate })
1082
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Glyph, { checked, indeterminate })
822
1083
  }
823
1084
  );
824
1085
  });
825
1086
  CheckBoxBox.displayName = "CheckBoxBox";
826
1087
 
827
1088
  // src/DateRangeFilter.tsx
828
- var import_react4 = require("react");
1089
+ var import_react6 = require("react");
829
1090
  var import_lucide_react7 = require("lucide-react");
830
- var import_jsx_runtime9 = require("react/jsx-runtime");
1091
+ var import_jsx_runtime10 = require("react/jsx-runtime");
831
1092
  var DEFAULT_SHORTCUTS = [
832
1093
  "Year to date",
833
1094
  "Rolling 3 months",
@@ -1008,40 +1269,40 @@ function DateRangeFilter({
1008
1269
  const SHORTCUTS = (presetSet === "creativeIntel" ? CREATIVE_INTEL_SHORTCUTS : DEFAULT_SHORTCUTS).filter(
1009
1270
  (s) => !excludePresets.includes(s)
1010
1271
  );
1011
- const today = (0, import_react4.useMemo)(() => todayProp ?? /* @__PURE__ */ new Date(), []);
1272
+ const today = (0, import_react6.useMemo)(() => todayProp ?? /* @__PURE__ */ new Date(), []);
1012
1273
  const initShortcut = matchShortcut(SHORTCUTS, controlled ? controlledValue : defaultValue);
1013
1274
  const initRange = controlled ? controlledRange : initShortcut === "Custom" && initialRange ? snap(...initialRange) : snap(...presetRange(initShortcut === "Custom" ? "Rolling 12 months" : initShortcut, today));
1014
1275
  const compareLabel = (id) => compare?.options.find((o) => o.id === id)?.label;
1015
1276
  const dateLine = (s, e) => monthly ? `${fmtMonth(s)} \u2013 ${fmtMonth(e)}` : formatted ? showRange(s, e) : shortDates ? `${fmt(s)} \u2013 ${fmt(e)}` : fullRangeLabel(s, e);
1016
- const [open, setOpen] = (0, import_react4.useState)(false);
1017
- const [uncontrolledValue, setUncontrolledValue] = (0, import_react4.useState)(
1277
+ const [open, setOpen] = (0, import_react6.useState)(false);
1278
+ const [uncontrolledValue, setUncontrolledValue] = (0, import_react6.useState)(
1018
1279
  startsEmpty ? emptyLabel : showDates ? presetLabel(initShortcut) : defaultValue || "Last 7 days"
1019
1280
  );
1020
- const [uncontrolledDatesLine, setUncontrolledDatesLine] = (0, import_react4.useState)(
1281
+ const [uncontrolledDatesLine, setUncontrolledDatesLine] = (0, import_react6.useState)(
1021
1282
  startsEmpty ? null : dateLine(initRange[0], initRange[1])
1022
1283
  );
1023
- const committed = (0, import_react4.useRef)({ shortcut: initShortcut, start: initRange[0], end: initRange[1], set: !startsEmpty });
1024
- const [cmp, setCmp] = (0, import_react4.useState)(compare?.value);
1025
- const committedCmp = (0, import_react4.useRef)(compare?.value);
1026
- const [appliedCmp, setAppliedCmp] = (0, import_react4.useState)(compare?.value);
1027
- (0, import_react4.useEffect)(() => {
1284
+ const committed = (0, import_react6.useRef)({ shortcut: initShortcut, start: initRange[0], end: initRange[1], set: !startsEmpty });
1285
+ const [cmp, setCmp] = (0, import_react6.useState)(compare?.value);
1286
+ const committedCmp = (0, import_react6.useRef)(compare?.value);
1287
+ const [appliedCmp, setAppliedCmp] = (0, import_react6.useState)(compare?.value);
1288
+ (0, import_react6.useEffect)(() => {
1028
1289
  committedCmp.current = compare?.value;
1029
1290
  setAppliedCmp(compare?.value);
1030
1291
  }, [compare?.value]);
1031
- const compareName = `${(0, import_react4.useId)()}-compare`;
1292
+ const compareName = `${(0, import_react6.useId)()}-compare`;
1032
1293
  const displayValue = controlled ? showDates ? presetLabel(initShortcut) : showValue(controlledValue, initRange[0], initRange[1]) : showValue(uncontrolledValue, committed.current.start, committed.current.end);
1033
1294
  const displayDatesLine = controlled ? dateLine(initRange[0], initRange[1]) : uncontrolledDatesLine;
1034
- const [shortcut, setShortcut] = (0, import_react4.useState)(initShortcut);
1035
- const [start, setStart] = (0, import_react4.useState)(initRange[0]);
1036
- const [end, setEnd] = (0, import_react4.useState)(initRange[1]);
1037
- const [leftMonth, setLeftMonth] = (0, import_react4.useState)(new Date(initRange[0].getFullYear(), initRange[0].getMonth(), 1));
1038
- const ref = (0, import_react4.useRef)(null);
1039
- const triggerRef = (0, import_react4.useRef)(null);
1040
- (0, import_react4.useEffect)(() => {
1295
+ const [shortcut, setShortcut] = (0, import_react6.useState)(initShortcut);
1296
+ const [start, setStart] = (0, import_react6.useState)(initRange[0]);
1297
+ const [end, setEnd] = (0, import_react6.useState)(initRange[1]);
1298
+ const [leftMonth, setLeftMonth] = (0, import_react6.useState)(new Date(initRange[0].getFullYear(), initRange[0].getMonth(), 1));
1299
+ const ref = (0, import_react6.useRef)(null);
1300
+ const triggerRef = (0, import_react6.useRef)(null);
1301
+ (0, import_react6.useEffect)(() => {
1041
1302
  if (controlled || startsEmpty) return;
1042
1303
  onRangeChange?.(committed.current.start, committed.current.end);
1043
1304
  }, []);
1044
- (0, import_react4.useEffect)(() => {
1305
+ (0, import_react6.useEffect)(() => {
1045
1306
  if (!open) return;
1046
1307
  const committedShortcut = controlled ? initShortcut : committed.current.shortcut;
1047
1308
  const committedStart = controlled ? initRange[0] : committed.current.start;
@@ -1108,16 +1369,16 @@ function DateRangeFilter({
1108
1369
  setOpen(false);
1109
1370
  triggerRef.current?.focus();
1110
1371
  };
1111
- const popRef = (0, import_react4.useRef)(null);
1112
- const monthIdBase = (0, import_react4.useId)();
1113
- const [flipBelow, setFlipBelow] = (0, import_react4.useState)(false);
1114
- (0, import_react4.useLayoutEffect)(() => {
1372
+ const popRef = (0, import_react6.useRef)(null);
1373
+ const monthIdBase = (0, import_react6.useId)();
1374
+ const [flipBelow, setFlipBelow] = (0, import_react6.useState)(false);
1375
+ (0, import_react6.useLayoutEffect)(() => {
1115
1376
  if (!open || placement !== "above" || !ref.current || !popRef.current) return;
1116
1377
  setFlipBelow(ref.current.getBoundingClientRect().top < popRef.current.offsetHeight + 16);
1117
1378
  }, [open, placement]);
1118
1379
  const above = placement === "above" && !flipBelow;
1119
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: cn("relative", className), ref, "data-testid": testIdPrefix, children: [
1120
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1380
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: cn("relative", className), ref, "data-testid": testIdPrefix, children: [
1381
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1121
1382
  "button",
1122
1383
  {
1123
1384
  ref: triggerRef,
@@ -1127,22 +1388,22 @@ function DateRangeFilter({
1127
1388
  "aria-expanded": open,
1128
1389
  className: chipTriggerClass(),
1129
1390
  children: [
1130
- icon && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "shrink-0 text-text-tertiary", children: icon }),
1131
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "flex flex-col gap-1 text-left leading-none", children: [
1132
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: showDates && displayDatesLine ? "text-micro leading-none text-text-tertiary" : "text-control-caption leading-none uppercase tracking-wide text-text-tertiary", children: showDates && displayDatesLine ? displayDatesLine : caption }),
1133
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "text-xs leading-none font-medium text-text-primary", children: [
1391
+ icon && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "shrink-0 text-text-tertiary", children: icon }),
1392
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex flex-col gap-1 text-left leading-none", children: [
1393
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: showDates && displayDatesLine ? "text-micro leading-none text-text-tertiary" : "text-control-caption leading-none uppercase tracking-wide text-text-tertiary", children: showDates && displayDatesLine ? displayDatesLine : caption }),
1394
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "text-xs leading-none font-medium text-text-primary", children: [
1134
1395
  displayValue,
1135
- compareLabel(appliedCmp) && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "font-normal text-text-secondary", children: [
1396
+ compareLabel(appliedCmp) && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "font-normal text-text-secondary", children: [
1136
1397
  " \xB7 vs ",
1137
1398
  compareLabel(appliedCmp).toLowerCase()
1138
1399
  ] })
1139
1400
  ] })
1140
1401
  ] }),
1141
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react7.ChevronDown, { size: 14, "aria-hidden": "true", className: `shrink-0 text-text-secondary transition-transform ${open ? "rotate-180" : ""}` })
1402
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react7.ChevronDown, { size: 14, "aria-hidden": "true", className: `shrink-0 text-text-secondary transition-transform ${open ? "rotate-180" : ""}` })
1142
1403
  ]
1143
1404
  }
1144
1405
  ),
1145
- open && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1406
+ open && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1146
1407
  "div",
1147
1408
  {
1148
1409
  "data-testid": testIdPrefix && `${testIdPrefix}-popover`,
@@ -1151,7 +1412,7 @@ function DateRangeFilter({
1151
1412
  role: "dialog",
1152
1413
  "aria-label": "Select date range",
1153
1414
  children: [
1154
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex w-44 shrink-0 flex-col gap-0.5 border-r border-border-default p-2", children: SHORTCUTS.map((s) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1415
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex w-44 shrink-0 flex-col gap-0.5 border-r border-border-default p-2", children: SHORTCUTS.map((s) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1155
1416
  "button",
1156
1417
  {
1157
1418
  type: "button",
@@ -1162,28 +1423,28 @@ function DateRangeFilter({
1162
1423
  },
1163
1424
  s
1164
1425
  )) }),
1165
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-col p-4", children: [
1166
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-end gap-3", children: [
1167
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Field, { label: "Start date", value: start ? showDate(start) : "\u2014" }),
1168
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "pb-2.5 text-text-tertiary", children: "\u2014" }),
1169
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Field, { label: "End date", value: end ? showDate(end) : start ? showDate(start) : "\u2014" })
1426
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-col p-4", children: [
1427
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-end gap-3", children: [
1428
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Field, { label: "Start date", value: start ? showDate(start) : "\u2014" }),
1429
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "pb-2.5 text-text-tertiary", children: "\u2014" }),
1430
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Field, { label: "End date", value: end ? showDate(end) : start ? showDate(start) : "\u2014" })
1170
1431
  ] }),
1171
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "my-4 border-t border-border-default" }),
1172
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex gap-8", children: [0, 1].map((offset) => {
1432
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "my-4 border-t border-border-default" }),
1433
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex gap-8", children: [0, 1].map((offset) => {
1173
1434
  const m = addMonths(leftMonth, offset);
1174
1435
  const grid = monthGrid(m.getFullYear(), m.getMonth());
1175
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "w-63", children: [
1176
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "mb-2 flex items-center justify-between", children: [
1177
- offset === 0 ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(NavBtn, { onClick: () => setLeftMonth(addMonths(leftMonth, -1)), "aria-label": "Previous month", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react7.ChevronLeft, { size: 16 }) }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "h-7 w-7" }),
1178
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { id: `${monthIdBase}-m${offset}`, "aria-live": "polite", className: "text-panel-title font-semibold text-text-primary", children: [
1436
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "w-63", children: [
1437
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "mb-2 flex items-center justify-between", children: [
1438
+ offset === 0 ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(NavBtn, { onClick: () => setLeftMonth(addMonths(leftMonth, -1)), "aria-label": "Previous month", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react7.ChevronLeft, { size: 16 }) }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "h-7 w-7" }),
1439
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { id: `${monthIdBase}-m${offset}`, "aria-live": "polite", className: "text-panel-title font-semibold text-text-primary", children: [
1179
1440
  MONTHS[m.getMonth()],
1180
1441
  " ",
1181
1442
  m.getFullYear()
1182
1443
  ] }),
1183
- offset === 1 ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(NavBtn, { onClick: () => setLeftMonth(addMonths(leftMonth, 1)), "aria-label": "Next month", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react7.ChevronRight, { size: 16 }) }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "h-7 w-7" })
1444
+ offset === 1 ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(NavBtn, { onClick: () => setLeftMonth(addMonths(leftMonth, 1)), "aria-label": "Next month", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react7.ChevronRight, { size: 16 }) }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "h-7 w-7" })
1184
1445
  ] }),
1185
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "grid grid-cols-7", role: "group", "aria-labelledby": `${monthIdBase}-m${offset}`, children: [
1186
- WEEKDAYS.map((w) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { "aria-hidden": "true", className: "flex h-8 items-center justify-center text-xs font-semibold text-text-secondary", children: w }, w)),
1446
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "grid grid-cols-7", role: "group", "aria-labelledby": `${monthIdBase}-m${offset}`, children: [
1447
+ WEEKDAYS.map((w) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { "aria-hidden": "true", className: "flex h-8 items-center justify-center text-xs font-semibold text-text-secondary", children: w }, w)),
1187
1448
  grid.map((d, i) => {
1188
1449
  const inMonth = d.getMonth() === m.getMonth();
1189
1450
  const hasRange = !!(start && end);
@@ -1198,7 +1459,7 @@ function DateRangeFilter({
1198
1459
  else if (end && isEnd) band = "left-0 right-1/2";
1199
1460
  else band = "left-0 right-0";
1200
1461
  }
1201
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1462
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1202
1463
  "button",
1203
1464
  {
1204
1465
  type: "button",
@@ -1207,8 +1468,8 @@ function DateRangeFilter({
1207
1468
  "aria-pressed": endpoint || inRange,
1208
1469
  className: "relative flex h-9 items-center justify-center focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-border-focus",
1209
1470
  children: [
1210
- band && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: `absolute inset-y-1 bg-ai-tint ${band}`, "aria-hidden": "true" }),
1211
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1471
+ band && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: `absolute inset-y-1 bg-ai-tint ${band}`, "aria-hidden": "true" }),
1472
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1212
1473
  "span",
1213
1474
  {
1214
1475
  className: `relative z-10 flex h-8 w-8 items-center justify-center rounded-full text-dense tabular-nums ${endpoint ? "bg-brand-primaryAction font-semibold text-brand-onprimary" : inMonth ? "text-text-primary hover:bg-subtle" : "text-text-tertiary"}`,
@@ -1223,16 +1484,16 @@ function DateRangeFilter({
1223
1484
  ] })
1224
1485
  ] }, offset);
1225
1486
  }) }),
1226
- compare && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("fieldset", { className: "mt-4 border-t border-border-default pt-4", children: [
1227
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("legend", { className: "float-left mb-2 w-full text-xs font-medium text-text-secondary", children: "Compare to" }),
1228
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "clear-left flex flex-col gap-1", children: compare.options.map((o) => {
1487
+ compare && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("fieldset", { className: "mt-4 border-t border-border-default pt-4", children: [
1488
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("legend", { className: "float-left mb-2 w-full text-xs font-medium text-text-secondary", children: "Compare to" }),
1489
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "clear-left flex flex-col gap-1", children: compare.options.map((o) => {
1229
1490
  const on = (cmp ?? compare.value) === o.id;
1230
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1491
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1231
1492
  "label",
1232
1493
  {
1233
1494
  className: `flex cursor-pointer items-center gap-2.5 rounded-control px-2 py-1.5 text-dense transition-colors ${on ? "bg-subtle" : "hover:bg-subtle"}`,
1234
1495
  children: [
1235
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1496
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1236
1497
  "input",
1237
1498
  {
1238
1499
  type: "radio",
@@ -1244,21 +1505,21 @@ function DateRangeFilter({
1244
1505
  className: "h-4 w-4 accent-brand-primaryAction"
1245
1506
  }
1246
1507
  ),
1247
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: `w-44 shrink-0 ${on ? "font-semibold text-text-primary" : "text-text-secondary"}`, children: o.label }),
1248
- start && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "tabular-nums text-text-tertiary", children: (formatted ? showRange : spanLabel)(...compareSpan(start, end ?? start, o.id)) })
1508
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: `w-44 shrink-0 ${on ? "font-semibold text-text-primary" : "text-text-secondary"}`, children: o.label }),
1509
+ start && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "tabular-nums text-text-tertiary", children: (formatted ? showRange : spanLabel)(...compareSpan(start, end ?? start, o.id)) })
1249
1510
  ]
1250
1511
  },
1251
1512
  o.id
1252
1513
  );
1253
1514
  }) })
1254
1515
  ] }),
1255
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "mt-4 flex items-center justify-end gap-2", children: [
1256
- monthly && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "mr-auto text-xs text-text-tertiary", children: "Data is monthly, so ranges cover whole months." }),
1257
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", "data-testid": testIdPrefix && `${testIdPrefix}-cancel`, onClick: () => {
1516
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "mt-4 flex items-center justify-end gap-2", children: [
1517
+ monthly && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "mr-auto text-xs text-text-tertiary", children: "Data is monthly, so ranges cover whole months." }),
1518
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", "data-testid": testIdPrefix && `${testIdPrefix}-cancel`, onClick: () => {
1258
1519
  setOpen(false);
1259
1520
  triggerRef.current?.focus();
1260
1521
  }, className: "rounded-control border border-border-default bg-surface px-5 py-2 text-dense font-semibold text-text-primary transition-colors hover:bg-subtle focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus", children: "Cancel" }),
1261
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", "data-testid": testIdPrefix && `${testIdPrefix}-apply`, onClick: apply, disabled: !canApply, className: "rounded-control bg-brand-primaryAction px-5 py-2 text-dense font-semibold text-brand-onprimary transition-[filter] hover:brightness-110 disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus", children: "Apply" })
1522
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", "data-testid": testIdPrefix && `${testIdPrefix}-apply`, onClick: apply, disabled: !canApply, className: "rounded-control bg-brand-primaryAction px-5 py-2 text-dense font-semibold text-brand-onprimary transition-[filter] hover:brightness-110 disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus", children: "Apply" })
1262
1523
  ] })
1263
1524
  ] })
1264
1525
  ]
@@ -1267,19 +1528,19 @@ function DateRangeFilter({
1267
1528
  ] });
1268
1529
  }
1269
1530
  function Field({ label, value }) {
1270
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-col gap-1.5", children: [
1271
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-xs font-medium text-text-secondary", children: label }),
1272
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex h-10 min-w-35 items-center rounded-control border border-border-strong bg-input px-3 text-sm font-medium text-text-primary", children: value })
1531
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-col gap-1.5", children: [
1532
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-xs font-medium text-text-secondary", children: label }),
1533
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex h-10 min-w-35 items-center rounded-control border border-border-strong bg-input px-3 text-sm font-medium text-text-primary", children: value })
1273
1534
  ] });
1274
1535
  }
1275
1536
  function NavBtn({ children, onClick, ...rest }) {
1276
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", onClick, className: "flex h-7 w-7 items-center justify-center rounded-full text-text-secondary transition-colors hover:bg-subtle hover:text-text-primary focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus", ...rest, children });
1537
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", onClick, className: "flex h-7 w-7 items-center justify-center rounded-full text-text-secondary transition-colors hover:bg-subtle hover:text-text-primary focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus", ...rest, children });
1277
1538
  }
1278
1539
 
1279
1540
  // src/SearchBar.tsx
1280
- var import_react5 = require("react");
1541
+ var import_react7 = require("react");
1281
1542
  var import_lucide_react8 = require("lucide-react");
1282
- var import_jsx_runtime10 = require("react/jsx-runtime");
1543
+ var import_jsx_runtime11 = require("react/jsx-runtime");
1283
1544
  var HEIGHT = { sm: "h-8", md: "h-10", lg: "h-11" };
1284
1545
  var DEFAULT_SEARCH_MATCH = { mode: "anyWord", wordJoin: "Or" };
1285
1546
  var MODE_LABEL = {
@@ -1305,7 +1566,7 @@ function mergeAdCodes(existing, incoming) {
1305
1566
  function slug3(value) {
1306
1567
  return value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)/g, "");
1307
1568
  }
1308
- var SearchBar = (0, import_react5.forwardRef)(function SearchBar2({
1569
+ var SearchBar = (0, import_react7.forwardRef)(function SearchBar2({
1309
1570
  placeholder = "Search\u2026",
1310
1571
  value,
1311
1572
  onChange,
@@ -1322,22 +1583,22 @@ var SearchBar = (0, import_react5.forwardRef)(function SearchBar2({
1322
1583
  className,
1323
1584
  testIdPrefix
1324
1585
  }, forwardedRef) {
1325
- const [open, setOpen] = (0, import_react5.useState)(false);
1326
- const ref = (0, import_react5.useRef)(null);
1327
- const input = (0, import_react5.useRef)(null);
1586
+ const [open, setOpen] = (0, import_react7.useState)(false);
1587
+ const ref = (0, import_react7.useRef)(null);
1588
+ const input = (0, import_react7.useRef)(null);
1328
1589
  const setInput = (el) => {
1329
1590
  input.current = el;
1330
1591
  if (typeof forwardedRef === "function") forwardedRef(el);
1331
1592
  else if (forwardedRef) forwardedRef.current = el;
1332
1593
  };
1333
- const [codesOpen, setCodesOpen] = (0, import_react5.useState)(false);
1334
- const codesRef = (0, import_react5.useRef)(null);
1335
- const codesPopover = (0, import_react5.useRef)(null);
1336
- const refocus = (0, import_react5.useRef)(null);
1594
+ const [codesOpen, setCodesOpen] = (0, import_react7.useState)(false);
1595
+ const codesRef = (0, import_react7.useRef)(null);
1596
+ const codesPopover = (0, import_react7.useRef)(null);
1597
+ const refocus = (0, import_react7.useRef)(null);
1337
1598
  const adCodeMode = variant === "filterable" && matchValue?.mode === "adCode" && !!onAdCodesChange;
1338
1599
  const matchedCount = adCodes.filter((c) => isAdCodeMatched?.(c)).length;
1339
1600
  const hasMisses = !!isAdCodeMatched && matchedCount < adCodes.length;
1340
- (0, import_react5.useEffect)(() => {
1601
+ (0, import_react7.useEffect)(() => {
1341
1602
  if (!codesOpen) return;
1342
1603
  const onKey = (e) => {
1343
1604
  if (e.key !== "Escape") return;
@@ -1354,7 +1615,7 @@ var SearchBar = (0, import_react5.forwardRef)(function SearchBar2({
1354
1615
  window.removeEventListener("mousedown", onClick);
1355
1616
  };
1356
1617
  }, [codesOpen]);
1357
- (0, import_react5.useLayoutEffect)(() => {
1618
+ (0, import_react7.useLayoutEffect)(() => {
1358
1619
  const i = refocus.current;
1359
1620
  if (i === null) return;
1360
1621
  refocus.current = null;
@@ -1367,7 +1628,7 @@ var SearchBar = (0, import_react5.forwardRef)(function SearchBar2({
1367
1628
  if (!next.length) setCodesOpen(false);
1368
1629
  onAdCodesChange?.(next);
1369
1630
  };
1370
- (0, import_react5.useEffect)(() => {
1631
+ (0, import_react7.useEffect)(() => {
1371
1632
  if (!open) return;
1372
1633
  const onKey = (e) => e.key === "Escape" && setOpen(false);
1373
1634
  const onClick = (e) => {
@@ -1381,7 +1642,7 @@ var SearchBar = (0, import_react5.forwardRef)(function SearchBar2({
1381
1642
  };
1382
1643
  }, [open]);
1383
1644
  const showMatch = variant === "filterable" && matchValue;
1384
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1645
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1385
1646
  "div",
1386
1647
  {
1387
1648
  className: cn(
@@ -1394,8 +1655,8 @@ var SearchBar = (0, import_react5.forwardRef)(function SearchBar2({
1394
1655
  ),
1395
1656
  "data-testid": testIdPrefix,
1396
1657
  children: [
1397
- scope && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ScopeMenu, { scope, onOpenChange: onScopeOpenChange, testIdPrefix }),
1398
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1658
+ scope && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ScopeMenu, { scope, onOpenChange: onScopeOpenChange, testIdPrefix }),
1659
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1399
1660
  "div",
1400
1661
  {
1401
1662
  ref: codesRef,
@@ -1407,8 +1668,8 @@ var SearchBar = (0, import_react5.forwardRef)(function SearchBar2({
1407
1668
  }
1408
1669
  },
1409
1670
  children: [
1410
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react8.Search, { size: 15, "aria-hidden": "true", className: "shrink-0 text-text-tertiary" }),
1411
- adCodeMode && adCodes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1671
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react8.Search, { size: 15, "aria-hidden": "true", className: "shrink-0 text-text-tertiary" }),
1672
+ adCodeMode && adCodes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1412
1673
  "span",
1413
1674
  {
1414
1675
  className: cn(
@@ -1416,7 +1677,7 @@ var SearchBar = (0, import_react5.forwardRef)(function SearchBar2({
1416
1677
  hasMisses ? "bg-status-danger/15 text-text-danger" : "bg-subtle text-text-primary"
1417
1678
  ),
1418
1679
  children: [
1419
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1680
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1420
1681
  "button",
1421
1682
  {
1422
1683
  type: "button",
@@ -1426,12 +1687,12 @@ var SearchBar = (0, import_react5.forwardRef)(function SearchBar2({
1426
1687
  "data-testid": testIdPrefix && `${testIdPrefix}-ad-codes`,
1427
1688
  className: "inline-flex items-center gap-1 rounded-control focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus",
1428
1689
  children: [
1429
- hasMisses && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react8.AlertCircle, { size: 13, "aria-hidden": "true" }),
1690
+ hasMisses && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react8.AlertCircle, { size: 13, "aria-hidden": "true" }),
1430
1691
  hasMisses ? `${matchedCount} of ${adCodes.length} matched` : adCodes.length === 1 ? adCodes[0] : `${adCodes.length} Ad Codes`
1431
1692
  ]
1432
1693
  }
1433
1694
  ),
1434
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1695
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1435
1696
  "button",
1436
1697
  {
1437
1698
  type: "button",
@@ -1439,13 +1700,13 @@ var SearchBar = (0, import_react5.forwardRef)(function SearchBar2({
1439
1700
  onClick: () => updateCodes([], -1),
1440
1701
  "data-testid": testIdPrefix && `${testIdPrefix}-ad-codes-clear`,
1441
1702
  className: "inline-flex rounded-full p-0.5 hover:bg-surface focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus",
1442
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react8.X, { size: 12, "aria-hidden": "true" })
1703
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react8.X, { size: 12, "aria-hidden": "true" })
1443
1704
  }
1444
1705
  )
1445
1706
  ]
1446
1707
  }
1447
1708
  ),
1448
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1709
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1449
1710
  "input",
1450
1711
  {
1451
1712
  ref: setInput,
@@ -1466,7 +1727,7 @@ var SearchBar = (0, import_react5.forwardRef)(function SearchBar2({
1466
1727
  className: "min-w-0 flex-1 bg-transparent text-dense text-text-primary outline-hidden placeholder:text-text-tertiary"
1467
1728
  }
1468
1729
  ),
1469
- adCodeMode && codesOpen && adCodes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1730
+ adCodeMode && codesOpen && adCodes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1470
1731
  "div",
1471
1732
  {
1472
1733
  ref: codesPopover,
@@ -1475,10 +1736,10 @@ var SearchBar = (0, import_react5.forwardRef)(function SearchBar2({
1475
1736
  "data-testid": testIdPrefix && `${testIdPrefix}-ad-codes-popover`,
1476
1737
  className: "absolute right-0 top-full z-50 mt-2 w-110 max-w-[90vw] cursor-auto rounded-card border border-border-default bg-surface p-3 shadow-overlay",
1477
1738
  children: [
1478
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "mb-2 text-xs font-medium text-text-secondary", children: isAdCodeMatched ? `${matchedCount} ${matchedCount === 1 ? "ad was" : "ads were"} found` : `${adCodes.length} ${adCodes.length === 1 ? "ad code" : "ad codes"}` }),
1479
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("ul", { className: "flex max-h-50 flex-wrap gap-2 overflow-y-auto p-0.5", children: adCodes.map((code, i) => {
1739
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "mb-2 text-xs font-medium text-text-secondary", children: isAdCodeMatched ? `${matchedCount} ${matchedCount === 1 ? "ad was" : "ads were"} found` : `${adCodes.length} ${adCodes.length === 1 ? "ad code" : "ad codes"}` }),
1740
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("ul", { className: "flex max-h-50 flex-wrap gap-2 overflow-y-auto p-0.5", children: adCodes.map((code, i) => {
1480
1741
  const missed = !!isAdCodeMatched && !isAdCodeMatched(code);
1481
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1742
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1482
1743
  "li",
1483
1744
  {
1484
1745
  className: cn(
@@ -1487,8 +1748,8 @@ var SearchBar = (0, import_react5.forwardRef)(function SearchBar2({
1487
1748
  ),
1488
1749
  children: [
1489
1750
  code,
1490
- missed && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "sr-only", children: " (not found)" }),
1491
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1751
+ missed && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "sr-only", children: " (not found)" }),
1752
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1492
1753
  "button",
1493
1754
  {
1494
1755
  type: "button",
@@ -1497,7 +1758,7 @@ var SearchBar = (0, import_react5.forwardRef)(function SearchBar2({
1497
1758
  onClick: () => updateCodes(adCodes.filter((c) => c !== code), i),
1498
1759
  "data-testid": testIdPrefix && `${testIdPrefix}-ad-code-remove-${slug3(code)}`,
1499
1760
  className: "inline-flex rounded-full p-0.5 hover:bg-surface focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus",
1500
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react8.X, { size: 13, "aria-hidden": "true" })
1761
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react8.X, { size: 13, "aria-hidden": "true" })
1501
1762
  }
1502
1763
  )
1503
1764
  ]
@@ -1505,7 +1766,7 @@ var SearchBar = (0, import_react5.forwardRef)(function SearchBar2({
1505
1766
  code
1506
1767
  );
1507
1768
  }) }),
1508
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "mt-3 flex justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1769
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "mt-3 flex justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1509
1770
  "button",
1510
1771
  {
1511
1772
  type: "button",
@@ -1518,11 +1779,11 @@ var SearchBar = (0, import_react5.forwardRef)(function SearchBar2({
1518
1779
  children: "Search"
1519
1780
  }
1520
1781
  ) }),
1521
- onDownloadAdCodes && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "mt-3 flex items-start gap-2 rounded-control border border-border-default px-3 py-2.5 text-card-title text-text-secondary", children: [
1522
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react8.AlertCircle, { size: 16, "aria-hidden": "true", className: "mt-0.5 shrink-0 text-text-tertiary" }),
1523
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
1782
+ onDownloadAdCodes && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "mt-3 flex items-start gap-2 rounded-control border border-border-default px-3 py-2.5 text-card-title text-text-secondary", children: [
1783
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react8.AlertCircle, { size: 16, "aria-hidden": "true", className: "mt-0.5 shrink-0 text-text-tertiary" }),
1784
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { children: [
1524
1785
  hasMisses && "Some ad codes in your search could not be matched. ",
1525
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1786
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1526
1787
  "button",
1527
1788
  {
1528
1789
  type: "button",
@@ -1542,7 +1803,7 @@ var SearchBar = (0, import_react5.forwardRef)(function SearchBar2({
1542
1803
  ]
1543
1804
  }
1544
1805
  ),
1545
- value && onChange && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1806
+ value && onChange && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1546
1807
  "button",
1547
1808
  {
1548
1809
  type: "button",
@@ -1553,7 +1814,7 @@ var SearchBar = (0, import_react5.forwardRef)(function SearchBar2({
1553
1814
  "aria-label": "Clear search",
1554
1815
  "data-testid": testIdPrefix && `${testIdPrefix}-clear`,
1555
1816
  className: "mr-1.5 flex size-6 shrink-0 items-center justify-center self-center rounded-control text-text-tertiary hover:bg-subtle hover:text-text-primary focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus",
1556
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react8.X, { size: 14, "aria-hidden": "true" })
1817
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react8.X, { size: 14, "aria-hidden": "true" })
1557
1818
  }
1558
1819
  ),
1559
1820
  showMatch && // border-border-default, not the bare `border-border` both source
@@ -1567,8 +1828,8 @@ var SearchBar = (0, import_react5.forwardRef)(function SearchBar2({
1567
1828
  // token package (insights-studio-prototype's own src/index.css;
1568
1829
  // mr-clientapps' own tailwind.config.ts `colors.border.DEFAULT`) --
1569
1830
  // an alias this shared component can't rely on existing.
1570
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "relative shrink-0 border-l border-border-default", ref, children: [
1571
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1831
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "relative shrink-0 border-l border-border-default", ref, children: [
1832
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1572
1833
  "button",
1573
1834
  {
1574
1835
  type: "button",
@@ -1579,7 +1840,7 @@ var SearchBar = (0, import_react5.forwardRef)(function SearchBar2({
1579
1840
  className: "flex h-full items-center gap-1 px-2.5 text-dense font-medium text-text-primary transition-colors hover:bg-subtle",
1580
1841
  children: [
1581
1842
  matchValue.mode === "anyWord" ? `${MODE_LABEL.anyWord} (${matchValue.wordJoin})` : MODE_LABEL[matchValue.mode],
1582
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1843
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1583
1844
  import_lucide_react8.ChevronDown,
1584
1845
  {
1585
1846
  size: 14,
@@ -1590,25 +1851,25 @@ var SearchBar = (0, import_react5.forwardRef)(function SearchBar2({
1590
1851
  ]
1591
1852
  }
1592
1853
  ),
1593
- open && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1854
+ open && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1594
1855
  "div",
1595
1856
  {
1596
1857
  role: "dialog",
1597
1858
  "aria-label": "Search match type",
1598
1859
  "data-testid": testIdPrefix && `${testIdPrefix}-mode-popover`,
1599
1860
  className: "absolute right-0 top-full mt-2 z-50 w-100 rounded-card border border-border-default bg-surface p-3 shadow-overlay",
1600
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { role: "radiogroup", "aria-label": "Search match type", className: "flex flex-col", children: [
1601
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1861
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { role: "radiogroup", "aria-label": "Search match type", className: "flex flex-col", children: [
1862
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1602
1863
  ModeRow,
1603
1864
  {
1604
1865
  title: "Any Word Text Search",
1605
1866
  selected: matchValue.mode === "anyWord",
1606
1867
  onSelect: () => onMatchChange?.({ mode: "anyWord", wordJoin: matchValue.wordJoin }),
1607
1868
  testId: testIdPrefix && `${testIdPrefix}-mode-anyWord`,
1608
- description: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx_runtime10.Fragment, { children: "Find creatives that contain your keyword(s) using an \u201COr\u201D (match any) or \u201CAnd\u201D (match all) conditional in any order." }),
1869
+ description: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_jsx_runtime11.Fragment, { children: "Find creatives that contain your keyword(s) using an \u201COr\u201D (match any) or \u201CAnd\u201D (match all) conditional in any order." }),
1609
1870
  infoText: "The Or/And choice applies only when Any Word is the active search mode.",
1610
- extra: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex items-center gap-3", children: [
1611
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1871
+ extra: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "flex items-center gap-3", children: [
1872
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1612
1873
  RadioOption,
1613
1874
  {
1614
1875
  label: "Or",
@@ -1617,7 +1878,7 @@ var SearchBar = (0, import_react5.forwardRef)(function SearchBar2({
1617
1878
  testId: testIdPrefix && `${testIdPrefix}-word-join-or`
1618
1879
  }
1619
1880
  ),
1620
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1881
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1621
1882
  RadioOption,
1622
1883
  {
1623
1884
  label: "And",
@@ -1629,8 +1890,8 @@ var SearchBar = (0, import_react5.forwardRef)(function SearchBar2({
1629
1890
  ] })
1630
1891
  }
1631
1892
  ),
1632
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Divider, {}),
1633
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1893
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Divider, {}),
1894
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1634
1895
  ModeRow,
1635
1896
  {
1636
1897
  title: "Exact Match Text Search",
@@ -1641,8 +1902,8 @@ var SearchBar = (0, import_react5.forwardRef)(function SearchBar2({
1641
1902
  infoText: "Keywords are matched as a single contiguous phrase, in the order you typed them."
1642
1903
  }
1643
1904
  ),
1644
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Divider, {}),
1645
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1905
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Divider, {}),
1906
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1646
1907
  ModeRow,
1647
1908
  {
1648
1909
  title: "Contextual Search",
@@ -1654,8 +1915,8 @@ var SearchBar = (0, import_react5.forwardRef)(function SearchBar2({
1654
1915
  infoText: "Uses semantic matching, so results can include related terms even when the exact keyword isn't present."
1655
1916
  }
1656
1917
  ),
1657
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Divider, {}),
1658
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1918
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Divider, {}),
1919
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1659
1920
  ModeRow,
1660
1921
  {
1661
1922
  title: "Ad Code Search",
@@ -1676,7 +1937,7 @@ var SearchBar = (0, import_react5.forwardRef)(function SearchBar2({
1676
1937
  });
1677
1938
  SearchBar.displayName = "SearchBar";
1678
1939
  function Divider() {
1679
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "my-2.5 border-t border-border-default", "aria-hidden": "true" });
1940
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "my-2.5 border-t border-border-default", "aria-hidden": "true" });
1680
1941
  }
1681
1942
  function ModeRow({
1682
1943
  title,
@@ -1688,17 +1949,17 @@ function ModeRow({
1688
1949
  onSelect,
1689
1950
  testId
1690
1951
  }) {
1691
- const descId = (0, import_react5.useId)();
1692
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1952
+ const descId = (0, import_react7.useId)();
1953
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1693
1954
  "div",
1694
1955
  {
1695
1956
  onClick: onSelect,
1696
1957
  className: "flex cursor-pointer flex-col items-stretch gap-1 rounded-control p-1.5 text-left transition-colors hover:bg-subtle",
1697
1958
  children: [
1698
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
1699
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
1700
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex items-center gap-1", children: [
1701
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1959
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
1960
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
1961
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "flex items-center gap-1", children: [
1962
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1702
1963
  "button",
1703
1964
  {
1704
1965
  type: "button",
@@ -1714,14 +1975,14 @@ function ModeRow({
1714
1975
  children: title
1715
1976
  }
1716
1977
  ),
1717
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(RowInfoTip, { text: infoText })
1978
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(RowInfoTip, { text: infoText })
1718
1979
  ] }),
1719
- badge && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Badge, { kind: "category", children: badge }),
1980
+ badge && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Badge, { kind: "category", children: badge }),
1720
1981
  extra
1721
1982
  ] }),
1722
- selected && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react8.Check, { size: 16, strokeWidth: 2.5, "aria-hidden": "true", className: "shrink-0 text-brand-primaryAction" })
1983
+ selected && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react8.Check, { size: 16, strokeWidth: 2.5, "aria-hidden": "true", className: "shrink-0 text-brand-primaryAction" })
1723
1984
  ] }),
1724
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { id: descId, className: "block text-xs leading-snug text-text-secondary", children: description })
1985
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { id: descId, className: "block text-xs leading-snug text-text-secondary", children: description })
1725
1986
  ]
1726
1987
  }
1727
1988
  );
@@ -1732,7 +1993,7 @@ function RadioOption({
1732
1993
  onSelect,
1733
1994
  testId
1734
1995
  }) {
1735
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1996
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1736
1997
  "button",
1737
1998
  {
1738
1999
  type: "button",
@@ -1745,14 +2006,14 @@ function RadioOption({
1745
2006
  "aria-checked": checked,
1746
2007
  className: "flex items-center gap-1.5 text-dense font-medium text-text-primary focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-border-focus",
1747
2008
  children: [
1748
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2009
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1749
2010
  "span",
1750
2011
  {
1751
2012
  className: cn(
1752
2013
  "flex h-4 w-4 shrink-0 items-center justify-center rounded-full border-2 transition-colors",
1753
2014
  checked ? "border-brand-primaryAction" : "border-border-interactive"
1754
2015
  ),
1755
- children: checked && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "h-2 w-2 rounded-full bg-brand-primaryAction" })
2016
+ children: checked && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "h-2 w-2 rounded-full bg-brand-primaryAction" })
1756
2017
  }
1757
2018
  ),
1758
2019
  label
@@ -1761,10 +2022,10 @@ function RadioOption({
1761
2022
  );
1762
2023
  }
1763
2024
  function RowInfoTip({ text }) {
1764
- const [open, setOpen] = (0, import_react5.useState)(false);
1765
- const id = (0, import_react5.useId)();
1766
- const ref = (0, import_react5.useRef)(null);
1767
- (0, import_react5.useEffect)(() => {
2025
+ const [open, setOpen] = (0, import_react7.useState)(false);
2026
+ const id = (0, import_react7.useId)();
2027
+ const ref = (0, import_react7.useRef)(null);
2028
+ (0, import_react7.useEffect)(() => {
1768
2029
  if (!open) return;
1769
2030
  const onDown = (e) => {
1770
2031
  if (ref.current && !ref.current.contains(e.target)) setOpen(false);
@@ -1772,8 +2033,8 @@ function RowInfoTip({ text }) {
1772
2033
  window.addEventListener("mousedown", onDown);
1773
2034
  return () => window.removeEventListener("mousedown", onDown);
1774
2035
  }, [open]);
1775
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "relative inline-flex shrink-0 items-center", ref, children: [
1776
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2036
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "relative inline-flex shrink-0 items-center", ref, children: [
2037
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1777
2038
  "button",
1778
2039
  {
1779
2040
  type: "button",
@@ -1785,10 +2046,10 @@ function RowInfoTip({ text }) {
1785
2046
  "aria-expanded": open,
1786
2047
  "aria-describedby": id,
1787
2048
  className: "-m-1.5 inline-flex size-6 items-center justify-center rounded-control text-text-tertiary transition-colors hover:text-text-primary focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus",
1788
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react8.AlertCircle, { size: 13, "aria-hidden": "true" })
2049
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react8.AlertCircle, { size: 13, "aria-hidden": "true" })
1789
2050
  }
1790
2051
  ),
1791
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2052
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1792
2053
  "span",
1793
2054
  {
1794
2055
  id,
@@ -1804,11 +2065,11 @@ function ScopeMenu({
1804
2065
  onOpenChange,
1805
2066
  testIdPrefix
1806
2067
  }) {
1807
- const [open, setOpenState] = (0, import_react5.useState)(false);
1808
- const ref = (0, import_react5.useRef)(null);
1809
- const trigger = (0, import_react5.useRef)(null);
1810
- const list = (0, import_react5.useRef)(null);
1811
- const listId = (0, import_react5.useId)();
2068
+ const [open, setOpenState] = (0, import_react7.useState)(false);
2069
+ const ref = (0, import_react7.useRef)(null);
2070
+ const trigger = (0, import_react7.useRef)(null);
2071
+ const list = (0, import_react7.useRef)(null);
2072
+ const listId = (0, import_react7.useId)();
1812
2073
  const setOpen = (next) => {
1813
2074
  setOpenState(next);
1814
2075
  onOpenChange?.(next);
@@ -1817,7 +2078,7 @@ function ScopeMenu({
1817
2078
  setOpen(false);
1818
2079
  if (refocus) trigger.current?.focus();
1819
2080
  };
1820
- (0, import_react5.useEffect)(() => {
2081
+ (0, import_react7.useEffect)(() => {
1821
2082
  if (!open) return;
1822
2083
  list.current?.querySelector('[aria-selected="true"]')?.focus();
1823
2084
  const onClick = (e) => {
@@ -1843,8 +2104,8 @@ function ScopeMenu({
1843
2104
  close(false);
1844
2105
  }
1845
2106
  };
1846
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "relative flex shrink-0 border-r border-border-default", ref, children: [
1847
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
2107
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "relative flex shrink-0 border-r border-border-default", ref, children: [
2108
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1848
2109
  "button",
1849
2110
  {
1850
2111
  ref: trigger,
@@ -1858,7 +2119,7 @@ function ScopeMenu({
1858
2119
  className: "flex h-full items-center gap-1.5 rounded-l-control px-2.5 text-dense font-semibold text-text-primary transition-colors hover:bg-subtle focus-visible:outline-solid focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-border-focus",
1859
2120
  children: [
1860
2121
  scope.value,
1861
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2122
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1862
2123
  import_lucide_react8.ChevronDown,
1863
2124
  {
1864
2125
  size: 13,
@@ -1869,7 +2130,7 @@ function ScopeMenu({
1869
2130
  ]
1870
2131
  }
1871
2132
  ),
1872
- open && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
2133
+ open && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1873
2134
  "div",
1874
2135
  {
1875
2136
  ref: list,
@@ -1880,13 +2141,13 @@ function ScopeMenu({
1880
2141
  "data-testid": testIdPrefix && `${testIdPrefix}-scope-popover`,
1881
2142
  className: "absolute left-0 top-[calc(100%+6px)] z-50 min-w-50 max-w-72 rounded-card border border-border-default bg-surface py-1 shadow-overlay",
1882
2143
  children: [
1883
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "px-3 pb-1.5 pt-1", "aria-hidden": "true", children: [
1884
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-micro font-semibold uppercase tracking-wide text-text-tertiary", children: scope.label }),
1885
- scope.info && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "mt-0.5 text-xs text-text-secondary", children: scope.info })
2144
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "px-3 pb-1.5 pt-1", "aria-hidden": "true", children: [
2145
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-micro font-semibold uppercase tracking-wide text-text-tertiary", children: scope.label }),
2146
+ scope.info && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "mt-0.5 text-xs text-text-secondary", children: scope.info })
1886
2147
  ] }),
1887
2148
  scope.options.map((o) => {
1888
2149
  const sel = o === scope.value;
1889
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
2150
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1890
2151
  "button",
1891
2152
  {
1892
2153
  type: "button",
@@ -1903,7 +2164,7 @@ function ScopeMenu({
1903
2164
  sel ? "font-semibold text-text-primary" : "text-text-secondary"
1904
2165
  ),
1905
2166
  children: [
1906
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react8.Check, { size: 14, "aria-hidden": "true", className: cn("shrink-0 text-brand-primaryAction", !sel && "invisible") }),
2167
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react8.Check, { size: 14, "aria-hidden": "true", className: cn("shrink-0 text-brand-primaryAction", !sel && "invisible") }),
1907
2168
  o
1908
2169
  ]
1909
2170
  },
@@ -1917,9 +2178,9 @@ function ScopeMenu({
1917
2178
  }
1918
2179
 
1919
2180
  // src/SectionRail.tsx
1920
- var import_react6 = require("react");
2181
+ var import_react8 = require("react");
1921
2182
  var import_lucide_react9 = require("lucide-react");
1922
- var import_jsx_runtime11 = require("react/jsx-runtime");
2183
+ var import_jsx_runtime12 = require("react/jsx-runtime");
1923
2184
  function SectionRail({
1924
2185
  title,
1925
2186
  titleSerif,
@@ -1930,24 +2191,24 @@ function SectionRail({
1930
2191
  className,
1931
2192
  testIdPrefix
1932
2193
  }) {
1933
- const scrollRef = (0, import_react6.useRef)(null);
2194
+ const scrollRef = (0, import_react8.useRef)(null);
1934
2195
  const scroll = (direction) => {
1935
2196
  scrollRef.current?.scrollBy({ left: direction * 320, behavior: "smooth" });
1936
2197
  };
1937
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("section", { className: cn("flex flex-col gap-4", className), "data-testid": testIdPrefix, children: [
1938
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("header", { className: "flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between", children: [
1939
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { children: [
1940
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2198
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("section", { className: cn("flex flex-col gap-4", className), "data-testid": testIdPrefix, children: [
2199
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("header", { className: "flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between", children: [
2200
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { children: [
2201
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1941
2202
  "h2",
1942
2203
  {
1943
2204
  className: titleSerif ? "font-serif text-xl font-normal tracking-tight text-text-primary" : "text-xl font-medium tracking-tight text-text-primary",
1944
2205
  children: title
1945
2206
  }
1946
2207
  ),
1947
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "mt-1 text-sm text-text-secondary", children: subtitle })
2208
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "mt-1 text-sm text-text-secondary", children: subtitle })
1948
2209
  ] }),
1949
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-2", children: [
1950
- viewAllLabel && viewAllHref && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
2210
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-2", children: [
2211
+ viewAllLabel && viewAllHref && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1951
2212
  "a",
1952
2213
  {
1953
2214
  href: viewAllHref,
@@ -1958,29 +2219,29 @@ function SectionRail({
1958
2219
  ]
1959
2220
  }
1960
2221
  ),
1961
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2222
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1962
2223
  "button",
1963
2224
  {
1964
2225
  type: "button",
1965
2226
  onClick: () => scroll(-1),
1966
2227
  "aria-label": "Previous",
1967
2228
  className: "hidden h-10 w-10 items-center justify-center rounded-control border border-border-default text-text-secondary transition-colors hover:bg-subtle hover:text-text-primary focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus sm:flex lg:hidden",
1968
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react9.ChevronLeft, { size: 16 })
2229
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react9.ChevronLeft, { size: 16 })
1969
2230
  }
1970
2231
  ),
1971
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2232
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1972
2233
  "button",
1973
2234
  {
1974
2235
  type: "button",
1975
2236
  onClick: () => scroll(1),
1976
2237
  "aria-label": "Next",
1977
2238
  className: "hidden h-10 w-10 items-center justify-center rounded-control border border-border-default text-text-secondary transition-colors hover:bg-subtle hover:text-text-primary focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus sm:flex lg:hidden",
1978
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react9.ChevronRight, { size: 16 })
2239
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react9.ChevronRight, { size: 16 })
1979
2240
  }
1980
2241
  )
1981
2242
  ] })
1982
2243
  ] }),
1983
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2244
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1984
2245
  "div",
1985
2246
  {
1986
2247
  ref: scrollRef,
@@ -1992,15 +2253,15 @@ function SectionRail({
1992
2253
  }
1993
2254
 
1994
2255
  // src/DataScopeFilter.tsx
1995
- var import_react7 = require("react");
2256
+ var import_react9 = require("react");
1996
2257
  var import_lucide_react10 = require("lucide-react");
1997
- var import_jsx_runtime12 = require("react/jsx-runtime");
2258
+ var import_jsx_runtime13 = require("react/jsx-runtime");
1998
2259
  var FINAL_ONLY_TEXT = "Trims time periods to data that has finalized across the selected media formats. Some formats (e.g. Network TV and Cinema) finalize later, so the most recent periods may still change. Turn on for stable, report-ready numbers.";
1999
2260
  function DataScopeFilter({ value, onChange, align = "right", className, testIdPrefix }) {
2000
- const [open, setOpen] = (0, import_react7.useState)(false);
2001
- const ref = (0, import_react7.useRef)(null);
2261
+ const [open, setOpen] = (0, import_react9.useState)(false);
2262
+ const ref = (0, import_react9.useRef)(null);
2002
2263
  const display = value ? "Final only" : "All";
2003
- (0, import_react7.useEffect)(() => {
2264
+ (0, import_react9.useEffect)(() => {
2004
2265
  if (!open) return;
2005
2266
  const onDown = (e) => {
2006
2267
  if (ref.current && !ref.current.contains(e.target)) setOpen(false);
@@ -2017,8 +2278,8 @@ function DataScopeFilter({ value, onChange, align = "right", className, testIdPr
2017
2278
  onChange(v);
2018
2279
  setOpen(false);
2019
2280
  };
2020
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: cn("relative", className), ref, "data-testid": testIdPrefix, children: [
2021
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2281
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: cn("relative", className), ref, "data-testid": testIdPrefix, children: [
2282
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
2022
2283
  "button",
2023
2284
  {
2024
2285
  type: "button",
@@ -2027,8 +2288,8 @@ function DataScopeFilter({ value, onChange, align = "right", className, testIdPr
2027
2288
  "data-testid": testIdPrefix && `${testIdPrefix}-trigger`,
2028
2289
  className: chipTriggerClass(),
2029
2290
  children: [
2030
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ChipContent, { caption: "Data", value: display }),
2031
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2291
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ChipContent, { caption: "Data", value: display }),
2292
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2032
2293
  import_lucide_react10.ChevronDown,
2033
2294
  {
2034
2295
  size: 14,
@@ -2039,7 +2300,7 @@ function DataScopeFilter({ value, onChange, align = "right", className, testIdPr
2039
2300
  ]
2040
2301
  }
2041
2302
  ),
2042
- open && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2303
+ open && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
2043
2304
  "div",
2044
2305
  {
2045
2306
  role: "group",
@@ -2050,8 +2311,8 @@ function DataScopeFilter({ value, onChange, align = "right", className, testIdPr
2050
2311
  align === "right" ? "right-0" : "left-0"
2051
2312
  ),
2052
2313
  children: [
2053
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Option, { label: "All", selected: !value, onClick: () => choose(false) }),
2054
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Option, { label: "Final only", selected: value, onClick: () => choose(true), hint: FINAL_ONLY_TEXT })
2314
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Option, { label: "All", selected: !value, onClick: () => choose(false) }),
2315
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Option, { label: "Final only", selected: value, onClick: () => choose(true), hint: FINAL_ONLY_TEXT })
2055
2316
  ]
2056
2317
  }
2057
2318
  )
@@ -2063,7 +2324,7 @@ function Option({
2063
2324
  onClick,
2064
2325
  hint
2065
2326
  }) {
2066
- const option = /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2327
+ const option = /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
2067
2328
  "button",
2068
2329
  {
2069
2330
  type: "button",
@@ -2075,33 +2336,33 @@ function Option({
2075
2336
  selected ? "font-semibold text-text-primary" : "text-text-secondary"
2076
2337
  ),
2077
2338
  children: [
2078
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react10.Check, { size: 14, "aria-hidden": "true", className: cn("shrink-0 text-brand-primaryAction", !selected && "invisible") }),
2339
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react10.Check, { size: 14, "aria-hidden": "true", className: cn("shrink-0 text-brand-primaryAction", !selected && "invisible") }),
2079
2340
  label
2080
2341
  ]
2081
2342
  }
2082
2343
  );
2083
2344
  if (!hint) return option;
2084
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-2 pr-2.5", children: [
2345
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-2 pr-2.5", children: [
2085
2346
  option,
2086
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(InfoTip, { text: hint, trigger: "hover", label: `About ${label}` })
2347
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(InfoTip, { text: hint, trigger: "hover", label: `About ${label}` })
2087
2348
  ] });
2088
2349
  }
2089
2350
 
2090
2351
  // src/SelectFilter.tsx
2091
- var import_react8 = require("react");
2092
- var import_react_dom2 = require("react-dom");
2352
+ var import_react10 = require("react");
2353
+ var import_react_dom3 = require("react-dom");
2093
2354
  var import_lucide_react11 = require("lucide-react");
2094
2355
 
2095
2356
  // src/MenuStatus.tsx
2096
- var import_jsx_runtime13 = require("react/jsx-runtime");
2357
+ var import_jsx_runtime14 = require("react/jsx-runtime");
2097
2358
  var ROW_WIDTHS = ["w-3/4", "w-1/2", "w-4/5", "w-3/5"];
2098
2359
  function MenuLoading() {
2099
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { role: "status", "aria-label": "Loading options", className: "p-1", children: ROW_WIDTHS.map((w) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "flex h-9 items-center px-2", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: `inline-block h-3 ${w} animate-pulse rounded-full bg-subtle`, "aria-hidden": "true" }) }, w)) });
2360
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { role: "status", "aria-label": "Loading options", className: "p-1", children: ROW_WIDTHS.map((w) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex h-9 items-center px-2", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: `inline-block h-3 ${w} animate-pulse rounded-full bg-subtle`, "aria-hidden": "true" }) }, w)) });
2100
2361
  }
2101
2362
  function MenuError({ onRetry }) {
2102
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { role: "alert", className: "px-3 py-5 text-center text-dense text-text-secondary", children: [
2363
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { role: "alert", className: "px-3 py-5 text-center text-dense text-text-secondary", children: [
2103
2364
  "Couldn't load options.",
2104
- onRetry && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2365
+ onRetry && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2105
2366
  "button",
2106
2367
  {
2107
2368
  type: "button",
@@ -2114,12 +2375,12 @@ function MenuError({ onRetry }) {
2114
2375
  }
2115
2376
 
2116
2377
  // src/SelectFilter.tsx
2117
- var import_jsx_runtime14 = require("react/jsx-runtime");
2378
+ var import_jsx_runtime15 = require("react/jsx-runtime");
2118
2379
  function slug4(value) {
2119
2380
  return value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)/g, "");
2120
2381
  }
2121
2382
  function OptionIcon({ children }) {
2122
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2383
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2123
2384
  "span",
2124
2385
  {
2125
2386
  "aria-hidden": "true",
@@ -2148,12 +2409,12 @@ function SelectFilter({
2148
2409
  }) {
2149
2410
  const sm = size === "sm";
2150
2411
  const bare = !sm && hideCaption;
2151
- const [open, setOpen] = (0, import_react8.useState)(false);
2152
- const [pos, setPos] = (0, import_react8.useState)(null);
2153
- const ref = (0, import_react8.useRef)(null);
2154
- const popoverRef = (0, import_react8.useRef)(null);
2155
- const close = (0, import_react8.useCallback)(() => setOpen(false), []);
2156
- const reposition = (0, import_react8.useCallback)(() => {
2412
+ const [open, setOpen] = (0, import_react10.useState)(false);
2413
+ const [pos, setPos] = (0, import_react10.useState)(null);
2414
+ const ref = (0, import_react10.useRef)(null);
2415
+ const popoverRef = (0, import_react10.useRef)(null);
2416
+ const close = (0, import_react10.useCallback)(() => setOpen(false), []);
2417
+ const reposition = (0, import_react10.useCallback)(() => {
2157
2418
  if (!ref.current) return;
2158
2419
  const r = ref.current.getBoundingClientRect();
2159
2420
  const h = Math.min(options.length * 36 + 8, 288);
@@ -2164,11 +2425,11 @@ function SelectFilter({
2164
2425
  width: r.width
2165
2426
  });
2166
2427
  }, [align, options.length]);
2167
- (0, import_react8.useLayoutEffect)(() => {
2428
+ (0, import_react10.useLayoutEffect)(() => {
2168
2429
  if (!open) return;
2169
2430
  reposition();
2170
2431
  }, [open, reposition]);
2171
- (0, import_react8.useEffect)(() => {
2432
+ (0, import_react10.useEffect)(() => {
2172
2433
  if (!open) return;
2173
2434
  const onKey = (e) => e.key === "Escape" && close();
2174
2435
  const onClick = (e) => {
@@ -2187,20 +2448,20 @@ function SelectFilter({
2187
2448
  window.removeEventListener("scroll", reposition, true);
2188
2449
  };
2189
2450
  }, [open, close, reposition]);
2190
- const valueContent = renderIcon ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "flex items-center gap-1.5", children: [
2191
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(OptionIcon, { children: renderIcon(value) }),
2451
+ const valueContent = renderIcon ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "flex items-center gap-1.5", children: [
2452
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(OptionIcon, { children: renderIcon(value) }),
2192
2453
  value
2193
2454
  ] }) : value;
2194
- const triggerValue = sm && inlineCaption ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { children: [
2195
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "font-normal text-text-secondary", children: [
2455
+ const triggerValue = sm && inlineCaption ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { children: [
2456
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "font-normal text-text-secondary", children: [
2196
2457
  caption,
2197
2458
  ":"
2198
2459
  ] }),
2199
2460
  " ",
2200
2461
  valueContent
2201
2462
  ] }) : valueContent;
2202
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: cn("relative", fullWidth && "w-full"), ref, "data-testid": testIdPrefix, children: [
2203
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
2463
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: cn("relative", fullWidth && "w-full"), ref, "data-testid": testIdPrefix, children: [
2464
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
2204
2465
  "button",
2205
2466
  {
2206
2467
  type: "button",
@@ -2217,8 +2478,8 @@ function SelectFilter({
2217
2478
  className
2218
2479
  ),
2219
2480
  children: [
2220
- sm || bare ? triggerValue : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ChipContent, { caption, value: triggerValue }),
2221
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2481
+ sm || bare ? triggerValue : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ChipContent, { caption, value: triggerValue }),
2482
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2222
2483
  import_lucide_react11.ChevronDown,
2223
2484
  {
2224
2485
  size: 14,
@@ -2229,8 +2490,8 @@ function SelectFilter({
2229
2490
  ]
2230
2491
  }
2231
2492
  ),
2232
- open && pos && (0, import_react_dom2.createPortal)(
2233
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2493
+ open && pos && (0, import_react_dom3.createPortal)(
2494
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2234
2495
  "div",
2235
2496
  {
2236
2497
  ref: popoverRef,
@@ -2242,9 +2503,9 @@ function SelectFilter({
2242
2503
  ),
2243
2504
  role: loading || error ? "group" : "listbox",
2244
2505
  "aria-label": caption,
2245
- children: loading ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(MenuLoading, {}) : error ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(MenuError, { onRetry }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "max-h-70 overflow-y-auto p-1", children: options.map((o) => {
2506
+ children: loading ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(MenuLoading, {}) : error ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(MenuError, { onRetry }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "max-h-70 overflow-y-auto p-1", children: options.map((o) => {
2246
2507
  const selected = o === value;
2247
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
2508
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
2248
2509
  "button",
2249
2510
  {
2250
2511
  type: "button",
@@ -2257,9 +2518,9 @@ function SelectFilter({
2257
2518
  },
2258
2519
  className: "flex w-full items-center gap-2.5 rounded-control px-2 py-2 text-left transition-colors hover:bg-subtle focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-border-focus",
2259
2520
  children: [
2260
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "flex h-4 w-4 shrink-0 items-center justify-center text-brand-primaryAction", children: selected && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react11.Check, { size: 15, strokeWidth: 3 }) }),
2261
- renderIcon && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(OptionIcon, { children: renderIcon(o) }),
2262
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2521
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "flex h-4 w-4 shrink-0 items-center justify-center text-brand-primaryAction", children: selected && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react11.Check, { size: 15, strokeWidth: 3 }) }),
2522
+ renderIcon && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(OptionIcon, { children: renderIcon(o) }),
2523
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2263
2524
  "span",
2264
2525
  {
2265
2526
  className: cn("flex-1 text-sm", selected ? "font-semibold text-text-primary" : "text-text-primary"),
@@ -2279,17 +2540,17 @@ function SelectFilter({
2279
2540
  }
2280
2541
 
2281
2542
  // src/Card.tsx
2282
- var import_react11 = require("react");
2543
+ var import_react13 = require("react");
2283
2544
 
2284
2545
  // src/Skeleton.tsx
2285
- var import_react10 = require("react");
2546
+ var import_react12 = require("react");
2286
2547
 
2287
2548
  // src/Button.tsx
2288
- var import_react9 = require("react");
2549
+ var import_react11 = require("react");
2289
2550
  var import_react_slot = require("@radix-ui/react-slot");
2290
2551
  var import_class_variance_authority = require("class-variance-authority");
2291
2552
  var import_lucide_react12 = require("lucide-react");
2292
- var import_jsx_runtime15 = require("react/jsx-runtime");
2553
+ var import_jsx_runtime16 = require("react/jsx-runtime");
2293
2554
  var buttonVariants = (0, import_class_variance_authority.cva)(
2294
2555
  "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-control transition-all duration-(--mr-motion-duration-interactive) ease-interactive disabled:pointer-events-none disabled:opacity-40 focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus",
2295
2556
  {
@@ -2350,7 +2611,7 @@ var buttonVariants = (0, import_class_variance_authority.cva)(
2350
2611
  }
2351
2612
  }
2352
2613
  );
2353
- var Button = (0, import_react9.forwardRef)(
2614
+ var Button = (0, import_react11.forwardRef)(
2354
2615
  ({ className, testIdPrefix, variant, size, iconOnly, asChild = false, loading = false, disabled, children, ...props }, ref) => {
2355
2616
  const shared = {
2356
2617
  className: cn(buttonVariants({ variant, size, iconOnly, className })),
@@ -2360,10 +2621,10 @@ var Button = (0, import_react9.forwardRef)(
2360
2621
  ...props
2361
2622
  };
2362
2623
  if (asChild) {
2363
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_slot.Slot, { ref, ...shared, children });
2624
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react_slot.Slot, { ref, ...shared, children });
2364
2625
  }
2365
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("button", { ref, ...shared, children: [
2366
- loading && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react12.Loader2, { className: "size-4 shrink-0 animate-spin", "aria-hidden": "true" }),
2626
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("button", { ref, ...shared, children: [
2627
+ loading && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react12.Loader2, { className: "size-4 shrink-0 animate-spin", "aria-hidden": "true" }),
2367
2628
  children
2368
2629
  ] });
2369
2630
  }
@@ -2371,7 +2632,7 @@ var Button = (0, import_react9.forwardRef)(
2371
2632
  Button.displayName = "Button";
2372
2633
 
2373
2634
  // src/Skeleton.tsx
2374
- var import_jsx_runtime16 = require("react/jsx-runtime");
2635
+ var import_jsx_runtime17 = require("react/jsx-runtime");
2375
2636
  var STYLE_ID = "mrLoadingStyle";
2376
2637
  var CSS = `
2377
2638
  [data-mr-skeleton]{position:relative;overflow:hidden}
@@ -2382,7 +2643,7 @@ var CSS = `
2382
2643
  @media (prefers-reduced-motion:reduce){[data-mr-skeleton]::after{animation:none;display:none}[data-mr-refresh-line]{animation:none;width:100%;opacity:.5}}
2383
2644
  `;
2384
2645
  function useLoadingStyle() {
2385
- (0, import_react10.useEffect)(() => {
2646
+ (0, import_react12.useEffect)(() => {
2386
2647
  if (typeof document === "undefined" || document.getElementById(STYLE_ID)) return;
2387
2648
  const el = document.createElement("style");
2388
2649
  el.id = STYLE_ID;
@@ -2391,9 +2652,9 @@ function useLoadingStyle() {
2391
2652
  }, []);
2392
2653
  }
2393
2654
  function useDelayedLoading(loading, delay = 300, min = 500) {
2394
- const [show, setShow] = (0, import_react10.useState)(false);
2395
- const [shownAt, setShownAt] = (0, import_react10.useState)(0);
2396
- (0, import_react10.useEffect)(() => {
2655
+ const [show, setShow] = (0, import_react12.useState)(false);
2656
+ const [shownAt, setShownAt] = (0, import_react12.useState)(0);
2657
+ (0, import_react12.useEffect)(() => {
2397
2658
  if (loading && !show) {
2398
2659
  const t = setTimeout(() => {
2399
2660
  setShow(true);
@@ -2412,7 +2673,7 @@ function useDelayedLoading(loading, delay = 300, min = 500) {
2412
2673
  var SHAPE = { line: "h-3 rounded-pill", block: "rounded-control", circle: "rounded-full" };
2413
2674
  function Skeleton({ shape = "line", className, style, testIdPrefix }) {
2414
2675
  useLoadingStyle();
2415
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2676
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2416
2677
  "span",
2417
2678
  {
2418
2679
  "aria-hidden": "true",
@@ -2424,32 +2685,32 @@ function Skeleton({ shape = "line", className, style, testIdPrefix }) {
2424
2685
  );
2425
2686
  }
2426
2687
  function SkeletonLines({ lines = 3, className }) {
2427
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { "aria-hidden": "true", className: cn("flex flex-col gap-2", className), children: Array.from({ length: lines }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Skeleton, { className: i === lines - 1 ? "w-2/3" : "w-full" }, i)) });
2688
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { "aria-hidden": "true", className: cn("flex flex-col gap-2", className), children: Array.from({ length: lines }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Skeleton, { className: i === lines - 1 ? "w-2/3" : "w-full" }, i)) });
2428
2689
  }
2429
2690
  function ChartSkeleton({ className }) {
2430
2691
  const bars = [55, 80, 40, 95, 70, 60, 85];
2431
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { "aria-hidden": "true", className: cn("flex h-48 flex-col gap-2", className), children: [
2432
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "flex flex-1 items-end gap-3", children: bars.map((h, i) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Skeleton, { shape: "block", className: "flex-1", style: { height: `${h}%` } }, i)) }),
2433
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "flex gap-3", children: bars.map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Skeleton, { className: "h-2 flex-1" }, i)) })
2692
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { "aria-hidden": "true", className: cn("flex h-48 flex-col gap-2", className), children: [
2693
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "flex flex-1 items-end gap-3", children: bars.map((h, i) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Skeleton, { shape: "block", className: "flex-1", style: { height: `${h}%` } }, i)) }),
2694
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "flex gap-3", children: bars.map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Skeleton, { className: "h-2 flex-1" }, i)) })
2434
2695
  ] });
2435
2696
  }
2436
2697
  function StatStripSkeleton({ tiles = 3, className }) {
2437
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2698
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2438
2699
  "span",
2439
2700
  {
2440
2701
  "aria-hidden": "true",
2441
2702
  className: cn("grid divide-y divide-border-default rounded-card border border-border-default bg-surface sm:auto-cols-fr sm:grid-flow-col sm:divide-x sm:divide-y-0", className),
2442
- children: Array.from({ length: tiles }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "flex flex-col gap-2 px-5 py-3", children: [
2443
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Skeleton, { className: "h-2 w-20" }),
2444
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Skeleton, { className: "h-6 w-24" }),
2445
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Skeleton, { className: "h-2 w-28" })
2703
+ children: Array.from({ length: tiles }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "flex flex-col gap-2 px-5 py-3", children: [
2704
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Skeleton, { className: "h-2 w-20" }),
2705
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Skeleton, { className: "h-6 w-24" }),
2706
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Skeleton, { className: "h-2 w-28" })
2446
2707
  ] }, i))
2447
2708
  }
2448
2709
  );
2449
2710
  }
2450
2711
  function LongWait({ loading, onRetry, hint = "Large date ranges take longer.", className }) {
2451
- const [stage, setStage] = (0, import_react10.useState)(0);
2452
- (0, import_react10.useEffect)(() => {
2712
+ const [stage, setStage] = (0, import_react12.useState)(0);
2713
+ (0, import_react12.useEffect)(() => {
2453
2714
  setStage(0);
2454
2715
  if (!loading) return void 0;
2455
2716
  const a = setTimeout(() => setStage(1), 5e3);
@@ -2460,25 +2721,25 @@ function LongWait({ loading, onRetry, hint = "Large date ranges take longer.", c
2460
2721
  };
2461
2722
  }, [loading]);
2462
2723
  if (!loading || stage === 0) return null;
2463
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("p", { role: "status", className: cn("mt-3 flex items-center gap-2 text-xs text-text-tertiary", className), children: [
2724
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("p", { role: "status", className: cn("mt-3 flex items-center gap-2 text-xs text-text-tertiary", className), children: [
2464
2725
  stage === 1 ? `Still loading. ${hint}` : "This is taking longer than usual.",
2465
- stage === 2 && onRetry && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Button, { variant: "link", size: "sm", onClick: onRetry, children: "Retry" })
2726
+ stage === 2 && onRetry && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Button, { variant: "link", size: "sm", onClick: onRetry, children: "Retry" })
2466
2727
  ] });
2467
2728
  }
2468
2729
  function LoadError({ onRetry, children = "Couldn't load this." }) {
2469
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { role: "alert", className: "flex flex-1 flex-col items-center justify-center gap-2 py-8 text-center text-dense text-text-secondary", children: [
2470
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children }),
2471
- onRetry && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Button, { variant: "secondary", size: "sm", onClick: onRetry, children: "Try again" })
2730
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { role: "alert", className: "flex flex-1 flex-col items-center justify-center gap-2 py-8 text-center text-dense text-text-secondary", children: [
2731
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children }),
2732
+ onRetry && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Button, { variant: "secondary", size: "sm", onClick: onRetry, children: "Try again" })
2472
2733
  ] });
2473
2734
  }
2474
2735
  function RefreshLine() {
2475
2736
  useLoadingStyle();
2476
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { "aria-hidden": "true", className: "pointer-events-none absolute inset-x-0 top-0 h-0.5 overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { "data-mr-refresh-line": "" }) });
2737
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { "aria-hidden": "true", className: "pointer-events-none absolute inset-x-0 top-0 h-0.5 overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { "data-mr-refresh-line": "" }) });
2477
2738
  }
2478
2739
 
2479
2740
  // src/Card.tsx
2480
- var import_jsx_runtime17 = require("react/jsx-runtime");
2481
- var Card = (0, import_react11.forwardRef)(function Card2({
2741
+ var import_jsx_runtime18 = require("react/jsx-runtime");
2742
+ var Card = (0, import_react13.forwardRef)(function Card2({
2482
2743
  staticCard,
2483
2744
  title,
2484
2745
  titleAs: TitleTag = "h3",
@@ -2498,11 +2759,11 @@ var Card = (0, import_react11.forwardRef)(function Card2({
2498
2759
  }, ref) {
2499
2760
  const chart = variant === "chart";
2500
2761
  const showSkeleton = useDelayedLoading(loading);
2501
- const body = error ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "flex min-h-48 flex-1 flex-col", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(LoadError, { onRetry }) }) : loading ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex min-h-48 flex-1 flex-col", children: [
2502
- showSkeleton && (skeleton ?? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ChartSkeleton, {})),
2503
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(LongWait, { loading, onRetry })
2504
- ] }) : refreshing ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "flex flex-1 flex-col opacity-50 transition-opacity motion-reduce:transition-none", children }) : children;
2505
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
2762
+ const body = error ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex min-h-48 flex-1 flex-col", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(LoadError, { onRetry }) }) : loading ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex min-h-48 flex-1 flex-col", children: [
2763
+ showSkeleton && (skeleton ?? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ChartSkeleton, {})),
2764
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(LongWait, { loading, onRetry })
2765
+ ] }) : refreshing ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex flex-1 flex-col opacity-50 transition-opacity motion-reduce:transition-none", children }) : children;
2766
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
2506
2767
  "article",
2507
2768
  {
2508
2769
  ref,
@@ -2517,19 +2778,19 @@ var Card = (0, import_react11.forwardRef)(function Card2({
2517
2778
  "aria-busy": loading || refreshing || void 0,
2518
2779
  ...rest,
2519
2780
  children: [
2520
- refreshing && !loading && !error && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(RefreshLine, {}),
2521
- title ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-1 flex-col p-card-padding", children: [
2522
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-start justify-between gap-2", children: [
2523
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "min-w-0", children: [
2524
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center gap-1.5", children: [
2525
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TitleTag, { className: chart ? "text-panel-title font-semibold text-text-primary" : "text-style-card-title", children: title }),
2526
- info && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(InfoTip, { text: info, label: `About ${title.toLowerCase()}` })
2781
+ refreshing && !loading && !error && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(RefreshLine, {}),
2782
+ title ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-1 flex-col p-card-padding", children: [
2783
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-start justify-between gap-2", children: [
2784
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "min-w-0", children: [
2785
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-1.5", children: [
2786
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TitleTag, { className: chart ? "text-panel-title font-semibold text-text-primary" : "text-style-card-title", children: title }),
2787
+ info && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(InfoTip, { text: info, label: `About ${title.toLowerCase()}` })
2527
2788
  ] }),
2528
- subtitle && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "mt-0.5 text-xs leading-snug text-text-tertiary", children: subtitle })
2789
+ subtitle && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "mt-0.5 text-xs leading-snug text-text-tertiary", children: subtitle })
2529
2790
  ] }),
2530
- action && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "shrink-0 text-text-tertiary", children: action })
2791
+ action && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "shrink-0 text-text-tertiary", children: action })
2531
2792
  ] }),
2532
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "mt-4 flex flex-1 flex-col", children: body })
2793
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "mt-4 flex flex-1 flex-col", children: body })
2533
2794
  ] }) : body
2534
2795
  ]
2535
2796
  }
@@ -2537,10 +2798,10 @@ var Card = (0, import_react11.forwardRef)(function Card2({
2537
2798
  });
2538
2799
 
2539
2800
  // src/StatStrip.tsx
2540
- var import_react12 = require("react");
2541
- var import_jsx_runtime18 = require("react/jsx-runtime");
2542
- var StatStrip = (0, import_react12.forwardRef)(
2543
- ({ className, testIdPrefix, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2801
+ var import_react14 = require("react");
2802
+ var import_jsx_runtime19 = require("react/jsx-runtime");
2803
+ var StatStrip = (0, import_react14.forwardRef)(
2804
+ ({ className, testIdPrefix, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2544
2805
  "div",
2545
2806
  {
2546
2807
  ref,
@@ -2558,32 +2819,32 @@ var StatStrip = (0, import_react12.forwardRef)(
2558
2819
  );
2559
2820
  StatStrip.displayName = "StatStrip";
2560
2821
  function StatTile({ label, value, unit, change, note, icon, info, children, className, testIdPrefix }) {
2561
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { "data-testid": testIdPrefix, className: cn("flex min-w-0 flex-col gap-1 px-5 py-3", className), children: [
2562
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "flex items-center gap-1.5 text-micro font-semibold uppercase tracking-wide text-text-tertiary", children: [
2563
- icon && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { "aria-hidden": "true", className: "flex shrink-0 text-brand-primaryAction", children: icon }),
2822
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { "data-testid": testIdPrefix, className: cn("flex min-w-0 flex-col gap-1 px-5 py-3", className), children: [
2823
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "flex items-center gap-1.5 text-micro font-semibold uppercase tracking-wide text-text-tertiary", children: [
2824
+ icon && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { "aria-hidden": "true", className: "flex shrink-0 text-brand-primaryAction", children: icon }),
2564
2825
  label,
2565
- info && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(InfoTip, { text: info, label: `About ${label.toLowerCase()}` })
2826
+ info && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(InfoTip, { text: info, label: `About ${label.toLowerCase()}` })
2566
2827
  ] }),
2567
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "flex flex-wrap items-baseline gap-x-2.5 gap-y-0.5", children: [
2568
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "text-xl font-bold leading-tight tracking-tight tabular-nums text-text-primary", children: [
2828
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "flex flex-wrap items-baseline gap-x-2.5 gap-y-0.5", children: [
2829
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "text-xl font-bold leading-tight tracking-tight tabular-nums text-text-primary", children: [
2569
2830
  value,
2570
- unit && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "text-dense font-medium tracking-normal text-text-tertiary", children: [
2831
+ unit && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "text-dense font-medium tracking-normal text-text-tertiary", children: [
2571
2832
  " ",
2572
2833
  unit
2573
2834
  ] })
2574
2835
  ] }),
2575
- change && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-card-title font-medium", children: change })
2836
+ change && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-card-title font-medium", children: change })
2576
2837
  ] }),
2577
- note && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-xs text-text-tertiary", children: note }),
2578
- children && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "text-xs text-text-secondary", children })
2838
+ note && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-xs text-text-tertiary", children: note }),
2839
+ children && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "text-xs text-text-secondary", children })
2579
2840
  ] });
2580
2841
  }
2581
2842
 
2582
2843
  // src/ChartLegend.tsx
2583
- var import_react13 = require("react");
2584
- var import_jsx_runtime19 = require("react/jsx-runtime");
2585
- var ChartLegend = (0, import_react13.forwardRef)(
2586
- ({ className, testIdPrefix, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2844
+ var import_react15 = require("react");
2845
+ var import_jsx_runtime20 = require("react/jsx-runtime");
2846
+ var ChartLegend = (0, import_react15.forwardRef)(
2847
+ ({ className, testIdPrefix, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2587
2848
  "ul",
2588
2849
  {
2589
2850
  ref,
@@ -2603,8 +2864,8 @@ var MARK = {
2603
2864
  };
2604
2865
  function LegendItem({ mark = "dot", color, you = false, children, className, testIdPrefix }) {
2605
2866
  const dashed = mark === "dashed";
2606
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("li", { "data-testid": testIdPrefix, className: cn("flex items-center gap-1.5", you && "text-text-secondary", className), children: [
2607
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2867
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("li", { "data-testid": testIdPrefix, className: cn("flex items-center gap-1.5", you && "text-text-secondary", className), children: [
2868
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2608
2869
  "span",
2609
2870
  {
2610
2871
  "aria-hidden": "true",
@@ -2618,7 +2879,7 @@ function LegendItem({ mark = "dot", color, you = false, children, className, tes
2618
2879
  style: color ? dashed ? { borderColor: color } : { background: color } : void 0
2619
2880
  }
2620
2881
  ),
2621
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { children: [
2882
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { children: [
2622
2883
  children,
2623
2884
  you && " (you)"
2624
2885
  ] })
@@ -2626,30 +2887,30 @@ function LegendItem({ mark = "dot", color, you = false, children, className, tes
2626
2887
  }
2627
2888
 
2628
2889
  // src/BarList.tsx
2629
- var import_jsx_runtime20 = require("react/jsx-runtime");
2890
+ var import_jsx_runtime21 = require("react/jsx-runtime");
2630
2891
  var COL_WIDTH = ["w-16", "w-13"];
2631
2892
  function BarList({ rows, columns, empty, className, testIdPrefix, "aria-label": ariaLabel }) {
2632
2893
  if (!rows.length) {
2633
- return empty ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: cn("text-xs text-text-tertiary", className), children: empty }) : null;
2894
+ return empty ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: cn("text-xs text-text-tertiary", className), children: empty }) : null;
2634
2895
  }
2635
2896
  const max = Math.max(...rows.flatMap((r) => [r.bar, r.tick ?? 0]), 1);
2636
2897
  const full = !!columns?.length;
2637
2898
  const colClass = (i) => full ? COL_WIDTH[i] ?? "w-13" : "";
2638
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { "data-testid": testIdPrefix, className: cn("flex flex-col", className), children: [
2639
- full && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { "aria-hidden": "true", className: "flex items-baseline gap-2 pb-1", children: [
2640
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "flex-1" }),
2641
- columns.map((c, i) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: cn("shrink-0 text-right text-micro font-medium text-text-tertiary", colClass(i)), children: c }, c))
2899
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { "data-testid": testIdPrefix, className: cn("flex flex-col", className), children: [
2900
+ full && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { "aria-hidden": "true", className: "flex items-baseline gap-2 pb-1", children: [
2901
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "flex-1" }),
2902
+ columns.map((c, i) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: cn("shrink-0 text-right text-micro font-medium text-text-tertiary", colClass(i)), children: c }, c))
2642
2903
  ] }),
2643
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("ul", { "aria-label": ariaLabel, className: "flex flex-col", children: rows.map((r) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("li", { className: "py-2", children: [
2644
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "mb-1.5 flex items-baseline gap-2", children: [
2645
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "min-w-0 flex-1 truncate text-dense font-semibold text-text-primary", children: [
2904
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("ul", { "aria-label": ariaLabel, className: "flex flex-col", children: rows.map((r) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("li", { className: "py-2", children: [
2905
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "mb-1.5 flex items-baseline gap-2", children: [
2906
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "min-w-0 flex-1 truncate text-dense font-semibold text-text-primary", children: [
2646
2907
  r.label,
2647
- r.note && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "font-normal text-text-tertiary", children: [
2908
+ r.note && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "font-normal text-text-tertiary", children: [
2648
2909
  " \xB7 ",
2649
2910
  r.note
2650
2911
  ] })
2651
2912
  ] }),
2652
- r.values?.map((v, i) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
2913
+ r.values?.map((v, i) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
2653
2914
  "span",
2654
2915
  {
2655
2916
  className: cn(
@@ -2658,7 +2919,7 @@ function BarList({ rows, columns, empty, className, testIdPrefix, "aria-label":
2658
2919
  colClass(i)
2659
2920
  ),
2660
2921
  children: [
2661
- full && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "sr-only", children: [
2922
+ full && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "sr-only", children: [
2662
2923
  columns[i],
2663
2924
  ": "
2664
2925
  ] }),
@@ -2668,15 +2929,15 @@ function BarList({ rows, columns, empty, className, testIdPrefix, "aria-label":
2668
2929
  i
2669
2930
  ))
2670
2931
  ] }),
2671
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { "aria-hidden": "true", className: "relative h-2 rounded-pill bg-subtle", children: [
2672
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2932
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { "aria-hidden": "true", className: "relative h-2 rounded-pill bg-subtle", children: [
2933
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2673
2934
  "div",
2674
2935
  {
2675
2936
  className: cn("h-full rounded-pill", !r.color && "bg-brand-primaryAction"),
2676
2937
  style: { width: `${Math.max(r.bar, 0) / max * 100}%`, background: r.color }
2677
2938
  }
2678
2939
  ),
2679
- r.tick !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2940
+ r.tick !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2680
2941
  "span",
2681
2942
  {
2682
2943
  className: "absolute -bottom-1 -top-1 w-0.5 -translate-x-1/2 rounded-pill bg-text-primary",
@@ -2684,14 +2945,14 @@ function BarList({ rows, columns, empty, className, testIdPrefix, "aria-label":
2684
2945
  }
2685
2946
  )
2686
2947
  ] }),
2687
- r.tickLabel && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "sr-only", children: r.tickLabel })
2948
+ r.tickLabel && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "sr-only", children: r.tickLabel })
2688
2949
  ] }, r.key)) })
2689
2950
  ] });
2690
2951
  }
2691
2952
 
2692
2953
  // src/NoResultsEmptyState.tsx
2693
2954
  var import_lucide_react13 = require("lucide-react");
2694
- var import_jsx_runtime21 = require("react/jsx-runtime");
2955
+ var import_jsx_runtime22 = require("react/jsx-runtime");
2695
2956
  var NO_RESULTS_TITLE = "No results match your filters";
2696
2957
  var NO_RESULTS_BODY = "Your filters may be too narrow, conflict with each other, or have no activity in this period.";
2697
2958
  function noResultsBody(workspaceName) {
@@ -2714,12 +2975,12 @@ function NoResultsEmptyState({
2714
2975
  const showClear = hasFilters !== false && Boolean(onClearFilters);
2715
2976
  const showEdit = Boolean(onEditFilters);
2716
2977
  const hasActions = showClear || showEdit || Boolean(actions && actions.length > 0);
2717
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: cn("flex flex-col items-center justify-center gap-3 text-center", className), "data-testid": testIdPrefix, children: [
2718
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "flex h-11 w-11 items-center justify-center rounded-full bg-subtle text-text-tertiary", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react13.FilterX, { size: 20, "aria-hidden": "true" }) }),
2719
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("h2", { className: "text-base font-semibold text-text-primary", children: title }),
2720
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "max-w-105 text-dense leading-relaxed text-text-secondary", children: bodyText }),
2721
- hasActions && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "mt-1 flex flex-col items-center gap-3", children: [
2722
- showClear && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2978
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: cn("flex flex-col items-center justify-center gap-3 text-center", className), "data-testid": testIdPrefix, children: [
2979
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "flex h-11 w-11 items-center justify-center rounded-full bg-subtle text-text-tertiary", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react13.FilterX, { size: 20, "aria-hidden": "true" }) }),
2980
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("h2", { className: "text-base font-semibold text-text-primary", children: title }),
2981
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "max-w-105 text-dense leading-relaxed text-text-secondary", children: bodyText }),
2982
+ hasActions && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "mt-1 flex flex-col items-center gap-3", children: [
2983
+ showClear && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2723
2984
  "button",
2724
2985
  {
2725
2986
  type: "button",
@@ -2729,7 +2990,7 @@ function NoResultsEmptyState({
2729
2990
  children: "Clear all filters"
2730
2991
  }
2731
2992
  ),
2732
- showEdit && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2993
+ showEdit && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2733
2994
  "button",
2734
2995
  {
2735
2996
  type: "button",
@@ -2739,7 +3000,7 @@ function NoResultsEmptyState({
2739
3000
  children: "Edit filters"
2740
3001
  }
2741
3002
  ),
2742
- actions?.map((action, i) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3003
+ actions?.map((action, i) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2743
3004
  "button",
2744
3005
  {
2745
3006
  type: "button",
@@ -2754,11 +3015,11 @@ function NoResultsEmptyState({
2754
3015
  }
2755
3016
 
2756
3017
  // src/WorkspaceSelectedCard.tsx
2757
- var import_react14 = require("react");
3018
+ var import_react16 = require("react");
2758
3019
  var import_lucide_react14 = require("lucide-react");
2759
- var import_jsx_runtime22 = require("react/jsx-runtime");
3020
+ var import_jsx_runtime23 = require("react/jsx-runtime");
2760
3021
  function WorkspaceSelectedCard({ groups, className, testIdPrefix }) {
2761
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3022
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2762
3023
  "aside",
2763
3024
  {
2764
3025
  className: cn(
@@ -2766,7 +3027,7 @@ function WorkspaceSelectedCard({ groups, className, testIdPrefix }) {
2766
3027
  className
2767
3028
  ),
2768
3029
  "data-testid": testIdPrefix,
2769
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex flex-col divide-y divide-border-default", children: groups.map((g) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SummaryGroupItem, { group: g, testIdPrefix }, g.id)) })
3030
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex flex-col divide-y divide-border-default", children: groups.map((g) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SummaryGroupItem, { group: g, testIdPrefix }, g.id)) })
2770
3031
  }
2771
3032
  );
2772
3033
  }
@@ -2778,15 +3039,15 @@ function SummaryGroupItem({
2778
3039
  const ownCount = group.items.length;
2779
3040
  const subCount = (group.subGroups ?? []).reduce((n, sg) => n + sg.items.length, 0);
2780
3041
  const expandCount = ownCount + subCount;
2781
- const [open, setOpen] = (0, import_react14.useState)(expandCount > 0);
2782
- const wasEmpty = (0, import_react14.useRef)(expandCount === 0);
2783
- (0, import_react14.useEffect)(() => {
3042
+ const [open, setOpen] = (0, import_react16.useState)(expandCount > 0);
3043
+ const wasEmpty = (0, import_react16.useRef)(expandCount === 0);
3044
+ (0, import_react16.useEffect)(() => {
2784
3045
  if (wasEmpty.current && expandCount > 0) setOpen(true);
2785
3046
  else if (expandCount === 0) setOpen(false);
2786
3047
  wasEmpty.current = expandCount === 0;
2787
3048
  }, [expandCount]);
2788
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: nested ? "" : "py-3 first:pt-0 last:pb-0", children: [
2789
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
3049
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: nested ? "" : "py-3 first:pt-0 last:pb-0", children: [
3050
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
2790
3051
  "button",
2791
3052
  {
2792
3053
  type: "button",
@@ -2795,7 +3056,7 @@ function SummaryGroupItem({
2795
3056
  "data-testid": testIdPrefix && `${testIdPrefix}-group-${group.id}`,
2796
3057
  className: "flex w-full min-w-0 items-center gap-2 text-left focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus",
2797
3058
  children: [
2798
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3059
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2799
3060
  import_lucide_react14.ChevronDown,
2800
3061
  {
2801
3062
  size: 14,
@@ -2803,37 +3064,37 @@ function SummaryGroupItem({
2803
3064
  className: cn("shrink-0 text-text-secondary transition-transform", !open && "-rotate-90")
2804
3065
  }
2805
3066
  ),
2806
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: cn("truncate font-semibold text-text-primary", nested ? "text-xs" : "text-dense"), children: group.label }),
2807
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "shrink-0 rounded-full bg-subtle px-1.5 py-0.5 text-micro font-semibold text-text-secondary", children: ownCount })
3067
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: cn("truncate font-semibold text-text-primary", nested ? "text-xs" : "text-dense"), children: group.label }),
3068
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "shrink-0 rounded-full bg-subtle px-1.5 py-0.5 text-micro font-semibold text-text-secondary", children: ownCount })
2808
3069
  ]
2809
3070
  }
2810
3071
  ),
2811
- open && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "pt-2.5", children: ownCount === 0 && subCount === 0 ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-xs text-text-secondary", children: "Nothing selected." }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-col gap-2.5", children: [
2812
- ownCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-col gap-1.5", children: [
2813
- group.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
3072
+ open && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "pt-2.5", children: ownCount === 0 && subCount === 0 ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-xs text-text-secondary", children: "Nothing selected." }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-2.5", children: [
3073
+ ownCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-1.5", children: [
3074
+ group.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
2814
3075
  "div",
2815
3076
  {
2816
3077
  className: "flex items-center justify-between gap-2 rounded-control border border-border-default bg-canvas px-2 py-1",
2817
3078
  children: [
2818
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: "min-w-0 flex-1", children: [
2819
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "block truncate text-xs text-text-primary", children: item.name }),
2820
- item.meta && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "block truncate text-micro text-text-secondary", children: item.meta })
3079
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "min-w-0 flex-1", children: [
3080
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "block truncate text-xs text-text-primary", children: item.name }),
3081
+ item.meta && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "block truncate text-micro text-text-secondary", children: item.meta })
2821
3082
  ] }),
2822
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3083
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2823
3084
  "button",
2824
3085
  {
2825
3086
  type: "button",
2826
3087
  "aria-label": `Remove ${item.name}`,
2827
3088
  onClick: () => group.onRemove(item.id),
2828
3089
  className: "flex h-5 w-5 shrink-0 items-center justify-center rounded-control text-text-secondary hover:bg-subtle hover:text-text-danger focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus",
2829
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react14.X, { size: 12, "aria-hidden": "true" })
3090
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react14.X, { size: 12, "aria-hidden": "true" })
2830
3091
  }
2831
3092
  )
2832
3093
  ]
2833
3094
  },
2834
3095
  item.id
2835
3096
  )),
2836
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3097
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2837
3098
  "button",
2838
3099
  {
2839
3100
  type: "button",
@@ -2844,13 +3105,13 @@ function SummaryGroupItem({
2844
3105
  }
2845
3106
  )
2846
3107
  ] }),
2847
- group.subGroups?.map((sg) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SummaryGroupItem, { group: sg, nested: true, testIdPrefix }, sg.id))
3108
+ group.subGroups?.map((sg) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SummaryGroupItem, { group: sg, nested: true, testIdPrefix }, sg.id))
2848
3109
  ] }) })
2849
3110
  ] });
2850
3111
  }
2851
3112
 
2852
3113
  // src/chart-placeholder-shared.tsx
2853
- var import_jsx_runtime23 = require("react/jsx-runtime");
3114
+ var import_jsx_runtime24 = require("react/jsx-runtime");
2854
3115
  var GRID_ROWS = [0, 25, 50, 75, 100];
2855
3116
  var Y_TICK_WIDTHS = [26, 30, 30, 26, 20];
2856
3117
  var Y_AXIS_W = 48;
@@ -2864,9 +3125,9 @@ function AxisFrame({
2864
3125
  testIdPrefix
2865
3126
  }) {
2866
3127
  const gutter = xTicks > 0 ? X_AXIS_H : 0;
2867
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: cn("w-full", className), style: { height }, role: "presentation", "aria-hidden": "true", "data-testid": testIdPrefix, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "relative h-full w-full", children: [
2868
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "absolute inset-y-0 right-0", style: { left: Y_AXIS_W, bottom: gutter }, children: [
2869
- GRID_ROWS.map((pct) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3128
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: cn("w-full", className), style: { height }, role: "presentation", "aria-hidden": "true", "data-testid": testIdPrefix, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "relative h-full w-full", children: [
3129
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "absolute inset-y-0 right-0", style: { left: Y_AXIS_W, bottom: gutter }, children: [
3130
+ GRID_ROWS.map((pct) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2870
3131
  "div",
2871
3132
  {
2872
3133
  className: "absolute inset-x-0 border-t border-dashed",
@@ -2874,9 +3135,9 @@ function AxisFrame({
2874
3135
  },
2875
3136
  pct
2876
3137
  )),
2877
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "absolute inset-0", children })
3138
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "absolute inset-0", children })
2878
3139
  ] }),
2879
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "absolute left-0 top-0", style: { width: Y_AXIS_W, bottom: gutter }, children: GRID_ROWS.map((pct, i) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3140
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "absolute left-0 top-0", style: { width: Y_AXIS_W, bottom: gutter }, children: GRID_ROWS.map((pct, i) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2880
3141
  "div",
2881
3142
  {
2882
3143
  className: "absolute right-2 h-2 -translate-y-1/2 rounded-xs bg-subtle",
@@ -2884,406 +3145,165 @@ function AxisFrame({
2884
3145
  },
2885
3146
  pct
2886
3147
  )) }),
2887
- xTicks > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3148
+ xTicks > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2888
3149
  "div",
2889
3150
  {
2890
- className: "absolute bottom-0 right-0 flex items-center",
2891
- style: { left: Y_AXIS_W, height: X_AXIS_H },
2892
- children: Array.from({ length: xTicks }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex flex-1 justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "h-2 w-full max-w-6.5 rounded-xs bg-subtle" }) }, i))
2893
- }
2894
- )
2895
- ] }) });
2896
- }
2897
- function BlankLegend({ rows, reverse = false }) {
2898
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2899
- "ul",
2900
- {
2901
- className: `flex flex-1 justify-center gap-1.5 ${reverse ? "flex-col-reverse" : "flex-col"}`,
2902
- role: "presentation",
2903
- "aria-hidden": "true",
2904
- children: Array.from({ length: rows }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("li", { className: "flex items-center justify-between gap-2", children: [
2905
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "flex items-center gap-1.5", children: [
2906
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "h-2.5 w-2.5 rounded-xs bg-subtle" }),
2907
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2908
- "span",
2909
- {
2910
- className: "h-2 rounded-xs bg-subtle",
2911
- style: { width: LEGEND_WIDTHS[i % LEGEND_WIDTHS.length] }
2912
- }
2913
- )
2914
- ] }),
2915
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "h-2 w-6 rounded-xs bg-subtle" })
2916
- ] }, i))
2917
- }
2918
- );
2919
- }
2920
-
2921
- // src/BarChartPlaceholder.tsx
2922
- var import_jsx_runtime24 = require("react/jsx-runtime");
2923
- var BAR_PROFILE = [92, 86, 76, 65, 57, 40, 30, 24, 18, 13];
2924
- function BarChartPlaceholder({ height = 220, className, testIdPrefix }) {
2925
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(AxisFrame, { height, xTicks: BAR_PROFILE.length, className, testIdPrefix, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex h-full w-full items-end gap-2", children: BAR_PROFILE.map((pct, i) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex-1 rounded-t-small bg-subtle", style: { height: `${pct}%` } }, i)) }) });
2926
- }
2927
-
2928
- // src/LineChartPlaceholder.tsx
2929
- var import_jsx_runtime25 = require("react/jsx-runtime");
2930
- var LINE_SERIES = [
2931
- [58, 52, 55, 41, 45, 33, 36, 25, 28, 17],
2932
- [74, 71, 66, 68, 59, 61, 54, 56, 48, 45],
2933
- [40, 44, 37, 41, 34, 38, 31, 34, 27, 26],
2934
- [86, 82, 84, 77, 79, 71, 73, 66, 68, 61]
2935
- ];
2936
- var LINE_FORECAST_FROM = 7;
2937
- function LineChartPlaceholder({ height = 280, className, testIdPrefix }) {
2938
- const toPath = (pts, from, to) => pts.slice(from, to).map((y, i) => `${(i + from) / (pts.length - 1) * 100},${y}`).join(" ");
2939
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(AxisFrame, { height, xTicks: LINE_SERIES[0].length, className, testIdPrefix, children: [
2940
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("svg", { viewBox: "0 0 100 100", preserveAspectRatio: "none", className: "absolute inset-0 h-full w-full", children: LINE_SERIES.map((pts, s) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("g", { children: [
2941
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2942
- "polyline",
2943
- {
2944
- points: toPath(pts, 0, LINE_FORECAST_FROM + 1),
2945
- fill: "none",
2946
- stroke: "var(--mr-color-subtle)",
2947
- strokeWidth: "2",
2948
- vectorEffect: "non-scaling-stroke",
2949
- strokeLinecap: "round",
2950
- strokeLinejoin: "round"
2951
- }
2952
- ),
2953
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2954
- "polyline",
2955
- {
2956
- points: toPath(pts, LINE_FORECAST_FROM, pts.length),
2957
- fill: "none",
2958
- stroke: "var(--mr-color-subtle)",
2959
- strokeWidth: "2",
2960
- strokeDasharray: "5 4",
2961
- vectorEffect: "non-scaling-stroke",
2962
- strokeLinecap: "round",
2963
- strokeLinejoin: "round"
2964
- }
2965
- )
2966
- ] }, s)) }),
2967
- LINE_SERIES.map(
2968
- (pts, s) => pts.map((y, i) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2969
- "div",
2970
- {
2971
- className: "absolute h-1.5 w-1.5 -translate-x-1/2 -translate-y-1/2 rounded-full",
2972
- style: {
2973
- left: `${i / (pts.length - 1) * 100}%`,
2974
- top: `${y}%`,
2975
- backgroundColor: "var(--mr-color-subtle)"
2976
- }
2977
- },
2978
- `${s}-${i}`
2979
- ))
2980
- )
2981
- ] });
2982
- }
2983
-
2984
- // src/PieChartPlaceholder.tsx
2985
- var import_jsx_runtime26 = require("react/jsx-runtime");
2986
- var PIE_SEAMS = [0, 115, 180, 230, 262, 288, 310, 332];
2987
- function PieChartPlaceholder({ height = 220, legendRows = 8, className, testIdPrefix }) {
2988
- const r = 45;
2989
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: cn("flex w-full items-center gap-3", className), style: { height }, role: "presentation", "aria-hidden": "true", "data-testid": testIdPrefix, children: [
2990
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "flex h-full items-center justify-center", style: { width: "60%" }, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("svg", { viewBox: "0 0 100 100", className: "h-full", style: { aspectRatio: "1 / 1" }, children: [
2991
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("circle", { cx: "50", cy: "50", r, fill: "var(--mr-color-subtle)" }),
2992
- PIE_SEAMS.map((deg) => {
2993
- const rad = (deg - 90) * Math.PI / 180;
2994
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2995
- "line",
2996
- {
2997
- x1: "50",
2998
- y1: "50",
2999
- x2: 50 + r * Math.cos(rad),
3000
- y2: 50 + r * Math.sin(rad),
3001
- stroke: "var(--mr-color-surface)",
3002
- strokeWidth: "1"
3003
- },
3004
- deg
3005
- );
3006
- })
3007
- ] }) }),
3008
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(BlankLegend, { rows: legendRows })
3009
- ] });
3010
- }
3011
-
3012
- // src/StackedColumnPlaceholder.tsx
3013
- var import_jsx_runtime27 = require("react/jsx-runtime");
3014
- var COLUMN_WEIGHTS = [20, 30, 15, 35, 24, 12, 28, 18];
3015
- function columnBands(count) {
3016
- const weights = Array.from({ length: count }, (_, i) => COLUMN_WEIGHTS[i % COLUMN_WEIGHTS.length]);
3017
- const total = weights.reduce((a, b) => a + b, 0);
3018
- return weights.map((w) => w / total * 100);
3019
- }
3020
- function StackedColumnPlaceholder({
3021
- height = 220,
3022
- width = 96,
3023
- legendRows = 4,
3024
- axis = false,
3025
- className,
3026
- testIdPrefix
3027
- }) {
3028
- const column = /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "flex h-full flex-col overflow-hidden rounded-control bg-subtle", style: { width }, children: columnBands(legendRows).map((pct, i) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3029
- "div",
3030
- {
3031
- style: {
3032
- height: `${pct}%`,
3033
- /* A gap in the card's color, not a border tone: border-default
3034
- disappears on the subtle fill, border-strong reads darker. */
3035
- borderTop: i === 0 ? void 0 : "1px solid var(--mr-color-surface)"
3036
- }
3037
- },
3038
- i
3039
- )) });
3040
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: cn("flex w-full gap-4", className), style: { height }, role: "presentation", "aria-hidden": "true", "data-testid": testIdPrefix, children: [
3041
- axis ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { width: "55%" }, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(AxisFrame, { height, xTicks: 0, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "flex h-full items-stretch justify-center", children: column }) }) }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "flex items-stretch py-1", children: column }),
3042
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(BlankLegend, { rows: legendRows, reverse: !axis })
3043
- ] });
3044
- }
3045
-
3046
- // src/Tooltip.tsx
3047
- var import_react15 = require("react");
3048
- var import_react_dom3 = require("react-dom");
3049
- var import_jsx_runtime28 = require("react/jsx-runtime");
3050
- function addDescribedBy(el, id) {
3051
- const ids = (el.getAttribute("aria-describedby") ?? "").split(" ").filter(Boolean);
3052
- if (!ids.includes(id)) el.setAttribute("aria-describedby", [...ids, id].join(" "));
3053
- }
3054
- function removeDescribedBy(el, id) {
3055
- const ids = (el.getAttribute("aria-describedby") ?? "").split(" ").filter((x) => x && x !== id);
3056
- if (ids.length) el.setAttribute("aria-describedby", ids.join(" "));
3057
- else el.removeAttribute("aria-describedby");
3058
- }
3059
- function exitDurationMs(el) {
3060
- if (typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches) return 0;
3061
- const cs = window.getComputedStyle(el);
3062
- if (cs.transitionProperty === "none") return 0;
3063
- const toMs = (v) => {
3064
- const n = parseFloat(v);
3065
- if (!Number.isFinite(n)) return 0;
3066
- return v.trim().endsWith("ms") ? n : n * 1e3;
3067
- };
3068
- const durations = cs.transitionDuration.split(",").map(toMs);
3069
- const delays = cs.transitionDelay.split(",").map(toMs);
3070
- return Math.max(0, ...durations.map((d, i) => d + (delays[i] ?? delays[0] ?? 0)));
3071
- }
3072
- function Tooltip({
3073
- label,
3074
- children,
3075
- anchorRef,
3076
- className,
3077
- whenTruncated = false,
3078
- interactive = false,
3079
- placement = "top",
3080
- align = "center",
3081
- delay = 0,
3082
- variant = "surface",
3083
- testIdPrefix
3084
- }) {
3085
- const [anchor, setAnchor] = (0, import_react15.useState)(null);
3086
- const [boxWidth, setBoxWidth] = (0, import_react15.useState)(null);
3087
- const ref = (0, import_react15.useRef)(null);
3088
- const boxRef = (0, import_react15.useRef)(null);
3089
- const hideTimer = (0, import_react15.useRef)(null);
3090
- const showTimer = (0, import_react15.useRef)(null);
3091
- const exitTimer = (0, import_react15.useRef)(null);
3092
- const [shown, setShown] = (0, import_react15.useState)(false);
3093
- const openRef = (0, import_react15.useRef)(false);
3094
- const mountedRef = (0, import_react15.useRef)(false);
3095
- const id = (0, import_react15.useId)();
3096
- const describedRef = (0, import_react15.useRef)(null);
3097
- const clearHideTimer = () => {
3098
- if (hideTimer.current) {
3099
- clearTimeout(hideTimer.current);
3100
- hideTimer.current = null;
3101
- }
3102
- };
3103
- const clearShowTimer = () => {
3104
- if (showTimer.current) {
3105
- clearTimeout(showTimer.current);
3106
- showTimer.current = null;
3107
- }
3108
- };
3109
- const clearExitTimer = () => {
3110
- if (exitTimer.current) {
3111
- clearTimeout(exitTimer.current);
3112
- exitTimer.current = null;
3113
- }
3114
- };
3115
- (0, import_react15.useEffect)(
3116
- () => () => {
3117
- clearHideTimer();
3118
- clearShowTimer();
3119
- clearExitTimer();
3120
- },
3121
- []
3122
- );
3123
- const reveal = () => {
3124
- const el = anchorRef ? anchorRef.current : ref.current;
3125
- if (!el) return;
3126
- if (whenTruncated && el.scrollWidth <= el.clientWidth) return;
3127
- clearExitTimer();
3128
- openRef.current = true;
3129
- const r = el.getBoundingClientRect();
3130
- if (!mountedRef.current) setBoxWidth(null);
3131
- mountedRef.current = true;
3132
- setAnchor({ top: r.top, left: r.left, width: r.width, height: r.height, bottom: r.bottom, right: r.right });
3133
- const target = anchorRef ? el : describedRef.current;
3134
- if (target) addDescribedBy(target, id);
3135
- };
3136
- const show = () => {
3137
- clearHideTimer();
3138
- clearShowTimer();
3139
- if (delay > 0 && !mountedRef.current) {
3140
- showTimer.current = setTimeout(reveal, delay);
3141
- } else {
3142
- reveal();
3143
- }
3144
- };
3145
- const unmount = () => {
3146
- clearExitTimer();
3147
- if (openRef.current || !mountedRef.current) return;
3148
- mountedRef.current = false;
3149
- setAnchor(null);
3150
- setBoxWidth(null);
3151
- if (anchorRef?.current) removeDescribedBy(anchorRef.current, id);
3152
- if (describedRef.current) removeDescribedBy(describedRef.current, id);
3153
- describedRef.current = null;
3154
- };
3155
- const hideNow = () => {
3156
- clearShowTimer();
3157
- clearHideTimer();
3158
- openRef.current = false;
3159
- if (!mountedRef.current) return;
3160
- setShown(false);
3161
- clearExitTimer();
3162
- const ms = boxRef.current ? exitDurationMs(boxRef.current) : 0;
3163
- if (ms === 0) {
3164
- unmount();
3165
- return;
3166
- }
3167
- exitTimer.current = setTimeout(unmount, ms + 50);
3168
- };
3169
- const keepOpen = () => {
3170
- clearHideTimer();
3171
- if (openRef.current || !mountedRef.current) return;
3172
- clearExitTimer();
3173
- openRef.current = true;
3174
- setShown(true);
3175
- };
3176
- const onBoxTransitionEnd = (e) => {
3177
- if (e.target !== e.currentTarget || e.propertyName !== "opacity") return;
3178
- if (!openRef.current) unmount();
3179
- };
3180
- const hide = () => {
3181
- clearShowTimer();
3182
- if (!interactive) {
3183
- hideNow();
3184
- return;
3185
- }
3186
- clearHideTimer();
3187
- hideTimer.current = setTimeout(hideNow, 120);
3188
- };
3189
- (0, import_react15.useEffect)(() => {
3190
- if (!anchorRef) return;
3191
- const el = anchorRef.current;
3192
- if (!el) return;
3193
- el.addEventListener("mouseenter", show);
3194
- el.addEventListener("mouseleave", hide);
3195
- el.addEventListener("focus", show);
3196
- el.addEventListener("blur", hide);
3197
- return () => {
3198
- el.removeEventListener("mouseenter", show);
3199
- el.removeEventListener("mouseleave", hide);
3200
- el.removeEventListener("focus", show);
3201
- el.removeEventListener("blur", hide);
3202
- };
3203
- }, [anchorRef, placement, delay]);
3204
- (0, import_react15.useEffect)(() => {
3205
- if (!anchor) return;
3206
- const onKey = (e) => e.key === "Escape" && hideNow();
3207
- window.addEventListener("keydown", onKey);
3208
- return () => window.removeEventListener("keydown", onKey);
3209
- }, [anchor]);
3210
- (0, import_react15.useLayoutEffect)(() => {
3211
- if (!anchor) return;
3212
- const el = boxRef.current;
3213
- if (!el) return;
3214
- setBoxWidth(el.getBoundingClientRect().width);
3215
- if (openRef.current) setShown(true);
3216
- }, [anchor, label]);
3217
- const margin = 8;
3218
- let style = { top: 0, left: 0 };
3219
- let translate = "";
3220
- if (anchor) {
3221
- if (placement === "right") {
3222
- style = { top: anchor.top + anchor.height / 2, left: anchor.right + 8 };
3223
- translate = "-translate-y-1/2";
3224
- } else if (placement === "bottom-end") {
3225
- style = { top: anchor.bottom + 8, right: window.innerWidth - anchor.right };
3226
- } else {
3227
- const w = boxWidth ?? anchor.width;
3228
- const desired = align === "start" ? anchor.left : anchor.left + anchor.width / 2 - w / 2;
3229
- const left = Math.min(Math.max(desired, margin), Math.max(margin, window.innerWidth - w - margin));
3230
- style = { left, top: placement === "bottom" ? anchor.bottom : anchor.top };
3231
- translate = placement === "bottom" ? "translate-y-2" : "-translate-y-[calc(100%+8px)]";
3232
- }
3233
- }
3234
- const floating = anchor != null && typeof document !== "undefined" ? (0, import_react_dom3.createPortal)(
3235
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3236
- "span",
3237
- {
3238
- ref: boxRef,
3239
- role: "tooltip",
3240
- id,
3241
- "data-testid": testIdPrefix && `${testIdPrefix}-tooltip`,
3242
- style: { top: style.top, left: style.left, right: style.right, visibility: boxWidth == null ? "hidden" : "visible" },
3243
- onMouseEnter: interactive ? keepOpen : void 0,
3244
- onMouseLeave: interactive ? hide : void 0,
3245
- onTransitionEnd: onBoxTransitionEnd,
3246
- className: cn(
3247
- "fixed z-tooltip w-max max-w-xs whitespace-normal break-words px-2.5 py-1.5 text-xs leading-snug",
3248
- // Fade in/out. The sys duration token rather than a ref one:
3249
- // it is what Button's hover/press transition uses, and a
3250
- // tooltip's fade is the same kind of interactive feedback.
3251
- // design-tokens has no in-out curve (ease-interactive is the
3252
- // decelerating "standard" curve), so ease-in-out is Tailwind's.
3253
- "transition-opacity duration-(--mr-motion-duration-interactive) ease-in-out motion-reduce:transition-none",
3254
- shown ? "opacity-100" : "opacity-0",
3255
- // Non-interactive: never a pointer target, fade-out included.
3256
- interactive ? "pointer-events-auto" : "pointer-events-none",
3257
- variant === "inverted" ? "rounded-control bg-text-primary text-surface" : "rounded-control border border-border-default bg-surface text-text-primary shadow-overlay",
3258
- translate
3259
- ),
3260
- children: label
3151
+ className: "absolute bottom-0 right-0 flex items-center",
3152
+ style: { left: Y_AXIS_W, height: X_AXIS_H },
3153
+ children: Array.from({ length: xTicks }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex flex-1 justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "h-2 w-full max-w-6.5 rounded-xs bg-subtle" }) }, i))
3261
3154
  }
3262
- ),
3263
- document.body
3264
- ) : null;
3265
- if (anchorRef) return floating;
3266
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3267
- "span",
3155
+ )
3156
+ ] }) });
3157
+ }
3158
+ function BlankLegend({ rows, reverse = false }) {
3159
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3160
+ "ul",
3268
3161
  {
3269
- ref,
3270
- className,
3271
- "data-testid": testIdPrefix,
3272
- onMouseEnter: show,
3273
- onMouseLeave: hide,
3274
- onFocus: (e) => {
3275
- describedRef.current = e.target;
3276
- show();
3277
- },
3278
- onBlur: hide,
3279
- children: [
3280
- children,
3281
- floating
3282
- ]
3162
+ className: `flex flex-1 justify-center gap-1.5 ${reverse ? "flex-col-reverse" : "flex-col"}`,
3163
+ role: "presentation",
3164
+ "aria-hidden": "true",
3165
+ children: Array.from({ length: rows }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("li", { className: "flex items-center justify-between gap-2", children: [
3166
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: "flex items-center gap-1.5", children: [
3167
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "h-2.5 w-2.5 rounded-xs bg-subtle" }),
3168
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3169
+ "span",
3170
+ {
3171
+ className: "h-2 rounded-xs bg-subtle",
3172
+ style: { width: LEGEND_WIDTHS[i % LEGEND_WIDTHS.length] }
3173
+ }
3174
+ )
3175
+ ] }),
3176
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "h-2 w-6 rounded-xs bg-subtle" })
3177
+ ] }, i))
3283
3178
  }
3284
3179
  );
3285
3180
  }
3286
3181
 
3182
+ // src/BarChartPlaceholder.tsx
3183
+ var import_jsx_runtime25 = require("react/jsx-runtime");
3184
+ var BAR_PROFILE = [92, 86, 76, 65, 57, 40, 30, 24, 18, 13];
3185
+ function BarChartPlaceholder({ height = 220, className, testIdPrefix }) {
3186
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(AxisFrame, { height, xTicks: BAR_PROFILE.length, className, testIdPrefix, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "flex h-full w-full items-end gap-2", children: BAR_PROFILE.map((pct, i) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "flex-1 rounded-t-small bg-subtle", style: { height: `${pct}%` } }, i)) }) });
3187
+ }
3188
+
3189
+ // src/LineChartPlaceholder.tsx
3190
+ var import_jsx_runtime26 = require("react/jsx-runtime");
3191
+ var LINE_SERIES = [
3192
+ [58, 52, 55, 41, 45, 33, 36, 25, 28, 17],
3193
+ [74, 71, 66, 68, 59, 61, 54, 56, 48, 45],
3194
+ [40, 44, 37, 41, 34, 38, 31, 34, 27, 26],
3195
+ [86, 82, 84, 77, 79, 71, 73, 66, 68, 61]
3196
+ ];
3197
+ var LINE_FORECAST_FROM = 7;
3198
+ function LineChartPlaceholder({ height = 280, className, testIdPrefix }) {
3199
+ const toPath = (pts, from, to) => pts.slice(from, to).map((y, i) => `${(i + from) / (pts.length - 1) * 100},${y}`).join(" ");
3200
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(AxisFrame, { height, xTicks: LINE_SERIES[0].length, className, testIdPrefix, children: [
3201
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("svg", { viewBox: "0 0 100 100", preserveAspectRatio: "none", className: "absolute inset-0 h-full w-full", children: LINE_SERIES.map((pts, s) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("g", { children: [
3202
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3203
+ "polyline",
3204
+ {
3205
+ points: toPath(pts, 0, LINE_FORECAST_FROM + 1),
3206
+ fill: "none",
3207
+ stroke: "var(--mr-color-subtle)",
3208
+ strokeWidth: "2",
3209
+ vectorEffect: "non-scaling-stroke",
3210
+ strokeLinecap: "round",
3211
+ strokeLinejoin: "round"
3212
+ }
3213
+ ),
3214
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3215
+ "polyline",
3216
+ {
3217
+ points: toPath(pts, LINE_FORECAST_FROM, pts.length),
3218
+ fill: "none",
3219
+ stroke: "var(--mr-color-subtle)",
3220
+ strokeWidth: "2",
3221
+ strokeDasharray: "5 4",
3222
+ vectorEffect: "non-scaling-stroke",
3223
+ strokeLinecap: "round",
3224
+ strokeLinejoin: "round"
3225
+ }
3226
+ )
3227
+ ] }, s)) }),
3228
+ LINE_SERIES.map(
3229
+ (pts, s) => pts.map((y, i) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3230
+ "div",
3231
+ {
3232
+ className: "absolute h-1.5 w-1.5 -translate-x-1/2 -translate-y-1/2 rounded-full",
3233
+ style: {
3234
+ left: `${i / (pts.length - 1) * 100}%`,
3235
+ top: `${y}%`,
3236
+ backgroundColor: "var(--mr-color-subtle)"
3237
+ }
3238
+ },
3239
+ `${s}-${i}`
3240
+ ))
3241
+ )
3242
+ ] });
3243
+ }
3244
+
3245
+ // src/PieChartPlaceholder.tsx
3246
+ var import_jsx_runtime27 = require("react/jsx-runtime");
3247
+ var PIE_SEAMS = [0, 115, 180, 230, 262, 288, 310, 332];
3248
+ function PieChartPlaceholder({ height = 220, legendRows = 8, className, testIdPrefix }) {
3249
+ const r = 45;
3250
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: cn("flex w-full items-center gap-3", className), style: { height }, role: "presentation", "aria-hidden": "true", "data-testid": testIdPrefix, children: [
3251
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "flex h-full items-center justify-center", style: { width: "60%" }, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("svg", { viewBox: "0 0 100 100", className: "h-full", style: { aspectRatio: "1 / 1" }, children: [
3252
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("circle", { cx: "50", cy: "50", r, fill: "var(--mr-color-subtle)" }),
3253
+ PIE_SEAMS.map((deg) => {
3254
+ const rad = (deg - 90) * Math.PI / 180;
3255
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3256
+ "line",
3257
+ {
3258
+ x1: "50",
3259
+ y1: "50",
3260
+ x2: 50 + r * Math.cos(rad),
3261
+ y2: 50 + r * Math.sin(rad),
3262
+ stroke: "var(--mr-color-surface)",
3263
+ strokeWidth: "1"
3264
+ },
3265
+ deg
3266
+ );
3267
+ })
3268
+ ] }) }),
3269
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(BlankLegend, { rows: legendRows })
3270
+ ] });
3271
+ }
3272
+
3273
+ // src/StackedColumnPlaceholder.tsx
3274
+ var import_jsx_runtime28 = require("react/jsx-runtime");
3275
+ var COLUMN_WEIGHTS = [20, 30, 15, 35, 24, 12, 28, 18];
3276
+ function columnBands(count) {
3277
+ const weights = Array.from({ length: count }, (_, i) => COLUMN_WEIGHTS[i % COLUMN_WEIGHTS.length]);
3278
+ const total = weights.reduce((a, b) => a + b, 0);
3279
+ return weights.map((w) => w / total * 100);
3280
+ }
3281
+ function StackedColumnPlaceholder({
3282
+ height = 220,
3283
+ width = 96,
3284
+ legendRows = 4,
3285
+ axis = false,
3286
+ className,
3287
+ testIdPrefix
3288
+ }) {
3289
+ const column = /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex h-full flex-col overflow-hidden rounded-control bg-subtle", style: { width }, children: columnBands(legendRows).map((pct, i) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3290
+ "div",
3291
+ {
3292
+ style: {
3293
+ height: `${pct}%`,
3294
+ /* A gap in the card's color, not a border tone: border-default
3295
+ disappears on the subtle fill, border-strong reads darker. */
3296
+ borderTop: i === 0 ? void 0 : "1px solid var(--mr-color-surface)"
3297
+ }
3298
+ },
3299
+ i
3300
+ )) });
3301
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: cn("flex w-full gap-4", className), style: { height }, role: "presentation", "aria-hidden": "true", "data-testid": testIdPrefix, children: [
3302
+ axis ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { style: { width: "55%" }, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(AxisFrame, { height, xTicks: 0, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex h-full items-stretch justify-center", children: column }) }) }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex items-stretch py-1", children: column }),
3303
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(BlankLegend, { rows: legendRows, reverse: !axis })
3304
+ ] });
3305
+ }
3306
+
3287
3307
  // src/AdvertiserNoResults.tsx
3288
3308
  var import_jsx_runtime29 = require("react/jsx-runtime");
3289
3309
  function AdvertiserNoResults({
@@ -3351,12 +3371,12 @@ function SelectedSection({ count, open, onToggle, children, className, testIdPre
3351
3371
  }
3352
3372
 
3353
3373
  // src/SelectionPicker.tsx
3354
- var import_react17 = require("react");
3374
+ var import_react18 = require("react");
3355
3375
  var import_react_dom4 = require("react-dom");
3356
3376
  var import_lucide_react17 = require("lucide-react");
3357
3377
 
3358
3378
  // src/Tabs.tsx
3359
- var import_react16 = require("react");
3379
+ var import_react17 = require("react");
3360
3380
  var import_jsx_runtime32 = require("react/jsx-runtime");
3361
3381
  function arrowKeys(e, row) {
3362
3382
  if (!row || !["ArrowLeft", "ArrowRight", "Home", "End"].includes(e.key)) return;
@@ -3368,7 +3388,7 @@ function arrowKeys(e, row) {
3368
3388
  items[next]?.click();
3369
3389
  }
3370
3390
  function Tabs({ items, value, onChange, idPrefix = "tabs", className, testIdPrefix, ...rest }) {
3371
- const row = (0, import_react16.useRef)(null);
3391
+ const row = (0, import_react17.useRef)(null);
3372
3392
  return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
3373
3393
  "div",
3374
3394
  {
@@ -3416,7 +3436,7 @@ function SegmentedControl({
3416
3436
  testIdPrefix,
3417
3437
  ...rest
3418
3438
  }) {
3419
- const row = (0, import_react16.useRef)(null);
3439
+ const row = (0, import_react17.useRef)(null);
3420
3440
  return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
3421
3441
  "div",
3422
3442
  {
@@ -3486,15 +3506,15 @@ function SelectionPicker({
3486
3506
  testIdPrefix
3487
3507
  }) {
3488
3508
  const hasAccountLists = !!accountLists;
3489
- const [source, setSource] = (0, import_react17.useState)("search");
3490
- const [query, setQuery] = (0, import_react17.useState)("");
3491
- const [activeFilters, setActiveFilters] = (0, import_react17.useState)(() => {
3509
+ const [source, setSource] = (0, import_react18.useState)("search");
3510
+ const [query, setQuery] = (0, import_react18.useState)("");
3511
+ const [activeFilters, setActiveFilters] = (0, import_react18.useState)(() => {
3492
3512
  const init = {};
3493
3513
  if (defaultFilters) for (const [label, opts] of Object.entries(defaultFilters)) init[label] = new Set(opts);
3494
3514
  return init;
3495
3515
  });
3496
- const [expanded, setExpanded] = (0, import_react17.useState)(/* @__PURE__ */ new Set());
3497
- const selectedIds = (0, import_react17.useMemo)(() => new Set(selected.map((s) => s.id)), [selected]);
3516
+ const [expanded, setExpanded] = (0, import_react18.useState)(/* @__PURE__ */ new Set());
3517
+ const selectedIds = (0, import_react18.useMemo)(() => new Set(selected.map((s) => s.id)), [selected]);
3498
3518
  const toggleFilter = (label, opt) => {
3499
3519
  setActiveFilters((prev) => {
3500
3520
  const next = { ...prev };
@@ -3506,7 +3526,7 @@ function SelectionPicker({
3506
3526
  };
3507
3527
  const activeFilterCount = filters.reduce((n, f) => n + (activeFilters[f.label]?.size ?? 0), 0);
3508
3528
  const hasSearched = showResultsWithoutSearch || query.trim().length > 0 || !requireQuery && activeFilterCount > 0;
3509
- const filteredCatalog = (0, import_react17.useMemo)(() => {
3529
+ const filteredCatalog = (0, import_react18.useMemo)(() => {
3510
3530
  if (!hasSearched || results !== void 0) return [];
3511
3531
  const q = query.trim().toLowerCase();
3512
3532
  return catalog.filter((row) => {
@@ -3796,16 +3816,16 @@ function SelectionPicker({
3796
3816
  }
3797
3817
  var EDGE_FADE = 44;
3798
3818
  function ScrollFade({ className, children }) {
3799
- const elRef = (0, import_react17.useRef)(null);
3800
- const [edges, setEdges] = (0, import_react17.useState)({ top: false, bottom: false });
3801
- const sync = (0, import_react17.useCallback)(() => {
3819
+ const elRef = (0, import_react18.useRef)(null);
3820
+ const [edges, setEdges] = (0, import_react18.useState)({ top: false, bottom: false });
3821
+ const sync = (0, import_react18.useCallback)(() => {
3802
3822
  const el = elRef.current;
3803
3823
  if (!el) return;
3804
3824
  const top = el.scrollTop > 2;
3805
3825
  const bottom = el.scrollTop + el.clientHeight < el.scrollHeight - 2;
3806
3826
  setEdges((prev) => prev.top === top && prev.bottom === bottom ? prev : { top, bottom });
3807
3827
  }, []);
3808
- const attach = (0, import_react17.useCallback)(
3828
+ const attach = (0, import_react18.useCallback)(
3809
3829
  (el) => {
3810
3830
  elRef.current = el;
3811
3831
  if (!el) return;
@@ -3835,19 +3855,19 @@ function FilterDropdown({
3835
3855
  onToggle,
3836
3856
  testIdPrefix
3837
3857
  }) {
3838
- const [open, setOpen] = (0, import_react17.useState)(false);
3839
- const [q, setQ] = (0, import_react17.useState)("");
3840
- const btnRef = (0, import_react17.useRef)(null);
3841
- const menuRef = (0, import_react17.useRef)(null);
3842
- const [pos, setPos] = (0, import_react17.useState)(null);
3858
+ const [open, setOpen] = (0, import_react18.useState)(false);
3859
+ const [q, setQ] = (0, import_react18.useState)("");
3860
+ const btnRef = (0, import_react18.useRef)(null);
3861
+ const menuRef = (0, import_react18.useRef)(null);
3862
+ const [pos, setPos] = (0, import_react18.useState)(null);
3843
3863
  const searchable = filter.options.length > 8;
3844
3864
  const shownOptions = searchable && q.trim() ? filter.options.filter((o) => o.toLowerCase().includes(q.trim().toLowerCase())) : filter.options;
3845
- (0, import_react17.useLayoutEffect)(() => {
3865
+ (0, import_react18.useLayoutEffect)(() => {
3846
3866
  if (!open || !btnRef.current) return;
3847
3867
  const r = btnRef.current.getBoundingClientRect();
3848
3868
  setPos({ top: r.bottom + 6, left: r.left });
3849
3869
  }, [open]);
3850
- (0, import_react17.useEffect)(() => {
3870
+ (0, import_react18.useEffect)(() => {
3851
3871
  if (!open) {
3852
3872
  setQ("");
3853
3873
  return;
@@ -3946,7 +3966,7 @@ function gridForColumns(columns) {
3946
3966
  }
3947
3967
 
3948
3968
  // src/PublisherBreakdownList.tsx
3949
- var import_react18 = require("react");
3969
+ var import_react19 = require("react");
3950
3970
  var import_jsx_runtime34 = require("react/jsx-runtime");
3951
3971
  var fmtM = (v) => v >= 100 ? `$${Math.round(v)}M` : `$${v.toFixed(1)}M`;
3952
3972
  function priorYearAmt(spendN, yoy) {
@@ -4020,7 +4040,7 @@ function PublisherBreakdownList({
4020
4040
  className,
4021
4041
  testIdPrefix
4022
4042
  }) {
4023
- const [showAll, setShowAll] = (0, import_react18.useState)(false);
4043
+ const [showAll, setShowAll] = (0, import_react19.useState)(false);
4024
4044
  const visible = showAll ? rows : rows.slice(0, defaultVisibleCount);
4025
4045
  const rowPad = padded ? "px-5" : "";
4026
4046
  return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: cn("flex flex-col", className), "data-testid": testIdPrefix, children: [
@@ -4084,7 +4104,7 @@ function FilterDropdownFooter({
4084
4104
  }
4085
4105
 
4086
4106
  // src/NameListModal.tsx
4087
- var import_react19 = require("react");
4107
+ var import_react20 = require("react");
4088
4108
  var import_react_dom5 = require("react-dom");
4089
4109
  var import_jsx_runtime36 = require("react/jsx-runtime");
4090
4110
  function NameListModal({
@@ -4099,21 +4119,21 @@ function NameListModal({
4099
4119
  className,
4100
4120
  testIdPrefix
4101
4121
  }) {
4102
- const [name, setName] = (0, import_react19.useState)(initialName);
4103
- const [checked, setChecked] = (0, import_react19.useState)(
4122
+ const [name, setName] = (0, import_react20.useState)(initialName);
4123
+ const [checked, setChecked] = (0, import_react20.useState)(
4104
4124
  () => Object.fromEntries((options ?? []).map((o) => [o.key, !!o.initial]))
4105
4125
  );
4106
4126
  const toggle = (key) => setChecked((c) => ({ ...c, [key]: !c[key] }));
4107
- const dialogRef = (0, import_react19.useRef)(null);
4108
- const titleId = (0, import_react19.useId)();
4109
- const fieldId = (0, import_react19.useId)();
4110
- (0, import_react19.useEffect)(() => {
4127
+ const dialogRef = (0, import_react20.useRef)(null);
4128
+ const titleId = (0, import_react20.useId)();
4129
+ const fieldId = (0, import_react20.useId)();
4130
+ (0, import_react20.useEffect)(() => {
4111
4131
  const onKey = (e) => e.key === "Escape" && onCancel();
4112
4132
  window.addEventListener("keydown", onKey);
4113
4133
  return () => window.removeEventListener("keydown", onKey);
4114
4134
  }, [onCancel]);
4115
- const [opener] = (0, import_react19.useState)(() => typeof document === "undefined" ? null : document.activeElement);
4116
- (0, import_react19.useEffect)(
4135
+ const [opener] = (0, import_react20.useState)(() => typeof document === "undefined" ? null : document.activeElement);
4136
+ (0, import_react20.useEffect)(
4117
4137
  () => () => {
4118
4138
  const active = document.activeElement;
4119
4139
  if (!active || active === document.body) opener?.focus?.();
@@ -4261,7 +4281,7 @@ function Chip({
4261
4281
  }
4262
4282
 
4263
4283
  // src/SortButton.tsx
4264
- var import_react20 = require("react");
4284
+ var import_react21 = require("react");
4265
4285
  var import_lucide_react19 = require("lucide-react");
4266
4286
  var import_jsx_runtime38 = require("react/jsx-runtime");
4267
4287
  var ALIGN = {
@@ -4269,7 +4289,7 @@ var ALIGN = {
4269
4289
  center: "justify-center text-center",
4270
4290
  right: "justify-end text-right"
4271
4291
  };
4272
- var SortButton = (0, import_react20.forwardRef)(
4292
+ var SortButton = (0, import_react21.forwardRef)(
4273
4293
  function SortButton2({
4274
4294
  label,
4275
4295
  sortKey,
@@ -4282,8 +4302,8 @@ var SortButton = (0, import_react20.forwardRef)(
4282
4302
  className,
4283
4303
  testIdPrefix
4284
4304
  }, ref) {
4285
- const own = (0, import_react20.useRef)(null);
4286
- (0, import_react20.useImperativeHandle)(ref, () => own.current);
4305
+ const own = (0, import_react21.useRef)(null);
4306
+ (0, import_react21.useImperativeHandle)(ref, () => own.current);
4287
4307
  const text = description ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: DESCRIBED, children: label }) : label;
4288
4308
  if (!sortable) {
4289
4309
  const plain = /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: cn("inline-flex", ALIGN[align], className), children: text });
@@ -4455,7 +4475,7 @@ function WorkspaceAvatar({ name, size = "md", className, testIdPrefix }) {
4455
4475
  }
4456
4476
 
4457
4477
  // src/Toast.tsx
4458
- var import_react21 = require("react");
4478
+ var import_react22 = require("react");
4459
4479
  var import_react_dom6 = require("react-dom");
4460
4480
  var import_lucide_react21 = require("lucide-react");
4461
4481
  var import_jsx_runtime41 = require("react/jsx-runtime");
@@ -4466,9 +4486,9 @@ var ICON = {
4466
4486
  };
4467
4487
  function Toast({ message, action, onClose, tone = "neutral", duration, className, testIdPrefix }) {
4468
4488
  const ms = duration ?? (action ? 1e4 : 5e3);
4469
- const [paused, setPaused] = (0, import_react21.useState)(false);
4470
- const closed = (0, import_react21.useRef)(false);
4471
- (0, import_react21.useEffect)(() => {
4489
+ const [paused, setPaused] = (0, import_react22.useState)(false);
4490
+ const closed = (0, import_react22.useRef)(false);
4491
+ (0, import_react22.useEffect)(() => {
4472
4492
  if (paused) return;
4473
4493
  const t = window.setTimeout(() => {
4474
4494
  if (closed.current) return;
@@ -4661,7 +4681,7 @@ function TablePagination({
4661
4681
  }
4662
4682
 
4663
4683
  // src/DateRangePicker.tsx
4664
- var import_react22 = require("react");
4684
+ var import_react23 = require("react");
4665
4685
  var import_lucide_react23 = require("lucide-react");
4666
4686
  var import_jsx_runtime44 = require("react/jsx-runtime");
4667
4687
  var MONTH_ABBR = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
@@ -4729,19 +4749,19 @@ function DateRangePicker({
4729
4749
  className,
4730
4750
  testIdPrefix
4731
4751
  }) {
4732
- const end = (0, import_react22.useMemo)(() => today ?? startOfToday(), [today]);
4752
+ const end = (0, import_react23.useMemo)(() => today ?? startOfToday(), [today]);
4733
4753
  const yearOptions = years ?? [3, 2, 1, 0].map((n) => end.getFullYear() - n);
4734
- const [open, setOpen] = (0, import_react22.useState)(false);
4735
- const [value, setValue] = (0, import_react22.useState)(defaultValue);
4736
- const [draft, setDraft] = (0, import_react22.useState)(defaultValue);
4737
- const ref = (0, import_react22.useRef)(null);
4738
- const [fromMo, setFromMo] = (0, import_react22.useState)(end.getMonth());
4739
- const [fromYr, setFromYr] = (0, import_react22.useState)(end.getFullYear() - 1);
4740
- const [toMo, setToMo] = (0, import_react22.useState)(end.getMonth());
4741
- const [toYr, setToYr] = (0, import_react22.useState)(end.getFullYear());
4742
- const [fromQ, setFromQ] = (0, import_react22.useState)(Math.floor(end.getMonth() / 3));
4743
- const [toQ, setToQ] = (0, import_react22.useState)(Math.floor(end.getMonth() / 3));
4744
- (0, import_react22.useEffect)(() => {
4754
+ const [open, setOpen] = (0, import_react23.useState)(false);
4755
+ const [value, setValue] = (0, import_react23.useState)(defaultValue);
4756
+ const [draft, setDraft] = (0, import_react23.useState)(defaultValue);
4757
+ const ref = (0, import_react23.useRef)(null);
4758
+ const [fromMo, setFromMo] = (0, import_react23.useState)(end.getMonth());
4759
+ const [fromYr, setFromYr] = (0, import_react23.useState)(end.getFullYear() - 1);
4760
+ const [toMo, setToMo] = (0, import_react23.useState)(end.getMonth());
4761
+ const [toYr, setToYr] = (0, import_react23.useState)(end.getFullYear());
4762
+ const [fromQ, setFromQ] = (0, import_react23.useState)(Math.floor(end.getMonth() / 3));
4763
+ const [toQ, setToQ] = (0, import_react23.useState)(Math.floor(end.getMonth() / 3));
4764
+ (0, import_react23.useEffect)(() => {
4745
4765
  const [s, e] = resolveRange(value, end);
4746
4766
  onRangeChange?.(s, e);
4747
4767
  }, [value]);
@@ -4749,7 +4769,7 @@ function DateRangePicker({
4749
4769
  if (!open) setDraft(value);
4750
4770
  setOpen((o) => !o);
4751
4771
  };
4752
- (0, import_react22.useEffect)(() => {
4772
+ (0, import_react23.useEffect)(() => {
4753
4773
  if (!open) return;
4754
4774
  const onDown = (e) => {
4755
4775
  if (ref.current && !ref.current.contains(e.target)) setOpen(false);
@@ -4841,7 +4861,7 @@ function DateRangePicker({
4841
4861
  }
4842
4862
 
4843
4863
  // src/MultiSelectFilter.tsx
4844
- var import_react23 = require("react");
4864
+ var import_react24 = require("react");
4845
4865
  var import_lucide_react24 = require("lucide-react");
4846
4866
  var import_jsx_runtime45 = require("react/jsx-runtime");
4847
4867
  var SEARCH_AFTER = 8;
@@ -4877,11 +4897,11 @@ function MultiSelectFilter({
4877
4897
  const groupLeaves = (g) => g.children.length ? g.children : [{ id: g.id, label: g.label }];
4878
4898
  const leafOptions = groups ? groups.flatMap(groupLeaves) : options;
4879
4899
  const showSearch = searchable ?? leafOptions.length > SEARCH_AFTER;
4880
- const [open, setOpen] = (0, import_react23.useState)(false);
4881
- const [q, setQ] = (0, import_react23.useState)("");
4882
- const [draft, setDraft] = (0, import_react23.useState)(selected);
4883
- const ref = (0, import_react23.useRef)(null);
4884
- const close = (0, import_react23.useCallback)(() => {
4900
+ const [open, setOpen] = (0, import_react24.useState)(false);
4901
+ const [q, setQ] = (0, import_react24.useState)("");
4902
+ const [draft, setDraft] = (0, import_react24.useState)(selected);
4903
+ const ref = (0, import_react24.useRef)(null);
4904
+ const close = (0, import_react24.useCallback)(() => {
4885
4905
  setOpen(false);
4886
4906
  setQ("");
4887
4907
  if (showFooter) return;
@@ -4904,7 +4924,7 @@ function MultiSelectFilter({
4904
4924
  setOpen(false);
4905
4925
  setQ("");
4906
4926
  };
4907
- (0, import_react23.useEffect)(() => {
4927
+ (0, import_react24.useEffect)(() => {
4908
4928
  if (!open) return;
4909
4929
  const onKey = (e) => e.key === "Escape" && close();
4910
4930
  const onClick = (e) => {
@@ -5083,14 +5103,14 @@ function OptionCount({ n }) {
5083
5103
  }
5084
5104
 
5085
5105
  // src/Toggle.tsx
5086
- var import_react24 = require("react");
5106
+ var import_react25 = require("react");
5087
5107
  var import_jsx_runtime46 = require("react/jsx-runtime");
5088
5108
  var SIZES2 = {
5089
5109
  sm: { track: "h-5 w-9", knob: "h-4 w-4", on: "translate-x-4.5" },
5090
5110
  md: { track: "h-6 w-11", knob: "h-5 w-5", on: "translate-x-5.5" }
5091
5111
  };
5092
5112
  var OFF_TRACK = "color-mix(in srgb, var(--mr-color-border-interactive) 70%, var(--mr-color-text-secondary))";
5093
- var Toggle = (0, import_react24.forwardRef)(function Toggle2({ checked, onChange, label, size = "md", disabled, className, testIdPrefix }, ref) {
5113
+ var Toggle = (0, import_react25.forwardRef)(function Toggle2({ checked, onChange, label, size = "md", disabled, className, testIdPrefix }, ref) {
5094
5114
  const s = SIZES2[size];
5095
5115
  return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
5096
5116
  "button",
@@ -5127,11 +5147,11 @@ var Toggle = (0, import_react24.forwardRef)(function Toggle2({ checked, onChange
5127
5147
  Toggle.displayName = "Toggle";
5128
5148
 
5129
5149
  // src/AISpark.tsx
5130
- var import_react25 = require("react");
5150
+ var import_react26 = require("react");
5131
5151
  var import_lucide_react25 = require("lucide-react");
5132
5152
  var import_jsx_runtime47 = require("react/jsx-runtime");
5133
5153
  function AISpark({ size = 16, className, testIdPrefix }) {
5134
- const id = (0, import_react25.useId)();
5154
+ const id = (0, import_react26.useId)();
5135
5155
  return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
5136
5156
  /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("svg", { width: "0", height: "0", "aria-hidden": "true", style: { position: "absolute" }, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("linearGradient", { id, x1: "0", y1: "0", x2: "1", y2: "1", children: [
5137
5157
  /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("stop", { offset: "0%", stopColor: "var(--mr-color-brand-primary)" }),
@@ -5206,7 +5226,7 @@ function PageHeader({ title, description, actions, meta, back, className, testId
5206
5226
  }
5207
5227
 
5208
5228
  // src/Modal.tsx
5209
- var import_react26 = require("react");
5229
+ var import_react27 = require("react");
5210
5230
  var import_react_dom7 = require("react-dom");
5211
5231
  var import_lucide_react27 = require("lucide-react");
5212
5232
  var import_jsx_runtime51 = require("react/jsx-runtime");
@@ -5221,14 +5241,14 @@ var WIDTH = {
5221
5241
  var EXIT_MS = 200;
5222
5242
  var FOCUSABLE = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
5223
5243
  function Modal({ open, onClose, title, description, size = "md", footer, children, className, testIdPrefix }) {
5224
- const titleId = (0, import_react26.useId)();
5225
- const descId = (0, import_react26.useId)();
5226
- const panel = (0, import_react26.useRef)(null);
5227
- const close = (0, import_react26.useRef)(onClose);
5244
+ const titleId = (0, import_react27.useId)();
5245
+ const descId = (0, import_react27.useId)();
5246
+ const panel = (0, import_react27.useRef)(null);
5247
+ const close = (0, import_react27.useRef)(onClose);
5228
5248
  close.current = onClose;
5229
- const [mounted, setMounted] = (0, import_react26.useState)(open);
5230
- const [shown, setShown] = (0, import_react26.useState)(false);
5231
- (0, import_react26.useEffect)(() => {
5249
+ const [mounted, setMounted] = (0, import_react27.useState)(open);
5250
+ const [shown, setShown] = (0, import_react27.useState)(false);
5251
+ (0, import_react27.useEffect)(() => {
5232
5252
  if (open) {
5233
5253
  setMounted(true);
5234
5254
  const raf = requestAnimationFrame(() => requestAnimationFrame(() => setShown(true)));
@@ -5238,7 +5258,7 @@ function Modal({ open, onClose, title, description, size = "md", footer, childre
5238
5258
  const t = setTimeout(() => setMounted(false), EXIT_MS);
5239
5259
  return () => clearTimeout(t);
5240
5260
  }, [open]);
5241
- (0, import_react26.useEffect)(() => {
5261
+ (0, import_react27.useEffect)(() => {
5242
5262
  if (!open || !mounted) return;
5243
5263
  const opener = document.activeElement;
5244
5264
  const firstIn = (region) => panel.current?.querySelector(region)?.querySelector(FOCUSABLE) ?? null;
@@ -5360,12 +5380,12 @@ function EmptyState({ icon, title, description, action, size = "sm", className,
5360
5380
  }
5361
5381
 
5362
5382
  // src/TextField.tsx
5363
- var import_react27 = require("react");
5383
+ var import_react28 = require("react");
5364
5384
  var import_jsx_runtime53 = require("react/jsx-runtime");
5365
5385
  var HEIGHT2 = { sm: "h-8", md: "h-10", lg: "h-11" };
5366
- var TextField = (0, import_react27.forwardRef)(
5386
+ var TextField = (0, import_react28.forwardRef)(
5367
5387
  ({ label, hint, error, size = "md", icon, className, testIdPrefix, id, disabled, ...props }, ref) => {
5368
- const auto = (0, import_react27.useId)();
5388
+ const auto = (0, import_react28.useId)();
5369
5389
  const fieldId = id ?? auto;
5370
5390
  const noteId = `${fieldId}-note`;
5371
5391
  const note = error ?? hint;
@@ -5404,7 +5424,7 @@ var TextField = (0, import_react27.forwardRef)(
5404
5424
  TextField.displayName = "TextField";
5405
5425
 
5406
5426
  // src/Drawer.tsx
5407
- var import_react28 = require("react");
5427
+ var import_react29 = require("react");
5408
5428
  var import_react_dom8 = require("react-dom");
5409
5429
  var import_lucide_react28 = require("lucide-react");
5410
5430
  var import_jsx_runtime54 = require("react/jsx-runtime");
@@ -5416,14 +5436,14 @@ var WIDTH2 = {
5416
5436
  var EXIT_MS2 = 200;
5417
5437
  var FOCUSABLE2 = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
5418
5438
  function Drawer({ open, onClose, title, description, size = "sm", footer, children, className, testIdPrefix }) {
5419
- const titleId = (0, import_react28.useId)();
5420
- const descId = (0, import_react28.useId)();
5421
- const panel = (0, import_react28.useRef)(null);
5422
- const close = (0, import_react28.useRef)(onClose);
5439
+ const titleId = (0, import_react29.useId)();
5440
+ const descId = (0, import_react29.useId)();
5441
+ const panel = (0, import_react29.useRef)(null);
5442
+ const close = (0, import_react29.useRef)(onClose);
5423
5443
  close.current = onClose;
5424
- const [mounted, setMounted] = (0, import_react28.useState)(open);
5425
- const [shown, setShown] = (0, import_react28.useState)(false);
5426
- (0, import_react28.useEffect)(() => {
5444
+ const [mounted, setMounted] = (0, import_react29.useState)(open);
5445
+ const [shown, setShown] = (0, import_react29.useState)(false);
5446
+ (0, import_react29.useEffect)(() => {
5427
5447
  if (open) {
5428
5448
  setMounted(true);
5429
5449
  const raf = requestAnimationFrame(() => requestAnimationFrame(() => setShown(true)));
@@ -5433,7 +5453,7 @@ function Drawer({ open, onClose, title, description, size = "sm", footer, childr
5433
5453
  const t = setTimeout(() => setMounted(false), EXIT_MS2);
5434
5454
  return () => clearTimeout(t);
5435
5455
  }, [open]);
5436
- (0, import_react28.useEffect)(() => {
5456
+ (0, import_react29.useEffect)(() => {
5437
5457
  if (!open || !mounted) return;
5438
5458
  const opener = document.activeElement;
5439
5459
  const firstIn = (region) => panel.current?.querySelector(region)?.querySelector(FOCUSABLE2) ?? null;
@@ -5527,7 +5547,7 @@ function Drawer({ open, onClose, title, description, size = "sm", footer, childr
5527
5547
  }
5528
5548
 
5529
5549
  // src/DataTable.tsx
5530
- var import_react29 = require("react");
5550
+ var import_react30 = require("react");
5531
5551
  var import_lucide_react29 = require("lucide-react");
5532
5552
 
5533
5553
  // src/numbers.ts
@@ -5592,7 +5612,27 @@ var WIDTH3 = { fill: "", sm: "w-24", md: "w-36", lg: "w-48" };
5592
5612
  var MAX_H = { sm: "max-h-80", md: "max-h-120", lg: "max-h-160" };
5593
5613
  var HEAD_PAD = { default: "px-4 py-3", compact: "px-3 py-2" };
5594
5614
  var CELL_PAD = { default: "px-4 py-3.5", compact: "px-3 py-2" };
5615
+ var SUB_INDENT = { default: "pl-10", compact: "pl-9" };
5616
+ var TINT = "bg-brand-primaryTint";
5617
+ var TINT_HOVER = "group-hover/row:bg-linear-to-r group-hover/row:from-brand-primaryAction/10 group-hover/row:to-brand-primaryAction/10";
5618
+ var ROW_RING = "group-has-[[data-row-open]:focus-visible]/row:after:pointer-events-none group-has-[[data-row-open]:focus-visible]/row:after:absolute group-has-[[data-row-open]:focus-visible]/row:after:inset-0 group-has-[[data-row-open]:focus-visible]/row:after:border-y-2 group-has-[[data-row-open]:focus-visible]/row:after:border-border-focus";
5619
+ var RING_LEFT = "group-has-[[data-row-open]:focus-visible]/row:after:border-l-2";
5620
+ var RING_RIGHT = "group-has-[[data-row-open]:focus-visible]/row:after:border-r-2";
5621
+ var RING_PAST_EDGE = "group-has-[[data-row-open]:focus-visible]/row:after:-right-2";
5595
5622
  var OWN_CLICK = "a, button, input, select, textarea, label, summary, [role='button'], [role='checkbox'], [role='menuitem'], [role='switch'], [role='tab'], [contenteditable='true']";
5623
+ function isDev() {
5624
+ try {
5625
+ return process.env.NODE_ENV !== "production";
5626
+ } catch {
5627
+ return false;
5628
+ }
5629
+ }
5630
+ function rowClickCounts(e) {
5631
+ if (e.target.closest(OWN_CLICK)) return false;
5632
+ const sel = window.getSelection?.();
5633
+ if (sel && sel.toString() && sel.anchorNode && e.currentTarget.contains(sel.anchorNode)) return false;
5634
+ return true;
5635
+ }
5596
5636
  function NoValue({ reason = "No data" }) {
5597
5637
  return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(Tooltip, { label: reason, delay: 300, className: "text-text-tertiary", children: [
5598
5638
  /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { "aria-hidden": "true", children: NO_VALUE }),
@@ -5623,9 +5663,25 @@ function DataTable({
5623
5663
  sort = null,
5624
5664
  onSortChange,
5625
5665
  defaultSort = null,
5626
- renderExpanded,
5666
+ renderExpanded: renderExpandedProp,
5627
5667
  canExpand,
5668
+ subRows: subRowsProp,
5669
+ subRowNoun = { one: "row", other: "rows" },
5670
+ totalsRow,
5671
+ totalsLabel = "Total",
5672
+ onRowClick,
5673
+ rowClickLabel,
5674
+ highlightRow,
5628
5675
  rowLabel,
5676
+ selected,
5677
+ onSelectedChange,
5678
+ totalCount,
5679
+ onSelectAll,
5680
+ selectedCount,
5681
+ selectionActions,
5682
+ selectionDisabled,
5683
+ selectionBar = true,
5684
+ selectAll = true,
5629
5685
  density = "default",
5630
5686
  loading = false,
5631
5687
  loadingRows = 5,
@@ -5638,7 +5694,7 @@ function DataTable({
5638
5694
  testIdPrefix,
5639
5695
  ...rest
5640
5696
  }) {
5641
- const titleId = (0, import_react29.useId)();
5697
+ const titleId = (0, import_react30.useId)();
5642
5698
  const showSkeleton = useDelayedLoading(loading);
5643
5699
  const head = HEAD_PAD[density];
5644
5700
  const pad2 = CELL_PAD[density];
@@ -5650,32 +5706,164 @@ function DataTable({
5650
5706
  const col = columns.find((c) => c.key === key);
5651
5707
  onSortChange?.(cycleSort(shown, key, col?.firstDir ?? (right(col) ? "desc" : "asc"), defaultSort));
5652
5708
  };
5653
- const [open, setOpen] = (0, import_react29.useState)(() => /* @__PURE__ */ new Set());
5654
- const visibleKeys = rows.map(rowKey).join("|");
5655
- (0, import_react29.useEffect)(() => setOpen(/* @__PURE__ */ new Set()), [shown?.key, shown?.dir, visibleKeys]);
5656
- const expandable = (row) => !!renderExpanded && (canExpand ? canExpand(row) : true);
5657
- const anyExpandable = !!renderExpanded && rows.some(expandable);
5709
+ const clash = !!onRowClick && (!!renderExpandedProp || !!subRowsProp);
5710
+ (0, import_react30.useEffect)(() => {
5711
+ if (clash && isDev()) {
5712
+ console.warn("DataTable: pass `onRowClick` or rows that open in place (`renderExpanded`, `subRows`), not both. The row click wins; rows won't open.");
5713
+ }
5714
+ }, [clash]);
5715
+ const renderExpanded = onRowClick ? void 0 : renderExpandedProp;
5716
+ const subRows = onRowClick ? void 0 : subRowsProp;
5717
+ const childrenOf = (row) => {
5718
+ const kids = subRows?.(row);
5719
+ return kids && kids.length > 0 ? kids : null;
5720
+ };
5721
+ const [open, setOpen] = (0, import_react30.useState)(() => /* @__PURE__ */ new Set());
5722
+ const visible = rows.map(rowKey);
5723
+ const resetOn = subRows ? [...visible].sort().join("|") : `${shown?.key}|${shown?.dir}|${visible.join("|")}`;
5724
+ (0, import_react30.useEffect)(() => setOpen(/* @__PURE__ */ new Set()), [resetOn]);
5725
+ const expandable = (row) => (!!renderExpanded || !!childrenOf(row)) && (canExpand ? canExpand(row) : true);
5726
+ const anyExpandable = (!!renderExpanded || !!subRows) && rows.some(expandable);
5658
5727
  const toggle = (key) => setOpen((prev) => {
5659
5728
  const next = new Set(prev);
5660
5729
  if (next.has(key)) next.delete(key);
5661
5730
  else next.add(key);
5662
5731
  return next;
5663
5732
  });
5664
- const onRowClick = (e, key) => {
5665
- if (e.target.closest(OWN_CLICK)) return;
5666
- if (window.getSelection?.()?.toString()) return;
5667
- toggle(key);
5733
+ const selectable = !!onSelectedChange;
5734
+ const picked = new Set(selected ?? []);
5735
+ const blocked = (row) => selectionDisabled ? selectionDisabled(row) : false;
5736
+ const pickable = rows.filter((r) => !blocked(r)).map(rowKey);
5737
+ const allVisible = pickable.length > 0 && pickable.every((k) => picked.has(k));
5738
+ const someVisible = pickable.some((k) => picked.has(k));
5739
+ const setPicked = (next) => onSelectedChange?.([...next]);
5740
+ const toggleAllVisible = () => {
5741
+ const next = new Set(picked);
5742
+ pickable.forEach((k) => allVisible ? next.delete(k) : next.add(k));
5743
+ setPicked(next);
5744
+ };
5745
+ const lastPicked = (0, import_react30.useRef)(null);
5746
+ const shiftHeld = (0, import_react30.useRef)(false);
5747
+ const togglePick = (index) => {
5748
+ const key = visible[index];
5749
+ const on = !picked.has(key);
5750
+ const next = new Set(picked);
5751
+ const from = shiftHeld.current && lastPicked.current !== null ? Math.min(lastPicked.current, index) : index;
5752
+ const to = shiftHeld.current && lastPicked.current !== null ? Math.max(lastPicked.current, index) : index;
5753
+ for (let i = from; i <= to; i++) {
5754
+ if (i !== index && blocked(rows[i])) continue;
5755
+ if (on) next.add(visible[i]);
5756
+ else next.delete(visible[i]);
5757
+ }
5758
+ lastPicked.current = index;
5759
+ setPicked(next);
5760
+ };
5761
+ const count = selectedCount ?? picked.size;
5762
+ const barCount = selectable && selectionBar ? count : 0;
5763
+ const scroller = (0, import_react30.useRef)(null);
5764
+ const [pinned, setPinned] = (0, import_react30.useState)(false);
5765
+ const [scrolled, setScrolled] = (0, import_react30.useState)(false);
5766
+ const heads = (0, import_react30.useRef)(/* @__PURE__ */ new Map());
5767
+ const [lefts, setLefts] = (0, import_react30.useState)({});
5768
+ (0, import_react30.useEffect)(() => {
5769
+ const el = scroller.current;
5770
+ if (!el || typeof ResizeObserver === "undefined") return void 0;
5771
+ const measure = () => {
5772
+ setPinned(el.scrollWidth > el.clientWidth + 1);
5773
+ const next = {};
5774
+ const order = [...heads.current.entries()].sort(([, a], [, b]) => a.cellIndex - b.cellIndex);
5775
+ let x = 0;
5776
+ for (const [id, th] of order) {
5777
+ next[id] = x;
5778
+ x += th.offsetWidth;
5779
+ }
5780
+ setLefts((prev) => Object.keys(next).every((k) => prev[k] === next[k]) && Object.keys(prev).length === Object.keys(next).length ? prev : next);
5781
+ };
5782
+ measure();
5783
+ const ro = new ResizeObserver(measure);
5784
+ ro.observe(el);
5785
+ if (el.firstElementChild) ro.observe(el.firstElementChild);
5786
+ return () => ro.disconnect();
5787
+ }, []);
5788
+ const nameIdx = Math.max(0, columns.findIndex((c) => !c.rank));
5789
+ const leftOf = (part) => lefts[String(part)] ?? 0;
5790
+ const headRef = (part) => (el) => {
5791
+ if (el) heads.current.set(String(part), el);
5792
+ else heads.current.delete(String(part));
5668
5793
  };
5669
- const span = columns.length + (anyExpandable ? 1 : 0);
5794
+ const isPinned = (part) => pinned && (typeof part !== "number" || part <= nameIdx);
5795
+ const pinCls = (part, where, rowBg) => isPinned(part) ? cn(
5796
+ "sticky z-1",
5797
+ where === "head" ? rowBg ?? "bg-subtle" : rowBg ?? "bg-surface group-hover/row:bg-subtle",
5798
+ part === nameIdx && "max-w-60 border-r border-r-border-default"
5799
+ ) : "";
5800
+ const pinStyle = (part) => isPinned(part) ? { left: leftOf(part) } : void 0;
5801
+ const edge = (part) => pinned && scrolled && part === nameIdx ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { "aria-hidden": "true", className: "pointer-events-none absolute inset-y-0 left-full w-2 bg-linear-to-r from-border-default to-transparent" }) : null;
5802
+ const span = columns.length + (anyExpandable ? 1 : 0) + (selectable ? 1 : 0);
5670
5803
  const renderCell = (c, row) => {
5671
5804
  const v = c.cell(row);
5672
5805
  return v === null || v === void 0 || v === "" ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(NoValue, { reason: c.missing }) : v;
5673
5806
  };
5807
+ const fit = (ci, content) => pinned && ci === nameIdx ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(Tooltip, { label: content, whenTruncated: true, delay: 300, className: "block truncate", children: content }) : content;
5808
+ const colBg = (c, rowBg) => c.highlight ? TINT : rowBg;
5809
+ const firstPart = selectable ? "select" : anyExpandable ? "expand" : 0;
5810
+ const ringCls = (part) => onRowClick ? cn(
5811
+ "relative",
5812
+ ROW_RING,
5813
+ part === firstPart && RING_LEFT,
5814
+ part === columns.length - 1 && RING_RIGHT,
5815
+ pinned && scrolled && part === nameIdx && part !== columns.length - 1 && RING_PAST_EDGE
5816
+ ) : "";
5817
+ const plainRow = (kind, row, key, rowBg, extra) => /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("tr", { id: extra?.id, className: cn("[&:last-child>td]:border-b-0", kind === "total" && "font-semibold"), children: [
5818
+ selectable && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("td", { className: cn("border-b border-border-default pr-0", pad2, rowBg, pinCls("select", "body", rowBg)), style: pinStyle("select") }),
5819
+ anyExpandable && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("td", { className: cn("border-b border-border-default pr-0", pad2, rowBg, pinCls("expand", "body", rowBg)), style: pinStyle("expand") }),
5820
+ columns.map((c, ci) => {
5821
+ const bg = kind === "sub" ? colBg(c, rowBg) : rowBg;
5822
+ const isName = ci === nameIdx;
5823
+ return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
5824
+ "td",
5825
+ {
5826
+ className: cn(
5827
+ "border-b border-border-default",
5828
+ pad2,
5829
+ align(c),
5830
+ right(c) && "tabular-nums",
5831
+ c.rank && "text-text-tertiary",
5832
+ kind === "sub" && isName && cn(SUB_INDENT[density], "text-text-secondary"),
5833
+ bg,
5834
+ pinCls(ci, "body", bg)
5835
+ ),
5836
+ style: pinStyle(ci),
5837
+ children: [
5838
+ c.rank ? null : isName && kind === "total" ? fit(ci, totalsLabel) : kind === "total" ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(DeltaBoldContext.Provider, { value: true, children: fit(ci, renderCell(c, row)) }) : fit(ci, renderCell(c, row)),
5839
+ kind === "sub" && isName && rowLabel && extra?.parent !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("span", { className: "sr-only", children: [
5840
+ ", in ",
5841
+ rowLabel(extra.parent)
5842
+ ] }),
5843
+ edge(ci)
5844
+ ]
5845
+ },
5846
+ c.key
5847
+ );
5848
+ })
5849
+ ] }, key);
5674
5850
  const inside = variant === "chart";
5851
+ const bar = barCount > 0 ? /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex flex-wrap items-center gap-x-3 gap-y-1 text-dense", children: [
5852
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("span", { role: "status", className: "font-medium text-text-primary", children: [
5853
+ formatCountFull(count),
5854
+ " selected"
5855
+ ] }),
5856
+ allVisible && totalCount !== void 0 && count < totalCount && onSelectAll && /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(Button, { variant: "link", size: "sm", onClick: onSelectAll, children: [
5857
+ "Select all ",
5858
+ formatCountFull(totalCount)
5859
+ ] }),
5860
+ selectionActions,
5861
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(Button, { variant: "link", size: "sm", onClick: () => onSelectedChange?.([]), children: "Clear" })
5862
+ ] }) : null;
5675
5863
  const frame = /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
5676
5864
  "div",
5677
5865
  {
5678
- className: cn("relative flex w-full flex-col overflow-hidden rounded-card border border-border-default bg-surface", !(title && !inside) && className),
5866
+ className: cn("relative flex w-full flex-col overflow-hidden rounded-card border border-border-default bg-surface", (inside || !title && barCount === 0) && className),
5679
5867
  "data-testid": testIdPrefix,
5680
5868
  children: [
5681
5869
  title && inside && /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex items-start justify-between gap-2 p-card-padding", children: [
@@ -5683,108 +5871,201 @@ function DataTable({
5683
5871
  /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("h3", { id: titleId, className: "text-panel-title font-semibold text-text-primary", children: title }),
5684
5872
  subtitle && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("p", { className: "mt-0.5 text-xs leading-snug text-text-tertiary", children: subtitle })
5685
5873
  ] }),
5686
- action && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "shrink-0 text-text-tertiary", children: action })
5874
+ (bar ?? action) && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "shrink-0 text-text-tertiary", children: bar ?? action })
5687
5875
  ] }),
5688
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: cn("overflow-x-auto", maxHeight && cn("overflow-y-auto", MAX_H[maxHeight])), children: /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
5689
- "table",
5876
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
5877
+ "div",
5690
5878
  {
5691
- "aria-labelledby": title ? titleId : void 0,
5692
- "aria-label": title ? void 0 : rest["aria-label"],
5693
- "aria-busy": loading || refreshing || void 0,
5694
- className: "w-full border-collapse text-left",
5695
- children: [
5696
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("thead", { className: cn(maxHeight && "sticky top-0 z-10"), children: /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("tr", { className: "bg-subtle text-micro font-semibold uppercase tracking-wider text-text-secondary", children: [
5697
- anyExpandable && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("th", { scope: "col", className: cn("w-10 border-b border-border-default", head), children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "sr-only", children: "Details" }) }),
5698
- columns.map((c) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
5699
- "th",
5700
- {
5701
- scope: "col",
5702
- "aria-sort": c.sortable ? ariaSortFor(shown, c.key) : void 0,
5703
- className: cn("group/head whitespace-nowrap border-b border-border-default font-semibold", head, align(c), width(c)),
5704
- children: c.sortable && onSortChange ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
5705
- SortButton,
5879
+ ref: scroller,
5880
+ onScroll: (e) => setScrolled(e.currentTarget.scrollLeft > 0),
5881
+ className: cn("overflow-x-auto", maxHeight && cn("overflow-y-auto", MAX_H[maxHeight])),
5882
+ children: /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
5883
+ "table",
5884
+ {
5885
+ "aria-labelledby": title ? titleId : void 0,
5886
+ "aria-label": title ? void 0 : rest["aria-label"],
5887
+ "aria-busy": loading || refreshing || void 0,
5888
+ className: "w-full border-separate border-spacing-0 text-left",
5889
+ children: [
5890
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("thead", { className: cn(maxHeight && "sticky top-0 z-10"), children: /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("tr", { className: "bg-subtle text-micro font-semibold uppercase tracking-wider text-text-secondary", children: [
5891
+ selectable && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("th", { ref: headRef("select"), scope: "col", className: cn("w-10 border-b border-border-default pr-0", head, pinCls("select", "head")), style: pinStyle("select"), children: selectAll ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
5892
+ CheckBox,
5706
5893
  {
5707
- label: c.label,
5708
- sortKey: c.key,
5709
- align: right(c) ? "right" : "left",
5710
- sort: sortProp(shown),
5711
- onSort,
5712
- description: c.info,
5713
- testIdPrefix
5894
+ checked: allVisible,
5895
+ indeterminate: someVisible && !allVisible,
5896
+ onChange: toggleAllVisible,
5897
+ disabled: pickable.length === 0,
5898
+ ariaLabel: allVisible ? "Deselect all rows on this page" : "Select all rows on this page"
5714
5899
  }
5715
- ) : c.info ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(SortButton, { label: c.label, sortKey: c.key, sortable: false, sort: sortProp(shown), onSort: () => {
5716
- }, description: c.info, align: right(c) ? "right" : "left" }) : c.label
5717
- },
5718
- c.key
5719
- ))
5720
- ] }) }),
5721
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("tbody", { className: cn("text-dense text-text-primary", refreshing && !loading && "opacity-50 transition-opacity motion-reduce:transition-none"), children: loading ? Array.from({ length: loadingRows }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("tr", { "aria-hidden": "true", className: "[&:last-child>td]:border-b-0", children: [
5722
- anyExpandable && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("td", { className: cn("border-b border-border-default", pad2) }),
5723
- columns.map((c) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("td", { className: cn("border-b border-border-default", pad2, align(c)), children: showSkeleton ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(Skeleton, { className: cn("inline-block", right(c) ? "w-12" : "w-2/3") }) : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "inline-block h-3" }) }, c.key))
5724
- ] }, i)) : rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("td", { colSpan: span, className: "px-6 py-12", children: empty ?? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(NoResultsEmptyState, {}) }) }) : rows.map((row, index) => {
5725
- const key = rowKey(row);
5726
- const canOpen = expandable(row);
5727
- const isOpen = canOpen && open.has(key);
5728
- const panelId = `${titleId}-row-${index}`;
5729
- return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_react29.Fragment, { children: [
5730
- /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
5731
- "tr",
5732
- {
5733
- onClick: canOpen ? (e) => onRowClick(e, key) : void 0,
5734
- className: cn("hover:bg-subtle [&:last-child>td]:border-b-0", canOpen && "cursor-pointer", isOpen && "bg-subtle"),
5735
- children: [
5736
- anyExpandable && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("td", { className: cn("border-b border-border-default pr-0", pad2, isOpen && "border-b-0"), children: canOpen && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
5737
- "button",
5738
- {
5739
- type: "button",
5740
- "aria-expanded": isOpen,
5741
- "aria-controls": isOpen ? panelId : void 0,
5742
- "aria-label": `${isOpen ? "Hide" : "Show"} details${rowLabel ? ` for ${rowLabel(row)}` : ""}`,
5743
- onClick: () => toggle(key),
5744
- className: "flex size-6 items-center justify-center rounded-control text-text-tertiary hover:text-text-primary focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus",
5745
- children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
5746
- import_lucide_react29.ChevronRight,
5747
- {
5748
- size: 16,
5749
- "aria-hidden": "true",
5750
- className: cn("transition-transform motion-reduce:transition-none", isOpen && "rotate-90")
5751
- }
5752
- )
5753
- }
5754
- ) }),
5755
- columns.map((c) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
5756
- "td",
5900
+ ) : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "sr-only", children: "Select" }) }),
5901
+ anyExpandable && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("th", { ref: headRef("expand"), scope: "col", className: cn("w-10 border-b border-border-default", head, pinCls("expand", "head")), style: pinStyle("expand"), children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "sr-only", children: "Details" }) }),
5902
+ columns.map((c, ci) => /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
5903
+ "th",
5904
+ {
5905
+ ref: ci <= nameIdx ? headRef(ci) : void 0,
5906
+ scope: "col",
5907
+ "aria-sort": c.sortable ? ariaSortFor(shown, c.key) : void 0,
5908
+ className: cn(
5909
+ "group/head whitespace-nowrap border-b border-border-default font-semibold",
5910
+ head,
5911
+ align(c),
5912
+ width(c),
5913
+ c.highlight && TINT,
5914
+ pinCls(ci, "head", c.highlight ? TINT : void 0)
5915
+ ),
5916
+ style: pinStyle(ci),
5917
+ children: [
5918
+ c.sortable && onSortChange ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
5919
+ SortButton,
5920
+ {
5921
+ label: c.label,
5922
+ sortKey: c.key,
5923
+ align: right(c) ? "right" : "left",
5924
+ sort: sortProp(shown),
5925
+ onSort,
5926
+ description: c.info,
5927
+ testIdPrefix
5928
+ }
5929
+ ) : c.info ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(SortButton, { label: c.label, sortKey: c.key, sortable: false, sort: sortProp(shown), onSort: () => {
5930
+ }, description: c.info, align: right(c) ? "right" : "left" }) : c.label,
5931
+ edge(ci)
5932
+ ]
5933
+ },
5934
+ c.key
5935
+ ))
5936
+ ] }) }),
5937
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("tbody", { className: cn("text-dense text-text-primary", refreshing && !loading && "opacity-50 transition-opacity motion-reduce:transition-none"), children: loading ? Array.from({ length: loadingRows }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("tr", { "aria-hidden": "true", className: "[&:last-child>td]:border-b-0", children: [
5938
+ selectable && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("td", { className: cn("border-b border-border-default", pad2) }),
5939
+ anyExpandable && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("td", { className: cn("border-b border-border-default", pad2) }),
5940
+ columns.map((c) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("td", { className: cn("border-b border-border-default", pad2, align(c)), children: showSkeleton ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(Skeleton, { className: cn("inline-block", right(c) ? "w-12" : "w-2/3") }) : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "inline-block h-3" }) }, c.key))
5941
+ ] }, i)) : rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("td", { colSpan: span, className: "px-6 py-12", children: empty ?? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(NoResultsEmptyState, {}) }) }) : /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_jsx_runtime55.Fragment, { children: [
5942
+ totalsRow !== void 0 && plainRow("total", totalsRow, "__totals", "bg-subtle"),
5943
+ rows.map((row, ri) => {
5944
+ const key = rowKey(row);
5945
+ const canOpen = expandable(row);
5946
+ const kids = canOpen ? childrenOf(row) : null;
5947
+ const isOpen = canOpen && open.has(key);
5948
+ const panelOpen = isOpen && !kids;
5949
+ const panelId = `${titleId}-row-${ri}`;
5950
+ const kidIds = kids ? kids.map((_, si) => `${panelId}-${si}`) : [];
5951
+ const rowBg = highlightRow?.(row) ? cn(TINT, onRowClick && TINT_HOVER) : panelOpen ? "bg-subtle" : void 0;
5952
+ const reason = selectable ? blocked(row) : false;
5953
+ const ticked = picked.has(key);
5954
+ const label = rowLabel ? rowLabel(row) : "row";
5955
+ const clickable = !!onRowClick || canOpen;
5956
+ return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_react30.Fragment, { children: [
5957
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
5958
+ "tr",
5757
5959
  {
5960
+ onClick: onRowClick ? (e) => rowClickCounts(e) && onRowClick(row) : canOpen ? (e) => rowClickCounts(e) && toggle(key) : void 0,
5758
5961
  className: cn(
5759
- "border-b border-border-default",
5760
- pad2,
5761
- align(c),
5762
- right(c) && "tabular-nums",
5763
- c.rank && "text-text-tertiary",
5764
- isOpen && "border-b-0"
5962
+ "group/row hover:bg-subtle [&:last-child>td]:border-b-0",
5963
+ clickable && "cursor-pointer",
5964
+ panelOpen && "bg-subtle"
5965
+ // The row's hidden open button has keyboard focus: ring the whole row.
5765
5966
  ),
5766
- children: renderCell(c, row)
5767
- },
5768
- c.key
5769
- ))
5770
- ]
5771
- }
5772
- ),
5773
- isOpen && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("tr", { className: "[&:last-child>td]:border-b-0", children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("td", { id: panelId, colSpan: span, className: "border-b border-border-default bg-subtle px-4 pb-4 pl-14", children: renderExpanded(row) }) })
5774
- ] }, key);
5775
- }) })
5776
- ]
5967
+ children: [
5968
+ selectable && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
5969
+ "td",
5970
+ {
5971
+ onPointerDownCapture: (e) => shiftHeld.current = e.shiftKey,
5972
+ onKeyDownCapture: (e) => shiftHeld.current = e.shiftKey,
5973
+ className: cn("border-b border-border-default pr-0", pad2, panelOpen && "border-b-0", rowBg, ringCls("select"), pinCls("select", "body", rowBg)),
5974
+ style: pinStyle("select"),
5975
+ children: reason ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(Tooltip, { label: reason, delay: 300, className: "inline-flex align-middle", children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
5976
+ "button",
5977
+ {
5978
+ type: "button",
5979
+ role: "checkbox",
5980
+ "aria-checked": ticked,
5981
+ "aria-disabled": "true",
5982
+ "aria-label": `Select ${label}`,
5983
+ onClick: (e) => e.preventDefault(),
5984
+ className: "flex cursor-not-allowed rounded-small focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus",
5985
+ children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(CheckBoxBox, { checked: ticked, disabled: true })
5986
+ }
5987
+ ) }) : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(CheckBox, { checked: ticked, onChange: () => togglePick(ri), ariaLabel: `Select ${label}` })
5988
+ }
5989
+ ),
5990
+ anyExpandable && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
5991
+ "td",
5992
+ {
5993
+ className: cn("border-b border-border-default pr-0", pad2, panelOpen && "border-b-0", rowBg, ringCls("expand"), pinCls("expand", "body", rowBg)),
5994
+ style: pinStyle("expand"),
5995
+ children: canOpen && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
5996
+ "button",
5997
+ {
5998
+ type: "button",
5999
+ "aria-expanded": isOpen,
6000
+ "aria-controls": isOpen ? kids ? kidIds.join(" ") : panelId : void 0,
6001
+ "aria-label": kids ? `${isOpen ? "Hide" : "Show"} ${kids.length} ${kids.length === 1 ? subRowNoun.one : subRowNoun.other}${rowLabel ? ` under ${rowLabel(row)}` : ""}` : `${isOpen ? "Hide" : "Show"} details${rowLabel ? ` for ${rowLabel(row)}` : ""}`,
6002
+ onClick: () => toggle(key),
6003
+ className: "flex size-6 items-center justify-center rounded-control text-text-tertiary hover:text-text-primary focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus",
6004
+ children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
6005
+ import_lucide_react29.ChevronRight,
6006
+ {
6007
+ size: 16,
6008
+ "aria-hidden": "true",
6009
+ className: cn("transition-transform motion-reduce:transition-none", isOpen && "rotate-90")
6010
+ }
6011
+ )
6012
+ }
6013
+ )
6014
+ }
6015
+ ),
6016
+ columns.map((c, ci) => {
6017
+ const bg = colBg(c, rowBg);
6018
+ const opener = !!onRowClick && ci === nameIdx;
6019
+ return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
6020
+ "td",
6021
+ {
6022
+ className: cn(
6023
+ "border-b border-border-default",
6024
+ pad2,
6025
+ align(c),
6026
+ right(c) && "tabular-nums",
6027
+ c.rank && "text-text-tertiary",
6028
+ panelOpen && "border-b-0",
6029
+ ringCls(ci),
6030
+ bg,
6031
+ pinCls(ci, "body", bg)
6032
+ ),
6033
+ style: pinStyle(ci),
6034
+ children: [
6035
+ fit(ci, renderCell(c, row)),
6036
+ opener && // The keyboard's and screen reader's way to the row click. It
6037
+ // stays hidden; while it has focus the whole row takes the ring.
6038
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("button", { type: "button", "data-row-open": "", onClick: () => onRowClick(row), className: "sr-only", children: rowClickLabel ? rowClickLabel(row) : `Open ${rowLabel ? rowLabel(row) : "row"}` }),
6039
+ edge(ci)
6040
+ ]
6041
+ },
6042
+ c.key
6043
+ );
6044
+ })
6045
+ ]
6046
+ }
6047
+ ),
6048
+ panelOpen && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("tr", { className: "[&:last-child>td]:border-b-0", children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("td", { id: panelId, colSpan: span, className: "border-b border-border-default bg-subtle px-4 pb-4 pl-14", children: renderExpanded(row) }) }),
6049
+ isOpen && kids?.map(
6050
+ (child, si) => plainRow("sub", child, `${key}::${rowKey(child)}`, highlightRow?.(child) ? TINT : "bg-subtle", { id: kidIds[si], parent: row })
6051
+ )
6052
+ ] }, key);
6053
+ })
6054
+ ] }) })
6055
+ ]
6056
+ }
6057
+ )
5777
6058
  }
5778
- ) }),
6059
+ ),
5779
6060
  refreshing && !loading && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(RefreshLine, {}),
5780
6061
  /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(LongWait, { loading, onRetry, className: "mb-3 px-4" }),
5781
6062
  footer && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "border-t border-border-default px-4 py-3", children: footer })
5782
6063
  ]
5783
6064
  }
5784
6065
  );
5785
- if (!title || inside) return frame;
5786
- return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("section", { "aria-labelledby": titleId, className: cn("flex w-full flex-col gap-3", className), children: [
5787
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(SectionHeading, { id: titleId, as: titleAs, title, description: subtitle, actions: action }),
6066
+ if (inside || !title && barCount === 0) return frame;
6067
+ return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("section", { "aria-labelledby": title ? titleId : void 0, className: cn("flex w-full flex-col gap-3", className), children: [
6068
+ title ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(SectionHeading, { id: titleId, as: titleAs, title, description: subtitle, actions: bar ?? action }) : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "flex justify-end", children: bar }),
5788
6069
  frame
5789
6070
  ] });
5790
6071
  }
@@ -5816,9 +6097,9 @@ function MediaLabel({ type, className, testIdPrefix }) {
5816
6097
  }
5817
6098
 
5818
6099
  // src/SuggestionChip.tsx
5819
- var import_react30 = require("react");
6100
+ var import_react31 = require("react");
5820
6101
  var import_jsx_runtime57 = require("react/jsx-runtime");
5821
- var SuggestionChip = (0, import_react30.forwardRef)(function SuggestionChip2({ children, className, testIdPrefix, type = "button", ...props }, ref) {
6102
+ var SuggestionChip = (0, import_react31.forwardRef)(function SuggestionChip2({ children, className, testIdPrefix, type = "button", ...props }, ref) {
5822
6103
  return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
5823
6104
  "button",
5824
6105
  {
@@ -5837,10 +6118,10 @@ var SuggestionChip = (0, import_react30.forwardRef)(function SuggestionChip2({ c
5837
6118
  SuggestionChip.displayName = "SuggestionChip";
5838
6119
 
5839
6120
  // src/ToggleChip.tsx
5840
- var import_react31 = require("react");
6121
+ var import_react32 = require("react");
5841
6122
  var import_lucide_react30 = require("lucide-react");
5842
6123
  var import_jsx_runtime58 = require("react/jsx-runtime");
5843
- var ToggleChip = (0, import_react31.forwardRef)(function ToggleChip2({ selected, onChange, children, className, testIdPrefix, type = "button", onClick, ...props }, ref) {
6124
+ var ToggleChip = (0, import_react32.forwardRef)(function ToggleChip2({ selected, onChange, children, className, testIdPrefix, type = "button", onClick, ...props }, ref) {
5844
6125
  return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
5845
6126
  "button",
5846
6127
  {
@@ -5868,14 +6149,14 @@ var ToggleChip = (0, import_react31.forwardRef)(function ToggleChip2({ selected,
5868
6149
  ToggleChip.displayName = "ToggleChip";
5869
6150
 
5870
6151
  // src/CopyButton.tsx
5871
- var import_react32 = require("react");
6152
+ var import_react33 = require("react");
5872
6153
  var import_lucide_react31 = require("lucide-react");
5873
6154
  var import_jsx_runtime59 = require("react/jsx-runtime");
5874
6155
  var CONFIRM_MS = 2e3;
5875
- var CopyButton = (0, import_react32.forwardRef)(function CopyButton2({ value, label, "aria-label": ariaLabel, size = "xs", className, testIdPrefix }, ref) {
5876
- const [copied, setCopied] = (0, import_react32.useState)(false);
5877
- const timer = (0, import_react32.useRef)(void 0);
5878
- (0, import_react32.useEffect)(() => () => clearTimeout(timer.current), []);
6156
+ var CopyButton = (0, import_react33.forwardRef)(function CopyButton2({ value, label, "aria-label": ariaLabel, size = "xs", className, testIdPrefix }, ref) {
6157
+ const [copied, setCopied] = (0, import_react33.useState)(false);
6158
+ const timer = (0, import_react33.useRef)(void 0);
6159
+ (0, import_react33.useEffect)(() => () => clearTimeout(timer.current), []);
5879
6160
  const copy = async () => {
5880
6161
  try {
5881
6162
  await navigator.clipboard.writeText(typeof value === "function" ? value() : value);
@@ -5958,7 +6239,7 @@ function InlineMessage({ tone = "info", title, children, actions, onDismiss, cla
5958
6239
  }
5959
6240
 
5960
6241
  // src/FilterDrawer.tsx
5961
- var import_react33 = require("react");
6242
+ var import_react34 = require("react");
5962
6243
  var import_lucide_react33 = require("lucide-react");
5963
6244
  var import_jsx_runtime61 = require("react/jsx-runtime");
5964
6245
  var SLIDE_MS = 200;
@@ -5978,10 +6259,10 @@ function FilterDrawer({
5978
6259
  size = "sm",
5979
6260
  testIdPrefix
5980
6261
  }) {
5981
- const [view, setViewState] = (0, import_react33.useState)(focus);
5982
- const [leaving, setLeaving] = (0, import_react33.useState)(null);
5983
- const [phase, setPhase] = (0, import_react33.useState)("run");
5984
- const [wasOpen, setWasOpen] = (0, import_react33.useState)(open);
6262
+ const [view, setViewState] = (0, import_react34.useState)(focus);
6263
+ const [leaving, setLeaving] = (0, import_react34.useState)(null);
6264
+ const [phase, setPhase] = (0, import_react34.useState)("run");
6265
+ const [wasOpen, setWasOpen] = (0, import_react34.useState)(open);
5985
6266
  if (open !== wasOpen) {
5986
6267
  setWasOpen(open);
5987
6268
  if (open) {
@@ -5996,20 +6277,20 @@ function FilterDrawer({
5996
6277
  }
5997
6278
  setViewState(next);
5998
6279
  };
5999
- (0, import_react33.useLayoutEffect)(() => {
6280
+ (0, import_react34.useLayoutEffect)(() => {
6000
6281
  if (phase !== "start") return;
6001
6282
  const raf = requestAnimationFrame(() => requestAnimationFrame(() => setPhase("run")));
6002
6283
  return () => cancelAnimationFrame(raf);
6003
6284
  }, [phase]);
6004
- (0, import_react33.useEffect)(() => {
6285
+ (0, import_react34.useEffect)(() => {
6005
6286
  if (!leaving || phase !== "run") return;
6006
6287
  const t = setTimeout(() => setLeaving(null), SLIDE_MS);
6007
6288
  return () => clearTimeout(t);
6008
6289
  }, [leaving, phase]);
6009
- const backRef = (0, import_react33.useRef)(null);
6010
- const rowRefs = (0, import_react33.useRef)(/* @__PURE__ */ new Map());
6011
- const lastView = (0, import_react33.useRef)(null);
6012
- (0, import_react33.useEffect)(() => {
6290
+ const backRef = (0, import_react34.useRef)(null);
6291
+ const rowRefs = (0, import_react34.useRef)(/* @__PURE__ */ new Map());
6292
+ const lastView = (0, import_react34.useRef)(null);
6293
+ (0, import_react34.useEffect)(() => {
6013
6294
  if (!open) return;
6014
6295
  if (view) backRef.current?.focus();
6015
6296
  else if (lastView.current) rowRefs.current.get(lastView.current)?.focus();
@@ -6132,10 +6413,10 @@ function SectionMark({ section }) {
6132
6413
  }
6133
6414
 
6134
6415
  // src/AllFiltersButton.tsx
6135
- var import_react34 = require("react");
6416
+ var import_react35 = require("react");
6136
6417
  var import_lucide_react34 = require("lucide-react");
6137
6418
  var import_jsx_runtime62 = require("react/jsx-runtime");
6138
- var AllFiltersButton = (0, import_react34.forwardRef)(function AllFiltersButton2({ count = 0, open, className, testIdPrefix, ...rest }, ref) {
6419
+ var AllFiltersButton = (0, import_react35.forwardRef)(function AllFiltersButton2({ count = 0, open, className, testIdPrefix, ...rest }, ref) {
6139
6420
  return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
6140
6421
  "button",
6141
6422
  {
@@ -6157,7 +6438,7 @@ var AllFiltersButton = (0, import_react34.forwardRef)(function AllFiltersButton2
6157
6438
  });
6158
6439
 
6159
6440
  // src/Menu.tsx
6160
- var import_react35 = require("react");
6441
+ var import_react36 = require("react");
6161
6442
  var import_react_slot2 = require("@radix-ui/react-slot");
6162
6443
  var import_lucide_react35 = require("lucide-react");
6163
6444
  var import_jsx_runtime63 = require("react/jsx-runtime");
@@ -6172,7 +6453,7 @@ function moveFocus(e) {
6172
6453
  const next = e.key === "Home" ? 0 : e.key === "End" ? rows.length - 1 : e.key === "ArrowDown" ? (i + 1) % rows.length : (i - 1 + rows.length) % rows.length;
6173
6454
  rows[next].focus();
6174
6455
  }
6175
- var Menu = (0, import_react35.forwardRef)(
6456
+ var Menu = (0, import_react36.forwardRef)(
6176
6457
  ({ className, testIdPrefix, onKeyDown, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
6177
6458
  "div",
6178
6459
  {
@@ -6190,7 +6471,7 @@ var Menu = (0, import_react35.forwardRef)(
6190
6471
  )
6191
6472
  );
6192
6473
  Menu.displayName = "Menu";
6193
- var MenuItem = (0, import_react35.forwardRef)(
6474
+ var MenuItem = (0, import_react36.forwardRef)(
6194
6475
  ({ className, testIdPrefix, icon, trailing, description, submenu, checked, danger, disabled, asChild = false, children, ...props }, ref) => {
6195
6476
  const Comp = asChild ? import_react_slot2.Slot : "button";
6196
6477
  const radio = checked !== void 0;