@agg-build/ui 2.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/{chunk-2UKDQ7WP.mjs → chunk-3OI2ZLLT.mjs} +94 -39
  2. package/dist/{chunk-4CM4F4S6.mjs → chunk-C5M2OOM3.mjs} +1 -1
  3. package/dist/{chunk-2ZS3BPSF.mjs → chunk-DXF2LMNN.mjs} +132 -81
  4. package/dist/{chunk-RWOF44TC.mjs → chunk-R6FBYAY5.mjs} +239 -183
  5. package/dist/{chunk-RF2EPYLN.mjs → chunk-Y6PVXAUQ.mjs} +27 -77
  6. package/dist/{chunk-R3U6YXSQ.mjs → chunk-YAEA6EDG.mjs} +31 -18
  7. package/dist/{chunk-HH7L3KLS.mjs → chunk-YMVD6Q2A.mjs} +1 -1
  8. package/dist/events.js +497 -462
  9. package/dist/events.mjs +3 -3
  10. package/dist/index.js +2116 -1990
  11. package/dist/index.mjs +9 -7
  12. package/dist/modals.js +278 -171
  13. package/dist/modals.mjs +5 -3
  14. package/dist/pages.js +1557 -1487
  15. package/dist/pages.mjs +6 -6
  16. package/dist/primitives.js +137 -86
  17. package/dist/primitives.mjs +1 -1
  18. package/dist/styles.css +1 -1
  19. package/dist/tailwind.css +1 -1
  20. package/dist/trading.js +28 -15
  21. package/dist/trading.mjs +4 -4
  22. package/dist/types/events/list/category-sidebar.d.mts +33 -0
  23. package/dist/types/events/list/category-sidebar.d.ts +33 -0
  24. package/dist/types/events/list/event-list-tabs.d.mts +2 -0
  25. package/dist/types/events/list/event-list-tabs.d.ts +2 -0
  26. package/dist/types/events/list/index.d.mts +1 -0
  27. package/dist/types/events/list/index.d.ts +1 -0
  28. package/dist/types/pages/event-market/event-market.types.d.mts +1 -0
  29. package/dist/types/pages/event-market/event-market.types.d.ts +1 -0
  30. package/dist/types/pages/user-profile/index.d.mts +1 -1
  31. package/dist/types/pages/user-profile/index.d.ts +1 -1
  32. package/dist/types/pages/user-profile/user-profile.types.d.mts +1 -0
  33. package/dist/types/pages/user-profile/user-profile.types.d.ts +1 -0
  34. package/dist/types/shared/use-horizontal-scroll-state.d.mts +15 -0
  35. package/dist/types/shared/use-horizontal-scroll-state.d.ts +15 -0
  36. package/dist/types/withdraw/index.d.mts +9 -1
  37. package/dist/types/withdraw/index.d.ts +9 -1
  38. package/dist/types/withdraw/steps/withdraw-amount.d.mts +10 -1
  39. package/dist/types/withdraw/steps/withdraw-amount.d.ts +10 -1
  40. package/dist/types/withdraw/withdraw-modal.types.d.mts +8 -0
  41. package/dist/types/withdraw/withdraw-modal.types.d.ts +8 -0
  42. package/package.json +3 -3
package/dist/events.js CHANGED
@@ -82,7 +82,7 @@ module.exports = __toCommonJS(events_exports);
82
82
 
83
83
  // src/events/item/index.tsx
84
84
  var import_hooks31 = require("@agg-build/hooks");
85
- var import_react9 = require("react");
85
+ var import_react10 = require("react");
86
86
 
87
87
  // src/constants.ts
88
88
  var AGG_ROOT_CLASS_NAME = "agg-root";
@@ -6386,7 +6386,37 @@ StateMessage.displayName = "StateMessage";
6386
6386
 
6387
6387
  // src/primitives/tabs/index.tsx
6388
6388
  var import_hooks29 = require("@agg-build/hooks");
6389
+ var import_react8 = require("react");
6390
+
6391
+ // src/shared/use-horizontal-scroll-state.ts
6389
6392
  var import_react7 = require("react");
6393
+ var useHorizontalScrollState = () => {
6394
+ const containerRef = (0, import_react7.useRef)(null);
6395
+ const [canScrollLeft, setCanScrollLeft] = (0, import_react7.useState)(false);
6396
+ const [canScrollRight, setCanScrollRight] = (0, import_react7.useState)(false);
6397
+ const update = (0, import_react7.useCallback)(() => {
6398
+ const el = containerRef.current;
6399
+ if (!el) return;
6400
+ const maxScroll = el.scrollWidth - el.clientWidth;
6401
+ setCanScrollLeft(el.scrollLeft > 4);
6402
+ setCanScrollRight(maxScroll - el.scrollLeft > 4);
6403
+ }, []);
6404
+ (0, import_react7.useEffect)(() => {
6405
+ const el = containerRef.current;
6406
+ if (!el) return;
6407
+ el.addEventListener("scroll", update, { passive: true });
6408
+ return () => el.removeEventListener("scroll", update);
6409
+ }, [update]);
6410
+ (0, import_react7.useEffect)(() => {
6411
+ if (typeof ResizeObserver === "undefined") return;
6412
+ const el = containerRef.current;
6413
+ if (!el) return;
6414
+ const ro = new ResizeObserver(() => update());
6415
+ ro.observe(el);
6416
+ return () => ro.disconnect();
6417
+ }, [update]);
6418
+ return { containerRef, canScrollLeft, canScrollRight, update };
6419
+ };
6390
6420
 
6391
6421
  // src/primitives/tabs/tabs.constants.ts
6392
6422
  var MOBILE_TABS_MEDIA_QUERY = "(max-width: 736px)";
@@ -6460,8 +6490,8 @@ var Tabs = ({
6460
6490
  const {
6461
6491
  features: { enableAnimations }
6462
6492
  } = (0, import_hooks29.useSdkUiConfig)();
6463
- const buttonRefs = (0, import_react7.useRef)([]);
6464
- const dragStateRef = (0, import_react7.useRef)({
6493
+ const buttonRefs = (0, import_react8.useRef)([]);
6494
+ const dragStateRef = (0, import_react8.useRef)({
6465
6495
  isPointerDown: false,
6466
6496
  isDragging: false,
6467
6497
  pointerId: null,
@@ -6469,29 +6499,30 @@ var Tabs = ({
6469
6499
  startClientY: 0,
6470
6500
  startScrollLeft: 0
6471
6501
  });
6472
- const suppressClickRef = (0, import_react7.useRef)(false);
6502
+ const suppressClickRef = (0, import_react8.useRef)(false);
6473
6503
  const resolvedAriaLabel = ariaLabel != null ? ariaLabel : labels.common.tabsAria;
6474
- const [isMobileViewport, setIsMobileViewport] = (0, import_react7.useState)(false);
6475
- const [isDraggingTabs, setIsDraggingTabs] = (0, import_react7.useState)(false);
6476
- const [activeUnderlineStyle, setActiveUnderlineStyle] = (0, import_react7.useState)({
6504
+ const [isMobileViewport, setIsMobileViewport] = (0, import_react8.useState)(false);
6505
+ const [isDraggingTabs, setIsDraggingTabs] = (0, import_react8.useState)(false);
6506
+ const [activeUnderlineStyle, setActiveUnderlineStyle] = (0, import_react8.useState)({
6477
6507
  transform: "translateX(0px)",
6478
6508
  width: 0,
6479
6509
  opacity: 0
6480
6510
  });
6481
- const [scrollAffordanceState, setScrollAffordanceState] = (0, import_react7.useState)({
6482
- showStart: false,
6483
- showEnd: false
6484
- });
6485
- const tabListRef = (0, import_react7.useRef)(null);
6511
+ const {
6512
+ containerRef: tabListRef,
6513
+ canScrollLeft,
6514
+ canScrollRight,
6515
+ update: updateScrollState
6516
+ } = useHorizontalScrollState();
6486
6517
  const isBarVariant = variant === "bar";
6487
- const resolvedOverflowBehavior = (0, import_react7.useMemo)(() => {
6518
+ const resolvedOverflowBehavior = (0, import_react8.useMemo)(() => {
6488
6519
  if (overflowBehavior) return overflowBehavior;
6489
6520
  if (!isBarVariant) return "scroll";
6490
6521
  return isMobileViewport ? "select" : "scroll";
6491
6522
  }, [isBarVariant, isMobileViewport, overflowBehavior]);
6492
6523
  const shouldUseOverflowScroll = resolvedOverflowBehavior === "scroll";
6493
6524
  const shouldUseOverflowSelect = resolvedOverflowBehavior === "select";
6494
- (0, import_react7.useEffect)(() => {
6525
+ (0, import_react8.useEffect)(() => {
6495
6526
  if (typeof window === "undefined") return;
6496
6527
  const mediaQueryList = window.matchMedia(MOBILE_TABS_MEDIA_QUERY);
6497
6528
  const handleMediaQueryChange = (event) => {
@@ -6509,28 +6540,12 @@ var Tabs = ({
6509
6540
  mediaQueryList.removeListener(handleMediaQueryChange);
6510
6541
  };
6511
6542
  }, []);
6512
- const updateScrollAffordances = (0, import_react7.useCallback)(() => {
6513
- if (!shouldUseOverflowScroll) {
6514
- setScrollAffordanceState({
6515
- showStart: false,
6516
- showEnd: false
6517
- });
6518
- return;
6519
- }
6520
- const tabListElement = tabListRef.current;
6521
- if (!tabListElement) return;
6522
- const maxScrollLeft = tabListElement.scrollWidth - tabListElement.clientWidth;
6523
- setScrollAffordanceState({
6524
- showStart: tabListElement.scrollLeft > 4,
6525
- showEnd: maxScrollLeft - tabListElement.scrollLeft > 4
6526
- });
6527
- }, [shouldUseOverflowScroll]);
6528
- const renderedItems = (0, import_react7.useMemo)(() => {
6543
+ const renderedItems = (0, import_react8.useMemo)(() => {
6529
6544
  return items.map((item) => __spreadProps(__spreadValues({}, item), {
6530
6545
  disabled: item.disabled || item.isComingSoon
6531
6546
  }));
6532
6547
  }, [items]);
6533
- const selectItems = (0, import_react7.useMemo)(() => {
6548
+ const selectItems = (0, import_react8.useMemo)(() => {
6534
6549
  return renderedItems.map((item) => ({
6535
6550
  value: item.value,
6536
6551
  label: item.isComingSoon ? `${item.label} (soon)` : item.label,
@@ -6663,7 +6678,7 @@ var Tabs = ({
6663
6678
  event == null ? void 0 : event.stopPropagation();
6664
6679
  suppressClickRef.current = false;
6665
6680
  };
6666
- const updateActiveUnderline = (0, import_react7.useCallback)(() => {
6681
+ const updateActiveUnderline = (0, import_react8.useCallback)(() => {
6667
6682
  if (isBarVariant) {
6668
6683
  setActiveUnderlineStyle({
6669
6684
  transform: "translateX(0px)",
@@ -6686,42 +6701,39 @@ var Tabs = ({
6686
6701
  opacity: 1
6687
6702
  });
6688
6703
  }, [isBarVariant, renderedItems, value]);
6689
- (0, import_react7.useLayoutEffect)(() => {
6704
+ (0, import_react8.useLayoutEffect)(() => {
6690
6705
  updateActiveUnderline();
6691
6706
  }, [updateActiveUnderline]);
6692
- (0, import_react7.useEffect)(() => {
6707
+ (0, import_react8.useEffect)(() => {
6693
6708
  if (isBarVariant || !shouldUseOverflowScroll) return;
6694
6709
  const tabListElement = tabListRef.current;
6695
6710
  if (!tabListElement) return;
6696
6711
  const handleScroll = () => {
6697
6712
  updateActiveUnderline();
6698
- updateScrollAffordances();
6699
6713
  };
6700
6714
  tabListElement.addEventListener("scroll", handleScroll, { passive: true });
6701
- updateScrollAffordances();
6702
6715
  return () => {
6703
6716
  tabListElement.removeEventListener("scroll", handleScroll);
6704
6717
  };
6705
- }, [isBarVariant, shouldUseOverflowScroll, updateActiveUnderline, updateScrollAffordances]);
6706
- (0, import_react7.useEffect)(() => {
6718
+ }, [isBarVariant, shouldUseOverflowScroll, tabListRef, updateActiveUnderline]);
6719
+ (0, import_react8.useEffect)(() => {
6707
6720
  if (!shouldUseOverflowScroll) return;
6708
- updateScrollAffordances();
6709
- }, [renderedItems, shouldUseOverflowScroll, updateScrollAffordances, value]);
6710
- (0, import_react7.useEffect)(() => {
6711
- if (isBarVariant && !shouldUseOverflowScroll) return;
6721
+ updateScrollState();
6722
+ }, [renderedItems, shouldUseOverflowScroll, updateScrollState, value]);
6723
+ (0, import_react8.useEffect)(() => {
6724
+ if (isBarVariant || !shouldUseOverflowScroll) return;
6712
6725
  if (typeof ResizeObserver === "undefined") return;
6713
6726
  const tabListElement = tabListRef.current;
6714
6727
  if (!tabListElement) return;
6715
6728
  const resizeObserver = new ResizeObserver(() => {
6716
6729
  updateActiveUnderline();
6717
- updateScrollAffordances();
6718
6730
  });
6719
6731
  resizeObserver.observe(tabListElement);
6720
6732
  return () => {
6721
6733
  resizeObserver.disconnect();
6722
6734
  };
6723
- }, [isBarVariant, shouldUseOverflowScroll, updateActiveUnderline, updateScrollAffordances]);
6724
- (0, import_react7.useEffect)(() => {
6735
+ }, [isBarVariant, shouldUseOverflowScroll, tabListRef, updateActiveUnderline]);
6736
+ (0, import_react8.useEffect)(() => {
6725
6737
  if (!shouldUseOverflowScroll) return;
6726
6738
  const tabListElement = tabListRef.current;
6727
6739
  if (!tabListElement) return;
@@ -6868,7 +6880,7 @@ var Tabs = ({
6868
6880
  "agg-tab-scroll-start",
6869
6881
  "pointer-events-none absolute top-0 bottom-0 left-0 z-10 w-12 md:w-18 bg-linear-to-r from-agg-secondary via-agg-secondary to-transparent",
6870
6882
  getMotionClassName(enableAnimations, "transition-opacity duration-200"),
6871
- scrollAffordanceState.showStart ? "opacity-100" : "opacity-0"
6883
+ canScrollLeft ? "opacity-100" : "opacity-0"
6872
6884
  )
6873
6885
  }
6874
6886
  ),
@@ -6880,24 +6892,63 @@ var Tabs = ({
6880
6892
  "agg-tab-scroll-end",
6881
6893
  "pointer-events-none absolute top-0 right-0 bottom-0 z-10 w-12 md:w-18 bg-linear-to-l from-agg-secondary via-agg-secondary to-transparent",
6882
6894
  getMotionClassName(enableAnimations, "transition-opacity duration-200"),
6883
- scrollAffordanceState.showEnd ? "opacity-100" : "opacity-0"
6895
+ canScrollRight ? "opacity-100" : "opacity-0"
6884
6896
  )
6885
6897
  }
6886
6898
  )
6887
6899
  ] }) : null,
6888
- shouldUseOverflowScroll && isBarVariant ? /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
6889
- "span",
6890
- {
6891
- "aria-hidden": true,
6892
- className: cn(
6893
- "agg-tab-scroll-end",
6894
- "pointer-events-none absolute top-0 right-0 bottom-0 z-10 w-[120px] overflow-hidden rounded-r-[8px] bg-linear-to-l from-agg-secondary from-[20%] via-agg-secondary/85 to-transparent",
6895
- getMotionClassName(enableAnimations, "transition-opacity duration-200"),
6896
- scrollAffordanceState.showEnd ? "opacity-100" : "opacity-0"
6897
- ),
6898
- children: /* @__PURE__ */ (0, import_jsx_runtime116.jsx)("span", { className: "absolute inset-y-0 right-3 inline-flex items-center text-agg-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(Icon, { name: "chevron-right", size: "small", color: "currentColor" }) })
6899
- }
6900
- ) : null
6900
+ shouldUseOverflowScroll && isBarVariant ? /* @__PURE__ */ (0, import_jsx_runtime116.jsxs)(import_jsx_runtime116.Fragment, { children: [
6901
+ /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
6902
+ "button",
6903
+ {
6904
+ type: "button",
6905
+ "aria-label": labels.common.scrollTabsLeft,
6906
+ tabIndex: -1,
6907
+ className: cn(
6908
+ "agg-tab-scroll-start",
6909
+ "absolute top-0 bottom-0 left-0 z-10 w-20 rounded-l-agg-lg",
6910
+ "inline-flex items-center justify-start pl-2",
6911
+ "bg-linear-to-r from-agg-secondary from-[25%] via-agg-secondary/80 to-transparent",
6912
+ "cursor-pointer",
6913
+ getMotionClassName(enableAnimations, "transition-opacity duration-200"),
6914
+ canScrollLeft ? "opacity-100" : "opacity-0 pointer-events-none"
6915
+ ),
6916
+ onClick: () => {
6917
+ var _a;
6918
+ (_a = tabListRef.current) == null ? void 0 : _a.scrollBy({
6919
+ left: -200,
6920
+ behavior: getScrollBehavior(enableAnimations)
6921
+ });
6922
+ },
6923
+ children: /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(Icon, { name: "chevron-left", size: "small", color: "currentColor" })
6924
+ }
6925
+ ),
6926
+ /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
6927
+ "button",
6928
+ {
6929
+ type: "button",
6930
+ "aria-label": labels.common.scrollTabsRight,
6931
+ tabIndex: -1,
6932
+ className: cn(
6933
+ "agg-tab-scroll-end",
6934
+ "absolute top-0 right-0 bottom-0 z-10 w-20 rounded-r-agg-lg",
6935
+ "inline-flex items-center justify-end pr-2",
6936
+ "bg-linear-to-l from-agg-secondary from-[25%] via-agg-secondary/80 to-transparent",
6937
+ "cursor-pointer",
6938
+ getMotionClassName(enableAnimations, "transition-opacity duration-200"),
6939
+ canScrollRight ? "opacity-100" : "opacity-0 pointer-events-none"
6940
+ ),
6941
+ onClick: () => {
6942
+ var _a;
6943
+ (_a = tabListRef.current) == null ? void 0 : _a.scrollBy({
6944
+ left: 200,
6945
+ behavior: getScrollBehavior(enableAnimations)
6946
+ });
6947
+ },
6948
+ children: /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(Icon, { name: "chevron-right", size: "small", color: "currentColor" })
6949
+ }
6950
+ )
6951
+ ] }) : null
6901
6952
  ]
6902
6953
  }
6903
6954
  );
@@ -6907,7 +6958,7 @@ Tabs.displayName = "Tabs";
6907
6958
  // src/primitives/tooltip/index.tsx
6908
6959
  var import_hooks30 = require("@agg-build/hooks");
6909
6960
  var TooltipPrimitive = __toESM(require("@radix-ui/react-tooltip"));
6910
- var import_react8 = require("react");
6961
+ var import_react9 = require("react");
6911
6962
 
6912
6963
  // src/primitives/tooltip/tooltip.constants.ts
6913
6964
  var tooltipSizeClasses = {
@@ -6955,7 +7006,7 @@ var Tooltip = ({
6955
7006
  general: { rootClassName },
6956
7007
  features: { enableAnimations }
6957
7008
  } = (0, import_hooks30.useSdkUiConfig)();
6958
- const trigger = (0, import_react8.useMemo)(() => {
7009
+ const trigger = (0, import_react9.useMemo)(() => {
6959
7010
  if (children) return children;
6960
7011
  return /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(
6961
7012
  "button",
@@ -7292,17 +7343,17 @@ var EventListItemContent = ({
7292
7343
  var _a;
7293
7344
  const config = (0, import_hooks31.useSdkUiConfig)();
7294
7345
  const labels = (0, import_hooks31.useLabels)();
7295
- const allVenueMarkets = (0, import_react9.useMemo)(() => event.venueMarkets, [event.venueMarkets]);
7346
+ const allVenueMarkets = (0, import_react10.useMemo)(() => event.venueMarkets, [event.venueMarkets]);
7296
7347
  const resolvedTitle = event.title;
7297
7348
  const resolvedImage = event.image;
7298
- const visibleVenueLogos = (0, import_react9.useMemo)(() => {
7349
+ const visibleVenueLogos = (0, import_react10.useMemo)(() => {
7299
7350
  var _a2;
7300
7351
  return (0, import_hooks31.sortVenues)(Array.from(new Set(((_a2 = event.venues) != null ? _a2 : []).map((venue) => venue))));
7301
7352
  }, [event.venues]);
7302
7353
  const resolvedMarketCount = typeof event.marketCount === "number" && Number.isFinite(event.marketCount) ? Math.max(0, Math.floor(event.marketCount)) : allVenueMarkets.length;
7303
7354
  const resolvedVenueCount = typeof event.venueCount === "number" && Number.isFinite(event.venueCount) ? Math.max(0, Math.floor(event.venueCount)) : visibleVenueLogos.length;
7304
- const [isLazyMarketsQueryEnabled, setIsLazyMarketsQueryEnabled] = (0, import_react9.useState)(false);
7305
- const shouldEnableLazyMarketLoading = (0, import_react9.useMemo)(() => {
7355
+ const [isLazyMarketsQueryEnabled, setIsLazyMarketsQueryEnabled] = (0, import_react10.useState)(false);
7356
+ const shouldEnableLazyMarketLoading = (0, import_react10.useMemo)(() => {
7306
7357
  if (!event.id) return false;
7307
7358
  const hasExplicitMarketCount = typeof event.marketCount === "number" && Number.isFinite(event.marketCount);
7308
7359
  if (hasExplicitMarketCount) {
@@ -7323,11 +7374,11 @@ var EventListItemContent = ({
7323
7374
  sortDir: "desc",
7324
7375
  status: marketStatus
7325
7376
  });
7326
- const resolvedOutcomeMarkets = (0, import_react9.useMemo)(() => {
7377
+ const resolvedOutcomeMarkets = (0, import_react10.useMemo)(() => {
7327
7378
  if (!isLazyMarketsQueryEnabled || lazyLoadedMarkets.length === 0) return allVenueMarkets;
7328
7379
  return dedupeVenueMarketsById([...allVenueMarkets, ...lazyLoadedMarkets]);
7329
7380
  }, [allVenueMarkets, isLazyMarketsQueryEnabled, lazyLoadedMarkets]);
7330
- const midpointVenueMarketIds = (0, import_react9.useMemo)(() => {
7381
+ const midpointVenueMarketIds = (0, import_react10.useMemo)(() => {
7331
7382
  var _a2;
7332
7383
  const ids = [];
7333
7384
  for (const market of resolvedOutcomeMarkets) {
@@ -7344,27 +7395,27 @@ var EventListItemContent = ({
7344
7395
  });
7345
7396
  const { prices: displayMidpointsByOutcomeId, isLoading: isOutcomeMidpointsLoading } = (0, import_hooks31.useMidpoints)(resolvedOutcomeMarkets);
7346
7397
  const isAwaitingMidpoints = isOutcomeMidpointsLoading || midpointVenueMarketIds.length > 0 && isVenueMarketMidpointsLoading;
7347
- const displayPriceByOutcomeId = (0, import_react9.useMemo)(() => {
7398
+ const displayPriceByOutcomeId = (0, import_react10.useMemo)(() => {
7348
7399
  const priceByOutcomeId = new Map(displayMidpointsByOutcomeId);
7349
7400
  for (const [outcomeId, price] of buildOutcomeMidpointsByOutcomeId(midpointRows)) {
7350
7401
  priceByOutcomeId.set(outcomeId, price);
7351
7402
  }
7352
7403
  return priceByOutcomeId;
7353
7404
  }, [displayMidpointsByOutcomeId, midpointRows]);
7354
- const comparison = (0, import_react9.useMemo)(() => {
7405
+ const comparison = (0, import_react10.useMemo)(() => {
7355
7406
  return normalizeEventListItemV2Comparison({
7356
7407
  venueMarkets: resolvedOutcomeMarkets,
7357
7408
  marketCount: resolvedMarketCount,
7358
7409
  priceByOutcomeId: displayPriceByOutcomeId
7359
7410
  });
7360
7411
  }, [displayPriceByOutcomeId, resolvedMarketCount, resolvedOutcomeMarkets]);
7361
- const gapsByVenueMarketId = (0, import_react9.useMemo)(() => {
7412
+ const gapsByVenueMarketId = (0, import_react10.useMemo)(() => {
7362
7413
  return computePriceGapsFromComparisonRows(comparison.rows);
7363
7414
  }, [comparison.rows]);
7364
7415
  const shouldRenderLoadingOutcomeRow = shouldEnableLazyMarketLoading && (!isLazyMarketsQueryEnabled || isLoadingLazyMarkets || isFetchingNextLazyMarketsPage || hasNextLazyMarketsPage);
7365
7416
  const resolvedVolume = (_a = resolveDisplayVolume(event.volume, allVenueMarkets)) != null ? _a : 0;
7366
7417
  const volumeLabel = `${config.formatting.formatCompactCurrency(resolvedVolume)} ${labels.eventItem.volumeSuffix}`;
7367
- const orderedFooterVenues = (0, import_react9.useMemo)(() => {
7418
+ const orderedFooterVenues = (0, import_react10.useMemo)(() => {
7368
7419
  const venues = visibleVenueLogos.length > 0 ? visibleVenueLogos : comparison.matchedVenues.length > 0 ? comparison.matchedVenues : event.venue ? [event.venue] : [];
7369
7420
  return Array.from(new Set(venues));
7370
7421
  }, [comparison.matchedVenues, event.venue, visibleVenueLogos]);
@@ -7425,7 +7476,7 @@ var EventListItemContent = ({
7425
7476
  onEventClick == null ? void 0 : onEventClick(event);
7426
7477
  }
7427
7478
  };
7428
- const handleOutcomesScroll = (0, import_react9.useCallback)(
7479
+ const handleOutcomesScroll = (0, import_react10.useCallback)(
7429
7480
  (eventToHandle) => {
7430
7481
  if (!shouldEnableLazyMarketLoading) return;
7431
7482
  const element = eventToHandle.currentTarget;
@@ -7753,7 +7804,7 @@ var EventListItemByEventId = (_a) => {
7753
7804
  eventId: eventId != null ? eventId : "",
7754
7805
  enabled: !!eventId
7755
7806
  });
7756
- const resolvedEvent = (0, import_react9.useMemo)(() => {
7807
+ const resolvedEvent = (0, import_react10.useMemo)(() => {
7757
7808
  return resolveEventListItemEvent(fetchedEvent);
7758
7809
  }, [fetchedEvent]);
7759
7810
  if (!eventId) {
@@ -7791,11 +7842,11 @@ EventListItemV2.displayName = "EventListItemV2";
7791
7842
 
7792
7843
  // src/events/item-details/index.tsx
7793
7844
  var import_hooks40 = require("@agg-build/hooks");
7794
- var import_react15 = require("react");
7845
+ var import_react16 = require("react");
7795
7846
 
7796
7847
  // src/primitives/chart/chart-type-switch.tsx
7797
7848
  var import_hooks32 = require("@agg-build/hooks");
7798
- var import_react10 = require("react");
7849
+ var import_react11 = require("react");
7799
7850
 
7800
7851
  // src/primitives/chart/chart-type-switch.constants.ts
7801
7852
  var CHART_TYPE_SWITCH_OPTION_KEYS = ["line", "candlestick"];
@@ -7827,7 +7878,7 @@ var ChartTypeSwitch = ({
7827
7878
  className
7828
7879
  }) => {
7829
7880
  const labels = (0, import_hooks32.useLabels)();
7830
- const options = (0, import_react10.useMemo)(
7881
+ const options = (0, import_react11.useMemo)(
7831
7882
  () => CHART_TYPE_SWITCH_OPTION_KEYS.map((chartType) => ({
7832
7883
  value: chartType,
7833
7884
  iconName: resolveChartTypeOptionIconName(chartType),
@@ -9044,7 +9095,7 @@ var getDisplayOutcomePrice = ({
9044
9095
 
9045
9096
  // src/events/item-details/event-list-item-details-market-selector.tsx
9046
9097
  var import_hooks36 = require("@agg-build/hooks");
9047
- var import_react11 = require("react");
9098
+ var import_react12 = require("react");
9048
9099
  var import_jsx_runtime120 = require("react/jsx-runtime");
9049
9100
  var MARKET_PILL_MAX_ROWS = 2;
9050
9101
  var MARKET_PILL_FALLBACK_CONTAINER_WIDTH = 640;
@@ -9141,38 +9192,38 @@ var EventListItemDetailsMarketSelector = ({
9141
9192
  }) => {
9142
9193
  var _a;
9143
9194
  const labels = (0, import_hooks36.useLabels)();
9144
- const containerRef = (0, import_react11.useRef)(null);
9145
- const measurementContainerRef = (0, import_react11.useRef)(null);
9146
- const moreButtonRef = (0, import_react11.useRef)(null);
9147
- const dropdownInputRef = (0, import_react11.useRef)(null);
9148
- const moreButtonMeasureRef = (0, import_react11.useRef)(null);
9149
- const optionMeasureRefs = (0, import_react11.useRef)({});
9150
- const [layout, setLayout] = (0, import_react11.useState)(() => ({
9195
+ const containerRef = (0, import_react12.useRef)(null);
9196
+ const measurementContainerRef = (0, import_react12.useRef)(null);
9197
+ const moreButtonRef = (0, import_react12.useRef)(null);
9198
+ const dropdownInputRef = (0, import_react12.useRef)(null);
9199
+ const moreButtonMeasureRef = (0, import_react12.useRef)(null);
9200
+ const optionMeasureRefs = (0, import_react12.useRef)({});
9201
+ const [layout, setLayout] = (0, import_react12.useState)(() => ({
9151
9202
  visibleItems: options,
9152
9203
  hiddenItems: []
9153
9204
  }));
9154
- const [isDropdownOpen, setIsDropdownOpen] = (0, import_react11.useState)(false);
9155
- const [isMobileViewport, setIsMobileViewport] = (0, import_react11.useState)(false);
9156
- const [searchValue, setSearchValue] = (0, import_react11.useState)("");
9157
- const [dropdownPosition, setDropdownPosition] = (0, import_react11.useState)({
9205
+ const [isDropdownOpen, setIsDropdownOpen] = (0, import_react12.useState)(false);
9206
+ const [isMobileViewport, setIsMobileViewport] = (0, import_react12.useState)(false);
9207
+ const [searchValue, setSearchValue] = (0, import_react12.useState)("");
9208
+ const [dropdownPosition, setDropdownPosition] = (0, import_react12.useState)({
9158
9209
  left: 0,
9159
9210
  top: 0,
9160
9211
  width: 0
9161
9212
  });
9162
- const selectedHiddenOption = (0, import_react11.useMemo)(() => {
9213
+ const selectedHiddenOption = (0, import_react12.useMemo)(() => {
9163
9214
  var _a2;
9164
9215
  return (_a2 = layout.hiddenItems.find((option) => option.value === selectedValue)) != null ? _a2 : null;
9165
9216
  }, [layout.hiddenItems, selectedValue]);
9166
9217
  const moreButtonLabel = (_a = selectedHiddenOption == null ? void 0 : selectedHiddenOption.label) != null ? _a : MARKET_PILL_MORE_LABEL;
9167
9218
  const isMoreButtonSelected = selectedHiddenOption != null;
9168
- const filteredOptions = (0, import_react11.useMemo)(() => {
9219
+ const filteredOptions = (0, import_react12.useMemo)(() => {
9169
9220
  const normalizedSearchValue = searchValue.trim().toLowerCase();
9170
9221
  if (!normalizedSearchValue) return options;
9171
9222
  return options.filter((option) => option.label.toLowerCase().includes(normalizedSearchValue));
9172
9223
  }, [options, searchValue]);
9173
- const lastMeasuredKeyRef = (0, import_react11.useRef)(null);
9174
- const measureFrameRef = (0, import_react11.useRef)(null);
9175
- (0, import_react11.useLayoutEffect)(() => {
9224
+ const lastMeasuredKeyRef = (0, import_react12.useRef)(null);
9225
+ const measureFrameRef = (0, import_react12.useRef)(null);
9226
+ (0, import_react12.useLayoutEffect)(() => {
9176
9227
  const measureLayout = () => {
9177
9228
  var _a2, _b, _c, _d, _e;
9178
9229
  const measurementContainer = measurementContainerRef.current;
@@ -9253,7 +9304,7 @@ var EventListItemDetailsMarketSelector = ({
9253
9304
  }
9254
9305
  };
9255
9306
  }, [moreButtonLabel, options]);
9256
- (0, import_react11.useEffect)(() => {
9307
+ (0, import_react12.useEffect)(() => {
9257
9308
  if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
9258
9309
  const mediaQueryList = window.matchMedia(MOBILE_TABS_MEDIA_QUERY);
9259
9310
  const handleMediaQueryChange = (event) => {
@@ -9271,7 +9322,7 @@ var EventListItemDetailsMarketSelector = ({
9271
9322
  mediaQueryList.removeListener(handleMediaQueryChange);
9272
9323
  };
9273
9324
  }, []);
9274
- (0, import_react11.useEffect)(() => {
9325
+ (0, import_react12.useEffect)(() => {
9275
9326
  if (!isDropdownOpen) {
9276
9327
  setSearchValue("");
9277
9328
  return;
@@ -9284,7 +9335,7 @@ var EventListItemDetailsMarketSelector = ({
9284
9335
  window.cancelAnimationFrame(animationFrameId);
9285
9336
  };
9286
9337
  }, [isDropdownOpen]);
9287
- (0, import_react11.useLayoutEffect)(() => {
9338
+ (0, import_react12.useLayoutEffect)(() => {
9288
9339
  if (!isDropdownOpen || isMobileViewport) return;
9289
9340
  const updateDropdownPosition = () => {
9290
9341
  const containerElement = containerRef.current;
@@ -9320,7 +9371,7 @@ var EventListItemDetailsMarketSelector = ({
9320
9371
  resizeObserver.disconnect();
9321
9372
  };
9322
9373
  }, [isDropdownOpen, isMobileViewport, moreButtonLabel]);
9323
- (0, import_react11.useEffect)(() => {
9374
+ (0, import_react12.useEffect)(() => {
9324
9375
  if (!isDropdownOpen) return;
9325
9376
  const handlePointerDown = (event) => {
9326
9377
  var _a2;
@@ -9567,11 +9618,11 @@ var EventListItemDetailsMarketSelector = ({
9567
9618
 
9568
9619
  // src/events/item-details/settlement-summary.tsx
9569
9620
  var import_hooks39 = require("@agg-build/hooks");
9570
- var import_react14 = require("react");
9621
+ var import_react15 = require("react");
9571
9622
 
9572
9623
  // src/trading/settlement/index.tsx
9573
9624
  var import_hooks38 = require("@agg-build/hooks");
9574
- var import_react13 = require("react");
9625
+ var import_react14 = require("react");
9575
9626
 
9576
9627
  // src/trading/utils.ts
9577
9628
  var import_hooks37 = require("@agg-build/hooks");
@@ -9581,7 +9632,7 @@ var defaultSettlementSectionLabel = defaultLabels.trading.settlementSection;
9581
9632
  var defaultTradingDisclaimer = defaultLabels.trading.disclaimer;
9582
9633
 
9583
9634
  // src/trading/settlement/settlement-text-renderer.tsx
9584
- var import_react12 = require("react");
9635
+ var import_react13 = require("react");
9585
9636
 
9586
9637
  // src/trading/settlement/settlement-text.utils.ts
9587
9638
  var stripHtmlFragments = (text) => {
@@ -9673,7 +9724,7 @@ var renderInlineSegment = (text, baseKey) => {
9673
9724
  }
9674
9725
  if (match.index > lastIndex) {
9675
9726
  nodes.push(
9676
- /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(import_react12.Fragment, { children: text.slice(lastIndex, match.index) }, `${baseKey}-text-${segmentIndex++}`)
9727
+ /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(import_react13.Fragment, { children: text.slice(lastIndex, match.index) }, `${baseKey}-text-${segmentIndex++}`)
9677
9728
  );
9678
9729
  }
9679
9730
  if (isLinkMatch(match)) {
@@ -9731,7 +9782,7 @@ var renderInlineSegment = (text, baseKey) => {
9731
9782
  }
9732
9783
  if (lastIndex < text.length) {
9733
9784
  nodes.push(
9734
- /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(import_react12.Fragment, { children: text.slice(lastIndex) }, `${baseKey}-text-${segmentIndex++}`)
9785
+ /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(import_react13.Fragment, { children: text.slice(lastIndex) }, `${baseKey}-text-${segmentIndex++}`)
9735
9786
  );
9736
9787
  }
9737
9788
  return nodes;
@@ -9758,7 +9809,7 @@ var renderBlock = (block, blockIndex) => {
9758
9809
  "p",
9759
9810
  {
9760
9811
  className: "agg-settlement-text-paragraph text-agg-sm leading-agg-5 text-agg-foreground break-words [overflow-wrap:anywhere]",
9761
- children: block.lines.map((line, lineIndex) => /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(import_react12.Fragment, { children: [
9812
+ children: block.lines.map((line, lineIndex) => /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(import_react13.Fragment, { children: [
9762
9813
  lineIndex > 0 ? /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("br", {}) : null,
9763
9814
  renderInlineSegment(line, `block-${blockIndex}-line-${lineIndex}`)
9764
9815
  ] }, `block-${blockIndex}-line-${lineIndex}`))
@@ -9794,7 +9845,7 @@ var Settlement = ({
9794
9845
  }) => {
9795
9846
  var _a, _b, _c;
9796
9847
  const labels = (0, import_hooks38.useLabels)();
9797
- const blocks = (0, import_react13.useMemo)(
9848
+ const blocks = (0, import_react14.useMemo)(
9798
9849
  () => dedupeSettlementSources({
9799
9850
  eventDescription,
9800
9851
  marketDescription,
@@ -9869,7 +9920,7 @@ var SettlementSummary = ({
9869
9920
  className
9870
9921
  }) => {
9871
9922
  const labels = (0, import_hooks39.useLabels)();
9872
- const firstParagraph = (0, import_react14.useMemo)(() => getFirstSettlementParagraph(content), [content]);
9923
+ const firstParagraph = (0, import_react15.useMemo)(() => getFirstSettlementParagraph(content), [content]);
9873
9924
  if (!firstParagraph) return null;
9874
9925
  const handleReadFullDetails = (event) => {
9875
9926
  event.preventDefault();
@@ -10025,11 +10076,11 @@ var EventListItemDetailsGraphSection = ({
10025
10076
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
10026
10077
  const labels = (0, import_hooks40.useLabels)();
10027
10078
  const tradingContext = (0, import_hooks33.useEventTradingContext)();
10028
- const [selectedGraphVenue, setSelectedGraphVenue] = (0, import_react15.useState)(null);
10029
- const [chartOutcomeLabel, setChartOutcomeLabel] = (0, import_react15.useState)(
10079
+ const [selectedGraphVenue, setSelectedGraphVenue] = (0, import_react16.useState)(null);
10080
+ const [chartOutcomeLabel, setChartOutcomeLabel] = (0, import_react16.useState)(
10030
10081
  (_c = (_b = (_a = tradingContext == null ? void 0 : tradingContext.selectedOutcome) == null ? void 0 : _a.label) == null ? void 0 : _b.trim()) != null ? _c : null
10031
10082
  );
10032
- (0, import_react15.useEffect)(() => {
10083
+ (0, import_react16.useEffect)(() => {
10033
10084
  var _a2, _b2, _c2;
10034
10085
  if (chartOutcomeLabel != null) return;
10035
10086
  const label2 = (_c2 = (_b2 = (_a2 = tradingContext == null ? void 0 : tradingContext.selectedOutcome) == null ? void 0 : _a2.label) == null ? void 0 : _b2.trim()) != null ? _c2 : null;
@@ -10045,13 +10096,13 @@ var EventListItemDetailsGraphSection = ({
10045
10096
  const isDarkTheme = theme === "dark";
10046
10097
  const effectiveChartTimeRange = rangeOverride != null ? rangeOverride : selectedChartTimeRange;
10047
10098
  const rollingWindow = (0, import_hooks40.useRollingChartWindow)({ range: effectiveChartTimeRange });
10048
- const availableMarkets = (0, import_react15.useMemo)(() => {
10099
+ const availableMarkets = (0, import_react16.useMemo)(() => {
10049
10100
  var _a2, _b2, _c2, _d2;
10050
10101
  if (venueMarkets.length === 0) return [];
10051
10102
  const resolvedSelectedMarketId = (_d2 = (_c2 = (_a2 = tradingContext == null ? void 0 : tradingContext.selectedMarketId) != null ? _a2 : selectedMarketId) != null ? _c2 : (_b2 = venueMarkets[0]) == null ? void 0 : _b2.id) != null ? _d2 : null;
10052
10103
  return normalizeVenueMarketCluster(venueMarkets, resolvedSelectedMarketId);
10053
10104
  }, [selectedMarketId, tradingContext == null ? void 0 : tradingContext.selectedMarketId, venueMarkets]);
10054
- const fallbackOutcomeLabel = (0, import_react15.useMemo)(() => {
10105
+ const fallbackOutcomeLabel = (0, import_react16.useMemo)(() => {
10055
10106
  var _a2, _b2, _c2, _d2, _e2;
10056
10107
  const fallbackMarket = (_b2 = (_a2 = tradingContext == null ? void 0 : tradingContext.selectedMarket) != null ? _a2 : availableMarkets[0]) != null ? _b2 : null;
10057
10108
  if (!fallbackMarket) return null;
@@ -10059,7 +10110,7 @@ var EventListItemDetailsGraphSection = ({
10059
10110
  }, [availableMarkets, tradingContext == null ? void 0 : tradingContext.selectedMarket]);
10060
10111
  const resolvedChartOutcomeLabel = (_h = (_g = chartOutcomeLabel != null ? chartOutcomeLabel : (_f = (_e = tradingContext == null ? void 0 : tradingContext.selectedOutcome) == null ? void 0 : _e.label) == null ? void 0 : _f.trim()) != null ? _g : fallbackOutcomeLabel) != null ? _h : null;
10061
10112
  const chartScopedOutcomeId = ((_i = tradingContext == null ? void 0 : tradingContext.selectedOutcome) == null ? void 0 : _i.id) && ((_j = tradingContext.selectedOutcome.label) == null ? void 0 : _j.trim()) === resolvedChartOutcomeLabel ? tradingContext.selectedOutcome.id : null;
10062
- const availableVenueOutcomes = (0, import_react15.useMemo)(() => {
10113
+ const availableVenueOutcomes = (0, import_react16.useMemo)(() => {
10063
10114
  return resolveChartVenueOutcomes({
10064
10115
  eligibleVenueOutcomes: collectEligibleVenueOutcomes({
10065
10116
  venueMarkets: availableMarkets,
@@ -10088,11 +10139,11 @@ var EventListItemDetailsGraphSection = ({
10088
10139
  // of refetching every time the bucket boundary advances.
10089
10140
  rangeKey: rollingWindow.range
10090
10141
  });
10091
- const hasAutoFallenBackRangeRef = (0, import_react15.useRef)(false);
10092
- (0, import_react15.useEffect)(() => {
10142
+ const hasAutoFallenBackRangeRef = (0, import_react16.useRef)(false);
10143
+ (0, import_react16.useEffect)(() => {
10093
10144
  hasAutoFallenBackRangeRef.current = false;
10094
10145
  }, [chartPrimaryOutcomeId]);
10095
- (0, import_react15.useEffect)(() => {
10146
+ (0, import_react16.useEffect)(() => {
10096
10147
  if (!shouldAutoFallbackToAllRange({
10097
10148
  chartData: scopedMarketChartData,
10098
10149
  isLoading: isScopedMarketChartLoading,
@@ -10117,7 +10168,7 @@ var EventListItemDetailsGraphSection = ({
10117
10168
  onRangeOverrideChange,
10118
10169
  rollingWindow.startTs
10119
10170
  ]);
10120
- const selectedMarketOutcomes = (0, import_react15.useMemo)(() => {
10171
+ const selectedMarketOutcomes = (0, import_react16.useMemo)(() => {
10121
10172
  var _a2, _b2;
10122
10173
  const selectedMarket = (_b2 = (_a2 = tradingContext == null ? void 0 : tradingContext.selectedMarket) != null ? _a2 : availableMarkets[0]) != null ? _b2 : null;
10123
10174
  if (!selectedMarket) return [];
@@ -10129,7 +10180,7 @@ var EventListItemDetailsGraphSection = ({
10129
10180
  });
10130
10181
  });
10131
10182
  }, [availableMarkets, tradingContext == null ? void 0 : tradingContext.selectedMarket]);
10132
- const resolvedVenueChartSeries = (0, import_react15.useMemo)(() => {
10183
+ const resolvedVenueChartSeries = (0, import_react16.useMemo)(() => {
10133
10184
  return resolveMarketChartVenueSeries({
10134
10185
  chartData: scopedMarketChartData,
10135
10186
  transformProbability: (v) => v
@@ -10142,32 +10193,32 @@ var EventListItemDetailsGraphSection = ({
10142
10193
  lineStyle: "solid"
10143
10194
  }));
10144
10195
  }, [isDarkTheme, scopedMarketChartData]);
10145
- const chartAvailableVenueOutcomes = (0, import_react15.useMemo)(() => {
10196
+ const chartAvailableVenueOutcomes = (0, import_react16.useMemo)(() => {
10146
10197
  return filterChartVenueOutcomesByRenderableVenues({
10147
10198
  chartData: scopedMarketChartData,
10148
10199
  venueOutcomes: availableVenueOutcomes
10149
10200
  });
10150
10201
  }, [availableVenueOutcomes, scopedMarketChartData]);
10151
- const defaultCandlestickVenue = (0, import_react15.useMemo)(() => {
10202
+ const defaultCandlestickVenue = (0, import_react16.useMemo)(() => {
10152
10203
  var _a2, _b2, _c2, _d2, _e2, _f2;
10153
10204
  return (_f2 = (_e2 = (_c2 = (_a2 = chartAvailableVenueOutcomes.find((item) => item.venue === (tradingContext == null ? void 0 : tradingContext.selectedVenue))) == null ? void 0 : _a2.venue) != null ? _c2 : (_b2 = chartAvailableVenueOutcomes[0]) == null ? void 0 : _b2.venue) != null ? _e2 : (_d2 = availableVenueOutcomes[0]) == null ? void 0 : _d2.venue) != null ? _f2 : null;
10154
10205
  }, [availableVenueOutcomes, chartAvailableVenueOutcomes, tradingContext == null ? void 0 : tradingContext.selectedVenue]);
10155
10206
  const activeGraphVenue = selectedChartType === "candlestick" ? selectedGraphVenue != null ? selectedGraphVenue : defaultCandlestickVenue : selectedGraphVenue;
10156
- const visibleChartSeries = (0, import_react15.useMemo)(() => {
10207
+ const visibleChartSeries = (0, import_react16.useMemo)(() => {
10157
10208
  const venueFiltered = activeGraphVenue ? resolvedVenueChartSeries.filter((seriesItem) => seriesItem.venue === activeGraphVenue) : resolvedVenueChartSeries;
10158
10209
  const domainStartTs = rollingWindow.startTs;
10159
10210
  return venueFiltered.map((seriesItem) => __spreadProps(__spreadValues({}, seriesItem), {
10160
10211
  points: seriesItem.points.filter((point) => point.time >= domainStartTs)
10161
10212
  }));
10162
10213
  }, [activeGraphVenue, resolvedVenueChartSeries, rollingWindow.startTs]);
10163
- const chartLiveState = (0, import_react15.useMemo)(() => {
10214
+ const chartLiveState = (0, import_react16.useMemo)(() => {
10164
10215
  return resolveMarketChartLiveState({
10165
10216
  chartData: scopedMarketChartData,
10166
10217
  selectedVenue: activeGraphVenue,
10167
10218
  transformProbability: (v) => v
10168
10219
  });
10169
10220
  }, [activeGraphVenue, scopedMarketChartData]);
10170
- (0, import_react15.useEffect)(() => {
10221
+ (0, import_react16.useEffect)(() => {
10171
10222
  if (!selectedGraphVenue) return;
10172
10223
  const hasSelectedGraphVenue = chartAvailableVenueOutcomes.some(
10173
10224
  (item) => item.venue === selectedGraphVenue
@@ -10327,18 +10378,18 @@ var EventListItemDetailsContent = ({
10327
10378
  midpointsResult
10328
10379
  }) => {
10329
10380
  var _a, _b, _c, _d;
10330
- const [selectedChartType, setSelectedChartType] = (0, import_react15.useState)("line");
10331
- const lastAppliedEventSyncKeyRef = (0, import_react15.useRef)(null);
10332
- const lastAppliedDefaultRef = (0, import_react15.useRef)(null);
10333
- const [chartRangeOverride, setChartRangeOverride] = (0, import_react15.useState)(null);
10334
- (0, import_react15.useEffect)(() => {
10381
+ const [selectedChartType, setSelectedChartType] = (0, import_react16.useState)("line");
10382
+ const lastAppliedEventSyncKeyRef = (0, import_react16.useRef)(null);
10383
+ const lastAppliedDefaultRef = (0, import_react16.useRef)(null);
10384
+ const [chartRangeOverride, setChartRangeOverride] = (0, import_react16.useState)(null);
10385
+ (0, import_react16.useEffect)(() => {
10335
10386
  setChartRangeOverride(null);
10336
10387
  }, [event.id]);
10337
10388
  const config = (0, import_hooks40.useSdkUiConfig)();
10338
10389
  const labels = (0, import_hooks40.useLabels)();
10339
10390
  const tradingContext = (0, import_hooks33.useEventTradingContext)();
10340
- const eventSyncKey = (0, import_react15.useMemo)(() => resolveEventDetailsSyncKey(event), [event]);
10341
- const resolvedEventTradingState = (0, import_react15.useMemo)(() => {
10391
+ const eventSyncKey = (0, import_react16.useMemo)(() => resolveEventDetailsSyncKey(event), [event]);
10392
+ const resolvedEventTradingState = (0, import_react16.useMemo)(() => {
10342
10393
  return eventTradingState != null ? eventTradingState : (0, import_hooks40.resolveEventTradingState)(event);
10343
10394
  }, [event, eventTradingState]);
10344
10395
  const scopedSelectedMarket = (tradingContext == null ? void 0 : tradingContext.selectedEventId) === event.id ? (_a = tradingContext.selectedMarket) != null ? _a : resolvedEventTradingState.primaryMarket : resolvedEventTradingState.primaryMarket;
@@ -10362,18 +10413,18 @@ var EventListItemDetailsContent = ({
10362
10413
  const restMidpoints = (_b = resolvedMidpointsResult.bestMidpointsByOutcomeId) != null ? _b : resolvedMidpointsResult.prices;
10363
10414
  const bestMidpoint = resolvedMidpointsResult.bestMidpoint;
10364
10415
  const restBestPrices = resolvedMidpointsResult.bestPrices;
10365
- const bestPrices = (0, import_react15.useMemo)(
10416
+ const bestPrices = (0, import_react16.useMemo)(
10366
10417
  () => (0, import_hooks40.mergeBestPricesPreferringLive)(restBestPrices, wsBestPrices),
10367
10418
  [restBestPrices, wsBestPrices]
10368
10419
  );
10369
- const livePrices = (0, import_react15.useMemo)(() => {
10420
+ const livePrices = (0, import_react16.useMemo)(() => {
10370
10421
  if (!restMidpoints.size) return wsLivePrices;
10371
10422
  if (!wsLivePrices.size) return restMidpoints;
10372
10423
  const merged = new Map(restMidpoints);
10373
10424
  for (const [k, v] of wsLivePrices) merged.set(k, v);
10374
10425
  return merged;
10375
10426
  }, [restMidpoints, wsLivePrices]);
10376
- (0, import_react15.useEffect)(() => {
10427
+ (0, import_react16.useEffect)(() => {
10377
10428
  if (!tradingContext) return;
10378
10429
  if (lastAppliedEventSyncKeyRef.current === eventSyncKey) return;
10379
10430
  if ((tradingContext == null ? void 0 : tradingContext.selectedEventId) !== event.id) {
@@ -10383,7 +10434,7 @@ var EventListItemDetailsContent = ({
10383
10434
  }
10384
10435
  lastAppliedEventSyncKeyRef.current = eventSyncKey;
10385
10436
  }, [event, eventSyncKey, tradingContext]);
10386
- (0, import_react15.useEffect)(() => {
10437
+ (0, import_react16.useEffect)(() => {
10387
10438
  if (!tradingContext) return;
10388
10439
  if (!defaultMarketId) return;
10389
10440
  if (tradingContext.selectedEventId !== event.id) return;
@@ -10410,18 +10461,18 @@ var EventListItemDetailsContent = ({
10410
10461
  tradingContext,
10411
10462
  tradingContext == null ? void 0 : tradingContext.selectedEventId
10412
10463
  ]);
10413
- const venueMarkets = (0, import_react15.useMemo)(
10464
+ const venueMarkets = (0, import_react16.useMemo)(
10414
10465
  () => resolvedEventTradingState.displayMarkets,
10415
10466
  [resolvedEventTradingState.displayMarkets]
10416
10467
  );
10417
- const marketOptions = (0, import_react15.useMemo)(
10468
+ const marketOptions = (0, import_react16.useMemo)(
10418
10469
  () => venueMarkets.map((vm) => ({
10419
10470
  value: vm.id,
10420
10471
  label: vm.question
10421
10472
  })),
10422
10473
  [venueMarkets]
10423
10474
  );
10424
- const volumeLabel = (0, import_react15.useMemo)(() => {
10475
+ const volumeLabel = (0, import_react16.useMemo)(() => {
10425
10476
  const resolvedVolume = resolveDisplayVolume(event.volume, venueMarkets);
10426
10477
  if (typeof resolvedVolume !== "number") return "";
10427
10478
  return `${config.formatting.formatCompactCurrency(resolvedVolume)} ${labels.eventItemDetails.volumeSuffix}`;
@@ -10688,11 +10739,11 @@ EventListItemDetails.displayName = "EventListItemDetails";
10688
10739
 
10689
10740
  // src/events/market-details/index.tsx
10690
10741
  var import_hooks42 = require("@agg-build/hooks");
10691
- var import_react18 = require("react");
10742
+ var import_react19 = require("react");
10692
10743
 
10693
10744
  // src/events/orderbook/index.tsx
10694
10745
  var import_hooks41 = require("@agg-build/hooks");
10695
- var import_react17 = require("react");
10746
+ var import_react18 = require("react");
10696
10747
 
10697
10748
  // src/events/orderbook/orderbook.constants.ts
10698
10749
  var orderbookRowLimitDefault = 4;
@@ -10713,7 +10764,7 @@ var orderbookDefaultLabels = {
10713
10764
  };
10714
10765
 
10715
10766
  // src/events/orderbook/use-center-orderbook-spread.ts
10716
- var import_react16 = require("react");
10767
+ var import_react17 = require("react");
10717
10768
  var maxAutoCenterAttempts = 12;
10718
10769
  var userScrollKeys = /* @__PURE__ */ new Set(["ArrowDown", "ArrowUp", "PageDown", "PageUp", "Home", "End", " "]);
10719
10770
  var useCenterOrderbookSpread = ({
@@ -10724,21 +10775,21 @@ var useCenterOrderbookSpread = ({
10724
10775
  rowCount,
10725
10776
  enabled = true
10726
10777
  }) => {
10727
- const hasUserScrolledRef = (0, import_react16.useRef)(false);
10728
- const animationFrameRef = (0, import_react16.useRef)(null);
10729
- const retryCountRef = (0, import_react16.useRef)(0);
10778
+ const hasUserScrolledRef = (0, import_react17.useRef)(false);
10779
+ const animationFrameRef = (0, import_react17.useRef)(null);
10780
+ const retryCountRef = (0, import_react17.useRef)(0);
10730
10781
  const resetKey = marketId != null ? marketId : "";
10731
- const cancelPendingFrame = (0, import_react16.useCallback)(() => {
10782
+ const cancelPendingFrame = (0, import_react17.useCallback)(() => {
10732
10783
  if (animationFrameRef.current === null) return;
10733
10784
  window.cancelAnimationFrame(animationFrameRef.current);
10734
10785
  animationFrameRef.current = null;
10735
10786
  }, []);
10736
- (0, import_react16.useLayoutEffect)(() => {
10787
+ (0, import_react17.useLayoutEffect)(() => {
10737
10788
  hasUserScrolledRef.current = false;
10738
10789
  retryCountRef.current = 0;
10739
10790
  cancelPendingFrame();
10740
10791
  }, [cancelPendingFrame, resetKey]);
10741
- (0, import_react16.useLayoutEffect)(() => {
10792
+ (0, import_react17.useLayoutEffect)(() => {
10742
10793
  const container = containerRef.current;
10743
10794
  if (!container) return;
10744
10795
  const handleUserScrollIntent = () => {
@@ -10761,7 +10812,7 @@ var useCenterOrderbookSpread = ({
10761
10812
  cancelPendingFrame();
10762
10813
  };
10763
10814
  }, [cancelPendingFrame, containerRef]);
10764
- (0, import_react16.useLayoutEffect)(() => {
10815
+ (0, import_react17.useLayoutEffect)(() => {
10765
10816
  if (!enabled) return;
10766
10817
  let isCancelled = false;
10767
10818
  const measureAndCenter = () => {
@@ -10835,7 +10886,7 @@ var useCenterOrderbookSpread = ({
10835
10886
  mutationObserver == null ? void 0 : mutationObserver.disconnect();
10836
10887
  };
10837
10888
  }, [cancelPendingFrame, containerRef, enabled, resetKey, rowCount, spreadRef]);
10838
- const recenter = (0, import_react16.useCallback)(() => {
10889
+ const recenter = (0, import_react17.useCallback)(() => {
10839
10890
  const container = containerRef.current;
10840
10891
  const spread = spreadRef.current;
10841
10892
  if (!container || !spread) return;
@@ -11027,8 +11078,8 @@ var Orderbook = ({
11027
11078
  var _a, _b, _c, _d, _e;
11028
11079
  const { enableWebsocketsLogs } = (0, import_hooks41.useAggUiConfig)();
11029
11080
  const labels = __spreadValues(__spreadValues({}, orderbookDefaultLabels), labelsProp);
11030
- const scrollContainerRef = (0, import_react17.useRef)(null);
11031
- const spreadRowRef = (0, import_react17.useRef)(null);
11081
+ const scrollContainerRef = (0, import_react18.useRef)(null);
11082
+ const spreadRowRef = (0, import_react18.useRef)(null);
11032
11083
  const autoCenterMarketId = (_a = marketId != null ? marketId : outcomeId) != null ? _a : null;
11033
11084
  const maxVisibleRows = Math.max(1, visibleRows);
11034
11085
  const totalVisibleRows = maxVisibleRows * 2 + 1;
@@ -11045,7 +11096,7 @@ var Orderbook = ({
11045
11096
  const spreadEntry = entries.find(
11046
11097
  (e) => e.kind === "spread"
11047
11098
  );
11048
- (0, import_react17.useEffect)(() => {
11099
+ (0, import_react18.useEffect)(() => {
11049
11100
  var _a2, _b2;
11050
11101
  if (!enableWebsocketsLogs) return;
11051
11102
  console.debug("[AggUI][orderbook] component_rendered", {
@@ -11439,14 +11490,14 @@ var MarketDetailsContent = ({
11439
11490
  const isDarkTheme = theme === "dark";
11440
11491
  const labels = (0, import_hooks42.useLabels)();
11441
11492
  const tradingContext = (0, import_hooks42.useEventTradingContext)();
11442
- const detailsContentId = (0, import_react18.useId)();
11493
+ const detailsContentId = (0, import_react19.useId)();
11443
11494
  const tradeSide = (_a = tradingContext == null ? void 0 : tradingContext.tradeSide) != null ? _a : "buy";
11444
11495
  const wsLivePrices = (0, import_hooks42.useLiveOutcomePrices)(venueMarkets);
11445
11496
  const wsBestPrices = (0, import_hooks42.useLiveBestPrices)(venueMarkets);
11446
- const resolvedMarket = (0, import_react18.useMemo)(() => {
11497
+ const resolvedMarket = (0, import_react19.useMemo)(() => {
11447
11498
  return resolveMarketFromVenueMarkets(venueMarkets, marketId);
11448
11499
  }, [venueMarkets, marketId]);
11449
- const scopedResolvedMarket = (0, import_react18.useMemo)(() => {
11500
+ const scopedResolvedMarket = (0, import_react19.useMemo)(() => {
11450
11501
  var _a2, _b2;
11451
11502
  if (!resolvedMarket) return null;
11452
11503
  return (_b2 = (_a2 = resolvedMarket.venueMarkets.find((venueMarket) => venueMarket.id === resolvedMarket.id)) != null ? _a2 : resolvedMarket.venueMarkets[0]) != null ? _b2 : null;
@@ -11468,17 +11519,17 @@ var MarketDetailsContent = ({
11468
11519
  const clusterBestMidpoint = clusterMidpointResult.bestMidpoint;
11469
11520
  const clusterBestMidpointVenue = clusterMidpointResult.bestMidpointVenue;
11470
11521
  const clusterBestPricesRest = clusterMidpointResult.bestPrices;
11471
- const clusterBestPrices = (0, import_react18.useMemo)(
11522
+ const clusterBestPrices = (0, import_react19.useMemo)(
11472
11523
  () => (0, import_hooks42.mergeBestPricesPreferringLive)(clusterBestPricesRest, wsBestPrices),
11473
11524
  [clusterBestPricesRest, wsBestPrices]
11474
11525
  );
11475
11526
  const clusterBestPriceVenuesByOutcomeId = clusterMidpointResult.bestPriceVenuesByOutcomeId;
11476
- const clusterMidpointMarkets = (0, import_react18.useMemo)(() => {
11527
+ const clusterMidpointMarkets = (0, import_react19.useMemo)(() => {
11477
11528
  var _a2;
11478
11529
  if (!resolvedMarket) return [];
11479
11530
  return (_a2 = resolvedMarket.venueMarkets) != null ? _a2 : [];
11480
11531
  }, [resolvedMarket]);
11481
- const tradableVenues = (0, import_react18.useMemo)(() => {
11532
+ const tradableVenues = (0, import_react19.useMemo)(() => {
11482
11533
  var _a2;
11483
11534
  if (clusterMidpointMarkets.length === 0) return null;
11484
11535
  if (clusterMidpoints.size === 0) return null;
@@ -11493,7 +11544,7 @@ var MarketDetailsContent = ({
11493
11544
  }
11494
11545
  return set;
11495
11546
  }, [clusterMidpointMarkets, clusterMidpoints]);
11496
- const model = (0, import_react18.useMemo)(() => {
11547
+ const model = (0, import_react19.useMemo)(() => {
11497
11548
  return buildMarketDetailsModel({
11498
11549
  venueMarkets,
11499
11550
  marketId,
@@ -11512,7 +11563,7 @@ var MarketDetailsContent = ({
11512
11563
  title2,
11513
11564
  tradableVenues
11514
11565
  ]);
11515
- const livePrices = (0, import_react18.useMemo)(() => {
11566
+ const livePrices = (0, import_react19.useMemo)(() => {
11516
11567
  const merged = /* @__PURE__ */ new Map();
11517
11568
  if (midpointsFallback == null ? void 0 : midpointsFallback.size) {
11518
11569
  for (const [outcomeId, price] of midpointsFallback) {
@@ -11527,37 +11578,37 @@ var MarketDetailsContent = ({
11527
11578
  for (const [k, v] of wsLivePrices) merged.set(k, v);
11528
11579
  return merged;
11529
11580
  }, [clusterMidpoints, midpointsFallback, wsLivePrices]);
11530
- const scopedMarketForCard = (0, import_react18.useMemo)(() => {
11581
+ const scopedMarketForCard = (0, import_react19.useMemo)(() => {
11531
11582
  var _a2;
11532
11583
  if (!model) return null;
11533
11584
  return (_a2 = model.market.venueMarkets.find((venueMarket) => venueMarket.id === model.market.id)) != null ? _a2 : model.primaryVenueMarket;
11534
11585
  }, [model]);
11535
- const marketTradingState = (0, import_react18.useMemo)(() => {
11586
+ const marketTradingState = (0, import_react19.useMemo)(() => {
11536
11587
  return (0, import_hooks42.resolveMarketTradingState)(scopedMarketForCard);
11537
11588
  }, [scopedMarketForCard]);
11538
11589
  const isOutcomeSelectionLocked = marketTradingState.isTradingDisabled;
11539
11590
  const isUpcomingMarket = marketTradingState.kind === "unopened";
11540
11591
  const marketStatePresentation = resolveTradingStatePresentation(labels, marketTradingState);
11541
- const marketDetailsTabs = (0, import_react18.useMemo)(() => {
11592
+ const marketDetailsTabs = (0, import_react19.useMemo)(() => {
11542
11593
  return getMarketDetailsTabs(labels);
11543
11594
  }, [labels]);
11544
- const [selectedTab, setSelectedTab] = (0, import_react18.useState)(
11595
+ const [selectedTab, setSelectedTab] = (0, import_react19.useState)(
11545
11596
  () => resolveInitialTab(defaultTab)
11546
11597
  );
11547
- const [isOpened, setIsOpened] = (0, import_react18.useState)(controlledIsOpened);
11548
- (0, import_react18.useEffect)(() => {
11598
+ const [isOpened, setIsOpened] = (0, import_react19.useState)(controlledIsOpened);
11599
+ (0, import_react19.useEffect)(() => {
11549
11600
  setSelectedTab(resolveInitialTab(defaultTab));
11550
11601
  }, [defaultTab]);
11551
- (0, import_react18.useEffect)(() => {
11602
+ (0, import_react19.useEffect)(() => {
11552
11603
  setIsOpened(controlledIsOpened);
11553
11604
  }, [controlledIsOpened]);
11554
11605
  const selectedTimeRange = config.chart.selectedChartTimeRange;
11555
11606
  const setSelectedTimeRange = config.chart.setSelectedChartTimeRange;
11556
11607
  const effectiveSelectedTab = isResolvedMarket ? "graph" : selectedTab;
11557
- const [chartRangeOverride, setChartRangeOverride] = (0, import_react18.useState)(null);
11608
+ const [chartRangeOverride, setChartRangeOverride] = (0, import_react19.useState)(null);
11558
11609
  const effectiveChartTimeRange = isResolvedMarket ? "ALL" : chartRangeOverride != null ? chartRangeOverride : selectedTimeRange;
11559
- const [selectedChartType, setSelectedChartType] = (0, import_react18.useState)("line");
11560
- const scopedSelectedOutcomeState = (0, import_react18.useMemo)(() => {
11610
+ const [selectedChartType, setSelectedChartType] = (0, import_react19.useState)("line");
11611
+ const scopedSelectedOutcomeState = (0, import_react19.useMemo)(() => {
11561
11612
  if (!model) {
11562
11613
  return {
11563
11614
  outcomeId: null,
@@ -11579,15 +11630,15 @@ var MarketDetailsContent = ({
11579
11630
  const selectedOutcomeId = scopedSelectedOutcomeState.outcomeId;
11580
11631
  const selectedOutcomeLabel = (_c = scopedSelectedOutcomeState.outcomeLabel) != null ? _c : null;
11581
11632
  const selectOutcome = tradingContext == null ? void 0 : tradingContext.selectOutcome;
11582
- const [selectedGraphVenue, setSelectedGraphVenue] = (0, import_react18.useState)(null);
11583
- const [chartOutcomeLabel, setChartOutcomeLabel] = (0, import_react18.useState)(selectedOutcomeLabel);
11584
- (0, import_react18.useEffect)(() => {
11633
+ const [selectedGraphVenue, setSelectedGraphVenue] = (0, import_react19.useState)(null);
11634
+ const [chartOutcomeLabel, setChartOutcomeLabel] = (0, import_react19.useState)(selectedOutcomeLabel);
11635
+ (0, import_react19.useEffect)(() => {
11585
11636
  if (!isOpened) return;
11586
11637
  if (selectedOutcomeLabel) {
11587
11638
  setChartOutcomeLabel(selectedOutcomeLabel);
11588
11639
  }
11589
11640
  }, [isOpened]);
11590
- (0, import_react18.useEffect)(() => {
11641
+ (0, import_react19.useEffect)(() => {
11591
11642
  var _a2;
11592
11643
  if (!isOpened || !model) return;
11593
11644
  if (isOutcomeSelectionLocked) return;
@@ -11611,7 +11662,7 @@ var MarketDetailsContent = ({
11611
11662
  tradingContext == null ? void 0 : tradingContext.selectedMarketId,
11612
11663
  selectOutcome
11613
11664
  ]);
11614
- const headerOutcomeItems = (0, import_react18.useMemo)(() => {
11665
+ const headerOutcomeItems = (0, import_react19.useMemo)(() => {
11615
11666
  if (!model) return [];
11616
11667
  const items = resolveHeaderOutcomeItems(model.market.venueMarkets, scopedMarketForCard);
11617
11668
  return items.map((item) => {
@@ -11665,7 +11716,7 @@ var MarketDetailsContent = ({
11665
11716
  tradeSide,
11666
11717
  wsLivePrices
11667
11718
  ]);
11668
- const headlineProbability = (0, import_react18.useMemo)(() => {
11719
+ const headlineProbability = (0, import_react19.useMemo)(() => {
11669
11720
  var _a2, _b2, _c2, _d2;
11670
11721
  if (!model || !scopedMarketForCard) return void 0;
11671
11722
  if (isResolvedMarket) {
@@ -11701,7 +11752,7 @@ var MarketDetailsContent = ({
11701
11752
  midpointsFallback,
11702
11753
  wsLivePrices
11703
11754
  ]);
11704
- const selectedOutcomesByVenue = (0, import_react18.useMemo)(() => {
11755
+ const selectedOutcomesByVenue = (0, import_react19.useMemo)(() => {
11705
11756
  if (!model) return [];
11706
11757
  return collectEligibleVenueOutcomes({
11707
11758
  venueMarkets: model.market.venueMarkets,
@@ -11715,7 +11766,7 @@ var MarketDetailsContent = ({
11715
11766
  }, [model, selectedOutcomeLabel, selectedOutcomeId]);
11716
11767
  const resolvedChartOutcomeLabel = chartOutcomeLabel != null ? chartOutcomeLabel : selectedOutcomeLabel;
11717
11768
  const chartSelectedOutcomeId = selectedOutcomeId && resolvedChartOutcomeLabel === selectedOutcomeLabel ? selectedOutcomeId : null;
11718
- const chartOutcomesByVenue = (0, import_react18.useMemo)(() => {
11769
+ const chartOutcomesByVenue = (0, import_react19.useMemo)(() => {
11719
11770
  if (!model) return [];
11720
11771
  return resolveChartVenueOutcomes({
11721
11772
  eligibleVenueOutcomes: collectEligibleVenueOutcomes({
@@ -11732,7 +11783,7 @@ var MarketDetailsContent = ({
11732
11783
  const primaryVenueMarketId = (_f = (_e = selectedOutcomesByVenue[0]) == null ? void 0 : _e.market.id) != null ? _f : null;
11733
11784
  const primaryOutcomeId = (_h = (_g = selectedOutcomesByVenue[0]) == null ? void 0 : _g.outcome.id) != null ? _h : null;
11734
11785
  const chartPrimaryOutcomeId = (_j = (_i = chartOutcomesByVenue[0]) == null ? void 0 : _i.outcome.id) != null ? _j : null;
11735
- const chartVenueOutcomeIds = (0, import_react18.useMemo)(() => {
11786
+ const chartVenueOutcomeIds = (0, import_react19.useMemo)(() => {
11736
11787
  return chartOutcomesByVenue.map((item) => item.outcome.id);
11737
11788
  }, [chartOutcomesByVenue]);
11738
11789
  const {
@@ -11753,12 +11804,12 @@ var MarketDetailsContent = ({
11753
11804
  // instead of refetching on every bucket-boundary rollover.
11754
11805
  rangeKey: rollingWindow.range
11755
11806
  });
11756
- const hasAutoFallenBackRangeRef = (0, import_react18.useRef)(false);
11757
- (0, import_react18.useEffect)(() => {
11807
+ const hasAutoFallenBackRangeRef = (0, import_react19.useRef)(false);
11808
+ (0, import_react19.useEffect)(() => {
11758
11809
  hasAutoFallenBackRangeRef.current = false;
11759
11810
  setChartRangeOverride(null);
11760
11811
  }, [chartPrimaryOutcomeId]);
11761
- (0, import_react18.useEffect)(() => {
11812
+ (0, import_react19.useEffect)(() => {
11762
11813
  if (!shouldAutoFallbackToAllRange({
11763
11814
  chartData: marketChartData,
11764
11815
  isLoading: isMarketChartLoading,
@@ -11789,14 +11840,14 @@ var MarketDetailsContent = ({
11789
11840
  })),
11790
11841
  live
11791
11842
  });
11792
- const marketOrderbookDataById = (0, import_react18.useMemo)(() => {
11843
+ const marketOrderbookDataById = (0, import_react19.useMemo)(() => {
11793
11844
  var _a2;
11794
11845
  return (_a2 = marketOrderbookResult.dataById) != null ? _a2 : {};
11795
11846
  }, [marketOrderbookResult]);
11796
11847
  const isOrderBookLoading = marketOrderbookResult.isLoading;
11797
11848
  const orderBookError = marketOrderbookResult.error;
11798
11849
  const refetchOrderBook = marketOrderbookResult.refetch;
11799
- const aggregatedOrderbookRows = (0, import_react18.useMemo)(() => {
11850
+ const aggregatedOrderbookRows = (0, import_react19.useMemo)(() => {
11800
11851
  return mergeVenueOutcomeOrderbooks({
11801
11852
  eligibleOutcomes: selectedOutcomesByVenue,
11802
11853
  orderbooksByOutcomeId: marketOrderbookDataById
@@ -11804,7 +11855,7 @@ var MarketDetailsContent = ({
11804
11855
  }, [marketOrderbookDataById, selectedOutcomesByVenue]);
11805
11856
  const askRows = aggregatedOrderbookRows.askRows;
11806
11857
  const bidRows = aggregatedOrderbookRows.bidRows;
11807
- const unifiedEntries = (0, import_react18.useMemo)(() => {
11858
+ const unifiedEntries = (0, import_react19.useMemo)(() => {
11808
11859
  return resolveUnifiedOrderBookEntries({
11809
11860
  askRows,
11810
11861
  bidRows,
@@ -11812,7 +11863,7 @@ var MarketDetailsContent = ({
11812
11863
  spread: aggregatedOrderbookRows.spread
11813
11864
  });
11814
11865
  }, [aggregatedOrderbookRows.midpoint, aggregatedOrderbookRows.spread, askRows, bidRows]);
11815
- const orderbookSnapshotKey = (0, import_react18.useMemo)(() => {
11866
+ const orderbookSnapshotKey = (0, import_react19.useMemo)(() => {
11816
11867
  if (selectedOutcomesByVenue.length === 0) return null;
11817
11868
  return selectedOutcomesByVenue.map((item) => {
11818
11869
  var _a2, _b2;
@@ -11820,13 +11871,13 @@ var MarketDetailsContent = ({
11820
11871
  return `${item.outcomeId}:${snapshotVersion}`;
11821
11872
  }).join("|");
11822
11873
  }, [marketOrderbookDataById, selectedOutcomesByVenue]);
11823
- const chartAvailableOutcomesByVenue = (0, import_react18.useMemo)(() => {
11874
+ const chartAvailableOutcomesByVenue = (0, import_react19.useMemo)(() => {
11824
11875
  return filterChartVenueOutcomesByRenderableVenues({
11825
11876
  chartData: marketChartData,
11826
11877
  venueOutcomes: chartOutcomesByVenue
11827
11878
  });
11828
11879
  }, [chartOutcomesByVenue, marketChartData]);
11829
- const graphSeries = (0, import_react18.useMemo)(() => {
11880
+ const graphSeries = (0, import_react19.useMemo)(() => {
11830
11881
  var _a2, _b2, _c2, _d2;
11831
11882
  const baseColor = resolveSeriesColor(
11832
11883
  (_d2 = (_c2 = selectedGraphVenue != null ? selectedGraphVenue : (_a2 = chartAvailableOutcomesByVenue[0]) == null ? void 0 : _a2.venue) != null ? _c2 : (_b2 = chartOutcomesByVenue[0]) == null ? void 0 : _b2.venue) != null ? _d2 : "polymarket",
@@ -11858,14 +11909,14 @@ var MarketDetailsContent = ({
11858
11909
  chartAvailableOutcomesByVenue,
11859
11910
  chartOutcomesByVenue
11860
11911
  ]);
11861
- const graphLiveState = (0, import_react18.useMemo)(() => {
11912
+ const graphLiveState = (0, import_react19.useMemo)(() => {
11862
11913
  return resolveMarketChartLiveState({
11863
11914
  chartData: marketChartData,
11864
11915
  selectedVenue: selectedGraphVenue,
11865
11916
  transformProbability: (value) => value
11866
11917
  });
11867
11918
  }, [marketChartData, selectedGraphVenue]);
11868
- const otherRows = (0, import_react18.useMemo)(() => {
11919
+ const otherRows = (0, import_react19.useMemo)(() => {
11869
11920
  if (!model) return [];
11870
11921
  return resolveOtherTabRows(model.market, labels);
11871
11922
  }, [labels, model]);
@@ -11956,7 +12007,7 @@ var MarketDetailsContent = ({
11956
12007
  title: labels.marketDetails.orderBookEmptyTitle,
11957
12008
  description: labels.marketDetails.orderBookEmptyDescription
11958
12009
  } : { kind: "data" };
11959
- (0, import_react18.useEffect)(() => {
12010
+ (0, import_react19.useEffect)(() => {
11960
12011
  if (!selectedGraphVenue) {
11961
12012
  return;
11962
12013
  }
@@ -12471,8 +12522,8 @@ var MarketDetailsList = ({
12471
12522
  const labels = (0, import_hooks42.useLabels)();
12472
12523
  const tradingContext = (0, import_hooks42.useEventTradingContext)();
12473
12524
  const selectedMarketId = (_a = tradingContext == null ? void 0 : tradingContext.selectedMarketId) != null ? _a : null;
12474
- const [expandedMarketId, setExpandedMarketId] = (0, import_react18.useState)(null);
12475
- const [areResolvedMarketsVisible, setAreResolvedMarketsVisible] = (0, import_react18.useState)(false);
12525
+ const [expandedMarketId, setExpandedMarketId] = (0, import_react19.useState)(null);
12526
+ const [areResolvedMarketsVisible, setAreResolvedMarketsVisible] = (0, import_react19.useState)(false);
12476
12527
  const resolvedEventId = eventId || "";
12477
12528
  const {
12478
12529
  markets: rawMarkets,
@@ -12485,7 +12536,7 @@ var MarketDetailsList = ({
12485
12536
  sortBy: "yesPrice",
12486
12537
  sortDir: "desc"
12487
12538
  });
12488
- const sourceMarkets = (0, import_react18.useMemo)(() => {
12539
+ const sourceMarkets = (0, import_react19.useMemo)(() => {
12489
12540
  var _a2;
12490
12541
  if ((_a2 = eventTradingState == null ? void 0 : eventTradingState.marketStates) == null ? void 0 : _a2.length) {
12491
12542
  return eventTradingState.marketStates.map((item) => item.market);
@@ -12493,10 +12544,10 @@ var MarketDetailsList = ({
12493
12544
  if (providedMarkets) return providedMarkets;
12494
12545
  return rawMarkets;
12495
12546
  }, [eventTradingState == null ? void 0 : eventTradingState.marketStates, providedMarkets, rawMarkets]);
12496
- const isResolvedEvent = (0, import_react18.useMemo)(() => {
12547
+ const isResolvedEvent = (0, import_react19.useMemo)(() => {
12497
12548
  return resolveIsResolvedEvent(sourceMarkets, eventTradingState);
12498
12549
  }, [eventTradingState, sourceMarkets]);
12499
- const groupedMarkets = (0, import_react18.useMemo)(() => {
12550
+ const groupedMarkets = (0, import_react19.useMemo)(() => {
12500
12551
  if (sourceMarkets.length === 0) {
12501
12552
  return {
12502
12553
  primary: [],
@@ -12536,21 +12587,21 @@ var MarketDetailsList = ({
12536
12587
  return { primary, upcoming, resolved, closed };
12537
12588
  }, [eventTradingState, isResolvedEvent, sourceMarkets]);
12538
12589
  const shouldShowResolvedToggle = !isResolvedEvent && groupedMarkets.resolved.length > 0;
12539
- const visibleResolvedMarkets = (0, import_react18.useMemo)(() => {
12590
+ const visibleResolvedMarkets = (0, import_react19.useMemo)(() => {
12540
12591
  if (isResolvedEvent || areResolvedMarketsVisible) return groupedMarkets.resolved;
12541
12592
  return [];
12542
12593
  }, [areResolvedMarketsVisible, groupedMarkets.resolved, isResolvedEvent]);
12543
- const displayedMarkets = (0, import_react18.useMemo)(() => {
12594
+ const displayedMarkets = (0, import_react19.useMemo)(() => {
12544
12595
  return [...groupedMarkets.primary, ...visibleResolvedMarkets];
12545
12596
  }, [groupedMarkets.primary, visibleResolvedMarkets]);
12546
12597
  const hasPrefetchedMarkets = !!providedMarkets || !!((_b = eventTradingState == null ? void 0 : eventTradingState.marketStates) == null ? void 0 : _b.length);
12547
- const midpointEligibleMarkets = (0, import_react18.useMemo)(() => {
12598
+ const midpointEligibleMarkets = (0, import_react19.useMemo)(() => {
12548
12599
  return displayedMarkets.filter(
12549
12600
  (market) => (0, import_hooks42.resolveMarketTradingState)(market).kind !== "resolved"
12550
12601
  );
12551
12602
  }, [displayedMarkets]);
12552
12603
  const { prices: midpointsFallback, venueByOutcomeId: midpointsFallbackVenues } = (0, import_hooks42.useViewportMidpoints)(midpointEligibleMarkets);
12553
- (0, import_react18.useEffect)(() => {
12604
+ (0, import_react19.useEffect)(() => {
12554
12605
  if (isResolvedEvent) {
12555
12606
  setAreResolvedMarketsVisible(false);
12556
12607
  return;
@@ -12559,7 +12610,7 @@ var MarketDetailsList = ({
12559
12610
  setAreResolvedMarketsVisible(false);
12560
12611
  }
12561
12612
  }, [groupedMarkets.resolved.length, isResolvedEvent]);
12562
- (0, import_react18.useEffect)(() => {
12613
+ (0, import_react19.useEffect)(() => {
12563
12614
  if (displayedMarkets.length === 0) return;
12564
12615
  if (selectedMarketId && displayedMarkets.some((market) => market.id === selectedMarketId)) {
12565
12616
  return;
@@ -12576,7 +12627,7 @@ var MarketDetailsList = ({
12576
12627
  if (!autoSelectFallbackMarket) return;
12577
12628
  tradingContext == null ? void 0 : tradingContext.selectMarket(fallbackSelectableMarket.id, fallbackSelectableMarket);
12578
12629
  }, [autoSelectFallbackMarket, displayedMarkets, selectedMarketId, sourceMarkets, tradingContext]);
12579
- (0, import_react18.useEffect)(() => {
12630
+ (0, import_react19.useEffect)(() => {
12580
12631
  if (!expandedMarketId) return;
12581
12632
  if (displayedMarkets.some((market) => market.id === expandedMarketId)) return;
12582
12633
  setExpandedMarketId(null);
@@ -12686,11 +12737,128 @@ MarketDetailsList.displayName = "MarketDetailsList";
12686
12737
  var import_hooks44 = require("@agg-build/hooks");
12687
12738
  var import_sdk14 = require("@agg-build/sdk");
12688
12739
  var Dialog2 = __toESM(require("@radix-ui/react-dialog"));
12740
+ var import_react22 = require("react");
12741
+
12742
+ // src/events/list/category-sidebar.tsx
12689
12743
  var import_react20 = require("react");
12744
+ var import_jsx_runtime129 = require("react/jsx-runtime");
12745
+ var rowBase = cn(
12746
+ "flex min-h-11 w-full items-center gap-3 rounded-[6px] px-3 py-3",
12747
+ "text-left text-agg-sm font-agg-normal leading-agg-5",
12748
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-1 focus-visible:ring-offset-agg-secondary"
12749
+ );
12750
+ var idleRowClassName = cn(
12751
+ rowBase,
12752
+ "cursor-pointer text-agg-foreground hover:bg-agg-secondary-hover"
12753
+ );
12754
+ var selectedRowClassName = cn(rowBase, "cursor-pointer bg-agg-primary/10 text-agg-primary");
12755
+ var CategorySidebar = ({
12756
+ baseCategoryId,
12757
+ childrenByParentId,
12758
+ categoryPath,
12759
+ collapsedCategoryIds,
12760
+ totalEventCount,
12761
+ labels,
12762
+ onSelectAll,
12763
+ onToggleCategory
12764
+ }) => {
12765
+ const isDrilledIn = categoryPath.length > 0;
12766
+ const sortedBaseChildren = (0, import_react20.useMemo)(() => {
12767
+ var _a;
12768
+ if (!baseCategoryId) return [];
12769
+ const children = [...(_a = childrenByParentId.get(baseCategoryId)) != null ? _a : []];
12770
+ return children.sort((a, b) => {
12771
+ var _a2, _b, _c, _d;
12772
+ const aHasChildren = ((_b = (_a2 = childrenByParentId.get(a.id)) == null ? void 0 : _a2.length) != null ? _b : 0) > 0;
12773
+ const bHasChildren = ((_d = (_c = childrenByParentId.get(b.id)) == null ? void 0 : _c.length) != null ? _d : 0) > 0;
12774
+ if (aHasChildren === bHasChildren) return 0;
12775
+ return aHasChildren ? -1 : 1;
12776
+ });
12777
+ }, [baseCategoryId, childrenByParentId]);
12778
+ const renderRow = ({
12779
+ entry,
12780
+ isExpanded,
12781
+ isSelected,
12782
+ onClick
12783
+ }) => {
12784
+ var _a, _b;
12785
+ const hasKnownChildren = ((_b = (_a = childrenByParentId.get(entry.id)) == null ? void 0 : _a.length) != null ? _b : 0) > 0;
12786
+ return /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)(
12787
+ "button",
12788
+ {
12789
+ type: "button",
12790
+ "aria-current": isSelected ? "true" : void 0,
12791
+ className: isSelected ? selectedRowClassName : idleRowClassName,
12792
+ onClick,
12793
+ children: [
12794
+ /* @__PURE__ */ (0, import_jsx_runtime129.jsx)("span", { className: "min-w-0 flex-1 truncate first-letter:uppercase", children: entry.label }),
12795
+ hasKnownChildren ? /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
12796
+ Icon,
12797
+ {
12798
+ name: isExpanded ? "chevron-up" : "chevron-down",
12799
+ size: "small",
12800
+ color: "currentColor",
12801
+ className: "shrink-0 text-agg-muted-foreground"
12802
+ }
12803
+ ) : /* @__PURE__ */ (0, import_jsx_runtime129.jsx)("span", { className: "shrink-0 text-agg-muted-foreground", children: entry.eventCount })
12804
+ ]
12805
+ },
12806
+ entry.id
12807
+ );
12808
+ };
12809
+ const renderBranch = (category, depth) => {
12810
+ var _a, _b, _c, _d, _e;
12811
+ const label2 = (_a = category.displayName) != null ? _a : category.name;
12812
+ const entry = {
12813
+ id: category.id,
12814
+ label: label2,
12815
+ eventCount: (_b = category.eventCount) != null ? _b : 0
12816
+ };
12817
+ const childCategories = (_c = childrenByParentId.get(category.id)) != null ? _c : [];
12818
+ const hasKnownChildren = childCategories.length > 0;
12819
+ const isExpanded = ((_d = categoryPath[depth]) == null ? void 0 : _d.id) === category.id && !collapsedCategoryIds.has(category.id);
12820
+ const isSelected = ((_e = categoryPath[depth]) == null ? void 0 : _e.id) === category.id && categoryPath.length === depth + 1;
12821
+ return /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)("div", { className: "flex w-full flex-col", children: [
12822
+ renderRow({
12823
+ entry,
12824
+ isExpanded,
12825
+ isSelected,
12826
+ onClick: () => onToggleCategory({ entry, depth, hasKnownChildren, isExpanded, isSelected })
12827
+ }),
12828
+ /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
12829
+ "div",
12830
+ {
12831
+ className: cn(
12832
+ "grid transition-[grid-template-rows] duration-150 ease-in-out motion-reduce:transition-none",
12833
+ isExpanded ? "grid-rows-[1fr]" : "grid-rows-[0fr]"
12834
+ ),
12835
+ children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)("div", { className: "overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)("div", { className: "flex w-full flex-col gap-1 pl-4 pt-1", children: childCategories.map((child) => renderBranch(child, depth + 1)) }) })
12836
+ }
12837
+ )
12838
+ ] }, category.id);
12839
+ };
12840
+ return /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)("div", { className: "flex w-full flex-col gap-1", children: [
12841
+ /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)(
12842
+ "button",
12843
+ {
12844
+ type: "button",
12845
+ "aria-current": !isDrilledIn ? "true" : void 0,
12846
+ className: !isDrilledIn ? selectedRowClassName : idleRowClassName,
12847
+ onClick: onSelectAll,
12848
+ children: [
12849
+ /* @__PURE__ */ (0, import_jsx_runtime129.jsx)("span", { className: "min-w-0 flex-1 truncate", children: labels.subcategoriesAll }),
12850
+ /* @__PURE__ */ (0, import_jsx_runtime129.jsx)("span", { className: "shrink-0 text-agg-muted-foreground", children: totalEventCount })
12851
+ ]
12852
+ }
12853
+ ),
12854
+ sortedBaseChildren.map((category) => renderBranch(category, 0))
12855
+ ] });
12856
+ };
12857
+ CategorySidebar.displayName = "CategorySidebar";
12690
12858
 
12691
12859
  // src/events/list/event-list-tabs.tsx
12692
12860
  var import_hooks43 = require("@agg-build/hooks");
12693
- var import_react19 = require("react");
12861
+ var import_react21 = require("react");
12694
12862
 
12695
12863
  // src/events/list/event-list.constants.ts
12696
12864
  var import_sdk13 = require("@agg-build/sdk");
@@ -12757,16 +12925,16 @@ var getDefaultEventListTabs = (labels) => {
12757
12925
  };
12758
12926
 
12759
12927
  // src/events/list/event-list-tabs.tsx
12760
- var import_jsx_runtime129 = require("react/jsx-runtime");
12928
+ var import_jsx_runtime130 = require("react/jsx-runtime");
12761
12929
  var renderTabIcon = (tab, isActive) => {
12762
12930
  if (tab.iconName === "warning-filled") {
12763
- return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(Icon, { name: "warning-filled", size: "small", color: "currentColor" });
12931
+ return /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(Icon, { name: "warning-filled", size: "small", color: "currentColor" });
12764
12932
  }
12765
12933
  if (tab.venueLogo) {
12766
- return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(VenueLogo, { venue: tab.venueLogo, size: "small" });
12934
+ return /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(VenueLogo, { venue: tab.venueLogo, size: "small" });
12767
12935
  }
12768
12936
  if (!tab.iconName) return null;
12769
- return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
12937
+ return /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
12770
12938
  Icon,
12771
12939
  {
12772
12940
  name: tab.iconName,
@@ -12779,7 +12947,7 @@ var useEventListTabs = (tabs) => {
12779
12947
  const labels = (0, import_hooks43.useLabels)();
12780
12948
  const { disabledVenues } = (0, import_hooks43.useAppConfig)();
12781
12949
  const { isLocationBlocked } = (0, import_hooks43.useGeoBlock)();
12782
- return (0, import_react19.useMemo)(() => {
12950
+ return (0, import_react21.useMemo)(() => {
12783
12951
  const baseTabs = tabs != null ? tabs : getDefaultEventListTabs(labels);
12784
12952
  return baseTabs.flatMap((tab) => {
12785
12953
  if (!tab.venueLogo) return [tab];
@@ -12808,13 +12976,13 @@ var EventListTabs = ({
12808
12976
  overflowBehavior
12809
12977
  }) => {
12810
12978
  const resolvedTabs = useEventListTabs(tabs);
12811
- (0, import_react19.useEffect)(() => {
12979
+ (0, import_react21.useEffect)(() => {
12812
12980
  const fallbackTab = resolvedTabs.find((tab) => !tab.disabled);
12813
12981
  if (!fallbackTab) return;
12814
12982
  if (resolvedTabs.some((tab) => tab.value === activeTab && !tab.disabled)) return;
12815
12983
  onTabChange(fallbackTab.value);
12816
12984
  }, [activeTab, onTabChange, resolvedTabs]);
12817
- const items = (0, import_react19.useMemo)(() => {
12985
+ const items = (0, import_react21.useMemo)(() => {
12818
12986
  return resolvedTabs.map((tab) => {
12819
12987
  const isActive = tab.value === activeTab;
12820
12988
  return {
@@ -12826,7 +12994,7 @@ var EventListTabs = ({
12826
12994
  };
12827
12995
  });
12828
12996
  }, [activeTab, resolvedTabs]);
12829
- return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
12997
+ return /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
12830
12998
  Tabs,
12831
12999
  {
12832
13000
  ariaLabel,
@@ -12839,93 +13007,9 @@ var EventListTabs = ({
12839
13007
  );
12840
13008
  };
12841
13009
  EventListTabs.displayName = "EventListTabs";
12842
- var useEventListTabsHeaderOverflow = (recomputeOn, options) => {
12843
- const headerRef = (0, import_react19.useRef)(null);
12844
- const titleRef = (0, import_react19.useRef)(null);
12845
- const requiredTabsWidthRef = (0, import_react19.useRef)(0);
12846
- const [shouldUseSelectOverflow, setShouldUseSelectOverflow] = (0, import_react19.useState)(false);
12847
- const updateTabsOverflowBehavior = (0, import_react19.useCallback)(() => {
12848
- var _a;
12849
- if (typeof window === "undefined") return;
12850
- const headerElement = headerRef.current;
12851
- const titleElement = titleRef.current;
12852
- if (!headerElement || !titleElement) return;
12853
- const headerStyles = window.getComputedStyle(headerElement);
12854
- const rawGap = headerStyles.columnGap || headerStyles.gap || "0";
12855
- const horizontalGap = Number.parseFloat(rawGap) || 0;
12856
- const availableTabsWidth = headerElement.clientWidth - titleElement.getBoundingClientRect().width - horizontalGap;
12857
- if (availableTabsWidth <= 0) {
12858
- setShouldUseSelectOverflow(true);
12859
- return;
12860
- }
12861
- const minTabsInlineWidthForSelect = options == null ? void 0 : options.minTabsInlineWidthForSelect;
12862
- if (typeof minTabsInlineWidthForSelect === "number" && availableTabsWidth < minTabsInlineWidthForSelect) {
12863
- setShouldUseSelectOverflow(true);
12864
- return;
12865
- }
12866
- const preferSelectOnOverflow = (_a = options == null ? void 0 : options.preferSelectOnOverflow) != null ? _a : true;
12867
- if (!preferSelectOnOverflow) {
12868
- setShouldUseSelectOverflow(false);
12869
- return;
12870
- }
12871
- const tabListElement = headerElement.querySelector(".agg-tab-list");
12872
- if (tabListElement) {
12873
- const currentRequiredWidth = tabListElement.scrollWidth;
12874
- if (currentRequiredWidth > 0) {
12875
- requiredTabsWidthRef.current = currentRequiredWidth;
12876
- }
12877
- const hasRealOverflow = tabListElement.scrollWidth - tabListElement.clientWidth > 1;
12878
- setShouldUseSelectOverflow(hasRealOverflow);
12879
- return;
12880
- }
12881
- if (requiredTabsWidthRef.current <= 0) return;
12882
- setShouldUseSelectOverflow(requiredTabsWidthRef.current > availableTabsWidth);
12883
- }, [options == null ? void 0 : options.minTabsInlineWidthForSelect, options == null ? void 0 : options.preferSelectOnOverflow]);
12884
- (0, import_react19.useEffect)(() => {
12885
- updateTabsOverflowBehavior();
12886
- }, [recomputeOn, updateTabsOverflowBehavior]);
12887
- (0, import_react19.useEffect)(() => {
12888
- if (typeof window === "undefined") return;
12889
- const handleResize = () => {
12890
- updateTabsOverflowBehavior();
12891
- };
12892
- window.addEventListener("resize", handleResize);
12893
- return () => {
12894
- window.removeEventListener("resize", handleResize);
12895
- };
12896
- }, [updateTabsOverflowBehavior]);
12897
- (0, import_react19.useEffect)(() => {
12898
- if (typeof ResizeObserver === "undefined") return;
12899
- const headerElement = headerRef.current;
12900
- const titleElement = titleRef.current;
12901
- if (!headerElement || !titleElement) return;
12902
- const resizeObserver = new ResizeObserver(() => {
12903
- updateTabsOverflowBehavior();
12904
- });
12905
- resizeObserver.observe(headerElement);
12906
- resizeObserver.observe(titleElement);
12907
- return () => {
12908
- resizeObserver.disconnect();
12909
- };
12910
- }, [updateTabsOverflowBehavior]);
12911
- return { headerRef, titleRef, shouldUseSelectOverflow };
12912
- };
12913
13010
 
12914
13011
  // src/events/list/index.tsx
12915
- var import_jsx_runtime130 = require("react/jsx-runtime");
12916
- var subcategoryMenuRowClassName = cn(
12917
- "flex min-h-11 w-full items-center justify-between rounded-[6px] px-3 py-3",
12918
- "text-left text-agg-sm font-agg-normal leading-agg-5",
12919
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-1 focus-visible:ring-offset-agg-secondary"
12920
- );
12921
- var subcategoryMenuIdleRowClassName = cn(
12922
- subcategoryMenuRowClassName,
12923
- "cursor-pointer text-agg-foreground hover:bg-agg-secondary-hover"
12924
- );
12925
- var subcategoryMenuSelectedRowClassName = cn(
12926
- subcategoryMenuRowClassName,
12927
- "cursor-pointer bg-agg-primary/10 text-agg-primary"
12928
- );
13012
+ var import_jsx_runtime131 = require("react/jsx-runtime");
12929
13013
  var SORT_ICON_BY_VALUE = {
12930
13014
  volume24hr: "sort-volume-24hr",
12931
13015
  topArbitrage: "sort-top-arbitrage",
@@ -12962,7 +13046,7 @@ var EventList = ({
12962
13046
  initialLoadedPageCount,
12963
13047
  stateRef
12964
13048
  }) => {
12965
- var _a, _b, _c;
13049
+ var _a, _b, _c, _d, _e;
12966
13050
  const labels = (0, import_hooks44.useLabels)();
12967
13051
  const { disabledVenues } = (0, import_hooks44.useAppConfig)();
12968
13052
  const {
@@ -12970,39 +13054,38 @@ var EventList = ({
12970
13054
  } = (0, import_hooks44.useSdkUiConfig)();
12971
13055
  const isDiscoveryFiltersEnabled = enableVenueEventDiscoveryFilters && !search;
12972
13056
  const resolvedTabs = useEventListTabs();
12973
- const visibleVenues = (0, import_react20.useMemo)(
13057
+ const visibleVenues = (0, import_react22.useMemo)(
12974
13058
  () => disabledVenues.length === 0 ? void 0 : (0, import_hooks44.getVisibleVenueIdsByConfig)(import_sdk14.VENUES, disabledVenues),
12975
13059
  [disabledVenues]
12976
13060
  );
12977
- const [activeTabValue, setActiveTabValue] = (0, import_react20.useState)(
13061
+ const [activeTabValue, setActiveTabValue] = (0, import_react22.useState)(
12978
13062
  (_b = initialVenueTab != null ? initialVenueTab : (_a = resolvedTabs[0]) == null ? void 0 : _a.value) != null ? _b : "matched"
12979
13063
  );
12980
- const [selectedSort, setSelectedSort] = (0, import_react20.useState)("volume24hr");
12981
- const [isSubcategoriesModalOpen, setIsSubcategoriesModalOpen] = (0, import_react20.useState)(false);
12982
- const [categoryPath, setCategoryPath] = (0, import_react20.useState)([]);
12983
- const [collapsedCategoryIds, setCollapsedCategoryIds] = (0, import_react20.useState)(() => /* @__PURE__ */ new Set());
12984
- const { headerRef, titleRef, shouldUseSelectOverflow } = useEventListTabsHeaderOverflow(resolvedTabs, { minTabsInlineWidthForSelect: 400, preferSelectOnOverflow: false });
12985
- const sortItems = (0, import_react20.useMemo)(() => {
13064
+ const [selectedSort, setSelectedSort] = (0, import_react22.useState)("volume24hr");
13065
+ const [isSubcategoriesModalOpen, setIsSubcategoriesModalOpen] = (0, import_react22.useState)(false);
13066
+ const [categoryPath, setCategoryPath] = (0, import_react22.useState)([]);
13067
+ const [collapsedCategoryIds, setCollapsedCategoryIds] = (0, import_react22.useState)(() => /* @__PURE__ */ new Set());
13068
+ const sortItems = (0, import_react22.useMemo)(() => {
12986
13069
  return [
12987
13070
  {
12988
13071
  value: "volume24hr",
12989
13072
  label: labels.eventList.sortBy24hVolume,
12990
- icon: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(Icon, { name: SORT_ICON_BY_VALUE.volume24hr, size: "small", color: "currentColor" })
13073
+ icon: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(Icon, { name: SORT_ICON_BY_VALUE.volume24hr, size: "small", color: "currentColor" })
12991
13074
  },
12992
13075
  {
12993
13076
  value: "topArbitrage",
12994
13077
  label: labels.eventList.sortByTopArbitrage,
12995
- icon: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(Icon, { name: SORT_ICON_BY_VALUE.topArbitrage, size: "small", color: "currentColor" })
13078
+ icon: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(Icon, { name: SORT_ICON_BY_VALUE.topArbitrage, size: "small", color: "currentColor" })
12996
13079
  },
12997
13080
  {
12998
13081
  value: "volume",
12999
13082
  label: labels.eventList.sortByTotalVolume,
13000
- icon: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(Icon, { name: SORT_ICON_BY_VALUE.volume, size: "small", color: "currentColor" })
13083
+ icon: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(Icon, { name: SORT_ICON_BY_VALUE.volume, size: "small", color: "currentColor" })
13001
13084
  },
13002
13085
  {
13003
13086
  value: "endDate",
13004
13087
  label: labels.eventList.sortByEndingSoon,
13005
- icon: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(Icon, { name: SORT_ICON_BY_VALUE.endDate, size: "small", color: "currentColor" })
13088
+ icon: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(Icon, { name: SORT_ICON_BY_VALUE.endDate, size: "small", color: "currentColor" })
13006
13089
  }
13007
13090
  ];
13008
13091
  }, [
@@ -13012,14 +13095,9 @@ var EventList = ({
13012
13095
  labels.eventList.sortByTotalVolume
13013
13096
  ]);
13014
13097
  const baseCategoryId = (_c = categoryIds == null ? void 0 : categoryIds[0]) != null ? _c : null;
13015
- (0, import_react20.useEffect)(() => {
13098
+ (0, import_react22.useEffect)(() => {
13016
13099
  if (!isDiscoveryFiltersEnabled) return;
13017
- if (!baseCategoryId) {
13018
- setCategoryPath([]);
13019
- setCollapsedCategoryIds(/* @__PURE__ */ new Set());
13020
- return;
13021
- }
13022
- setCategoryPath([{ id: baseCategoryId, label: baseCategoryId, eventCount: 0 }]);
13100
+ setCategoryPath([]);
13023
13101
  setCollapsedCategoryIds(/* @__PURE__ */ new Set());
13024
13102
  }, [baseCategoryId, isDiscoveryFiltersEnabled]);
13025
13103
  const { categories: topLevelCategories } = (0, import_hooks44.useCategories)({
@@ -13027,10 +13105,10 @@ var EventList = ({
13027
13105
  enabled: isDiscoveryFiltersEnabled,
13028
13106
  limit: 100
13029
13107
  });
13030
- const sortedTopLevelCategories = (0, import_react20.useMemo)(() => {
13108
+ const sortedTopLevelCategories = (0, import_react22.useMemo)(() => {
13031
13109
  return sortCategoriesForNavigation(topLevelCategories);
13032
13110
  }, [topLevelCategories]);
13033
- const baseCategoryChildPrefetchIds = (0, import_react20.useMemo)(() => {
13111
+ const baseCategoryChildPrefetchIds = (0, import_react22.useMemo)(() => {
13034
13112
  return Array.from(
13035
13113
  /* @__PURE__ */ new Set([
13036
13114
  ...sortedTopLevelCategories.map((category) => category.id),
@@ -13044,23 +13122,28 @@ var EventList = ({
13044
13122
  parentIds: baseCategoryChildPrefetchIds,
13045
13123
  limit: 100
13046
13124
  });
13047
- const visibleChildPrefetchIds = (0, import_react20.useMemo)(() => {
13048
- var _a2;
13125
+ const visibleChildPrefetchIds = (0, import_react22.useMemo)(() => {
13126
+ var _a2, _b2;
13049
13127
  const ids = /* @__PURE__ */ new Set();
13128
+ if (baseCategoryId) {
13129
+ for (const child of (_a2 = baseChildrenByParentId.get(baseCategoryId)) != null ? _a2 : []) {
13130
+ ids.add(child.id);
13131
+ }
13132
+ }
13050
13133
  for (const expandedCategory of categoryPath) {
13051
- for (const childCategory of (_a2 = baseChildrenByParentId.get(expandedCategory.id)) != null ? _a2 : []) {
13134
+ for (const childCategory of (_b2 = baseChildrenByParentId.get(expandedCategory.id)) != null ? _b2 : []) {
13052
13135
  ids.add(childCategory.id);
13053
13136
  }
13054
13137
  }
13055
13138
  return Array.from(ids);
13056
- }, [baseChildrenByParentId, categoryPath]);
13139
+ }, [baseCategoryId, baseChildrenByParentId, categoryPath]);
13057
13140
  const { childrenByParentId: visibleChildrenByParentId } = (0, import_hooks44.useCategoryChildren)({
13058
13141
  queryKeyScope: "event-list-category-children",
13059
13142
  enabled: isDiscoveryFiltersEnabled,
13060
13143
  parentIds: visibleChildPrefetchIds,
13061
13144
  limit: 100
13062
13145
  });
13063
- const visibleGrandchildPrefetchIds = (0, import_react20.useMemo)(() => {
13146
+ const visibleGrandchildPrefetchIds = (0, import_react22.useMemo)(() => {
13064
13147
  var _a2;
13065
13148
  const ids = /* @__PURE__ */ new Set();
13066
13149
  for (const expandedCategory of categoryPath) {
@@ -13076,43 +13159,41 @@ var EventList = ({
13076
13159
  parentIds: visibleGrandchildPrefetchIds,
13077
13160
  limit: 100
13078
13161
  });
13079
- const childrenByParentId = (0, import_react20.useMemo)(() => {
13162
+ const childrenByParentId = (0, import_react22.useMemo)(() => {
13080
13163
  return new Map([
13081
13164
  ...baseChildrenByParentId,
13082
13165
  ...visibleChildrenByParentId,
13083
13166
  ...visibleGrandchildrenByParentId
13084
13167
  ]);
13085
13168
  }, [baseChildrenByParentId, visibleChildrenByParentId, visibleGrandchildrenByParentId]);
13086
- const shouldRenderSubcategoryFilters = isDiscoveryFiltersEnabled && (sortedTopLevelCategories.length > 0 || categoryPath.length > 0);
13087
- const totalTopLevelEventCount = (0, import_react20.useMemo)(() => {
13088
- return sortedTopLevelCategories.reduce((accumulator, category) => {
13089
- var _a2;
13090
- return accumulator + ((_a2 = category.eventCount) != null ? _a2 : 0);
13091
- }, 0);
13092
- }, [sortedTopLevelCategories]);
13093
- const resolvedCategoryIds = (0, import_react20.useMemo)(() => {
13169
+ const shouldRenderSubcategoryFilters = isDiscoveryFiltersEnabled && baseCategoryId !== null && (((_e = (_d = childrenByParentId.get(baseCategoryId)) == null ? void 0 : _d.length) != null ? _e : 0) > 0 || categoryPath.length > 0);
13170
+ const baseCategoryEventCount = (0, import_react22.useMemo)(() => {
13171
+ var _a2, _b2;
13172
+ return (_b2 = (_a2 = sortedTopLevelCategories.find((c) => c.id === baseCategoryId)) == null ? void 0 : _a2.eventCount) != null ? _b2 : 0;
13173
+ }, [baseCategoryId, sortedTopLevelCategories]);
13174
+ const resolvedCategoryIds = (0, import_react22.useMemo)(() => {
13094
13175
  if (!isDiscoveryFiltersEnabled) return categoryIds;
13095
- return resolveCategoryIdsFromPath(categoryPath, void 0);
13096
- }, [categoryIds, categoryPath, isDiscoveryFiltersEnabled]);
13097
- const sortQueryParams = (0, import_react20.useMemo)(() => {
13176
+ return resolveCategoryIdsFromPath(categoryPath, baseCategoryId ? [baseCategoryId] : void 0);
13177
+ }, [baseCategoryId, categoryIds, categoryPath, isDiscoveryFiltersEnabled]);
13178
+ const sortQueryParams = (0, import_react22.useMemo)(() => {
13098
13179
  return resolveSortQueryParams(selectedSort);
13099
13180
  }, [selectedSort]);
13100
- const activeTab = (0, import_react20.useMemo)(() => {
13181
+ const activeTab = (0, import_react22.useMemo)(() => {
13101
13182
  return resolvedTabs.find((tab) => tab.value === activeTabValue);
13102
13183
  }, [activeTabValue, resolvedTabs]);
13103
- const venues = (0, import_react20.useMemo)(() => {
13184
+ const venues = (0, import_react22.useMemo)(() => {
13104
13185
  return resolveTabVenus(activeTab, visibleVenues);
13105
13186
  }, [activeTab, visibleVenues]);
13106
- const matchStatus = (0, import_react20.useMemo)(() => {
13187
+ const matchStatus = (0, import_react22.useMemo)(() => {
13107
13188
  return activeTabValue === "matched" ? activeTab == null ? void 0 : activeTab.matchStatus : void 0;
13108
13189
  }, [activeTabValue, activeTab]);
13109
- const resolvedMaxVisibleItems = (0, import_react20.useMemo)(() => {
13190
+ const resolvedMaxVisibleItems = (0, import_react22.useMemo)(() => {
13110
13191
  if (!Number.isFinite(maxVisibleItems)) return void 0;
13111
13192
  return Math.max(1, Math.floor(maxVisibleItems));
13112
13193
  }, [maxVisibleItems]);
13113
13194
  const requestLimit = resolvedMaxVisibleItems != null ? resolvedMaxVisibleItems : limit;
13114
13195
  const shouldPaginate = resolvedMaxVisibleItems == null;
13115
- const endDateFrom = (0, import_react20.useMemo)(() => {
13196
+ const endDateFrom = (0, import_react22.useMemo)(() => {
13116
13197
  if (search) return void 0;
13117
13198
  const BUCKET_MINUTES = 5;
13118
13199
  const bucket = /* @__PURE__ */ new Date();
@@ -13141,21 +13222,21 @@ var EventList = ({
13141
13222
  endDateFrom,
13142
13223
  initialPages: initialLoadedPageCount
13143
13224
  });
13144
- (0, import_react20.useEffect)(() => {
13225
+ (0, import_react22.useEffect)(() => {
13145
13226
  if (stateRef) {
13146
13227
  stateRef.current = { venueTab: activeTabValue, loadedPageCount };
13147
13228
  }
13148
13229
  }, [stateRef, activeTabValue, loadedPageCount]);
13149
- const filteredEvents = (0, import_react20.useMemo)(() => {
13230
+ const filteredEvents = (0, import_react22.useMemo)(() => {
13150
13231
  return filterEventsByTabValue(events, activeTabValue);
13151
13232
  }, [events, activeTabValue]);
13152
- const groupedEvents = (0, import_react20.useMemo)(() => {
13233
+ const groupedEvents = (0, import_react22.useMemo)(() => {
13153
13234
  return splitEventsByLifecycle(filteredEvents);
13154
13235
  }, [filteredEvents]);
13155
- const orderedEvents = (0, import_react20.useMemo)(() => {
13236
+ const orderedEvents = (0, import_react22.useMemo)(() => {
13156
13237
  return groupedEvents.open;
13157
13238
  }, [groupedEvents.open]);
13158
- const tileEvents = (0, import_react20.useMemo)(() => {
13239
+ const tileEvents = (0, import_react22.useMemo)(() => {
13159
13240
  const normalizedEvents = orderedEvents.map((event) => mapEventToEventListItemEvent(event)).filter((event) => event != null);
13160
13241
  if (resolvedMaxVisibleItems == null) return normalizedEvents;
13161
13242
  return normalizedEvents.slice(0, resolvedMaxVisibleItems);
@@ -13163,8 +13244,8 @@ var EventList = ({
13163
13244
  const shouldRenderLoadingState = isLoading && !isPlaceholderData && tileEvents.length === 0;
13164
13245
  const shouldRenderEmptyState = !isLoading && !isError && tileEvents.length === 0;
13165
13246
  const shouldRenderPaginationLoadingItems = shouldPaginate && hasNextPage;
13166
- const loadMoreRef = (0, import_react20.useRef)(null);
13167
- (0, import_react20.useEffect)(() => {
13247
+ const loadMoreRef = (0, import_react22.useRef)(null);
13248
+ (0, import_react22.useEffect)(() => {
13168
13249
  if (!shouldPaginate) return;
13169
13250
  if (!hasNextPage) return;
13170
13251
  if (typeof IntersectionObserver === "undefined") return;
@@ -13189,11 +13270,10 @@ var EventList = ({
13189
13270
  const gridClassName = cn(
13190
13271
  "grid grid-cols-[repeat(auto-fill,minmax(240px,1fr))] md:grid-cols-[repeat(auto-fill,minmax(360px,1fr))] gap-4"
13191
13272
  );
13192
- const isDrilledIn = categoryPath.length > 0;
13193
13273
  const handleSelectAllCategories = () => {
13194
13274
  setCategoryPath([]);
13195
13275
  setCollapsedCategoryIds(/* @__PURE__ */ new Set());
13196
- onCategoryRootChange == null ? void 0 : onCategoryRootChange(void 0);
13276
+ onCategoryRootChange == null ? void 0 : onCategoryRootChange(baseCategoryId != null ? baseCategoryId : void 0);
13197
13277
  setIsSubcategoriesModalOpen(false);
13198
13278
  };
13199
13279
  const handleToggleSubcategory = ({
@@ -13203,7 +13283,6 @@ var EventList = ({
13203
13283
  isExpanded,
13204
13284
  isSelected
13205
13285
  }) => {
13206
- var _a2;
13207
13286
  setCategoryPath((prev) => [...prev.slice(0, depth), entry]);
13208
13287
  setCollapsedCategoryIds((prev) => {
13209
13288
  const next = new Set(prev);
@@ -13214,122 +13293,41 @@ var EventList = ({
13214
13293
  next.delete(entry.id);
13215
13294
  return next;
13216
13295
  });
13217
- onCategoryRootChange == null ? void 0 : onCategoryRootChange(depth === 0 ? entry.id : (_a2 = categoryPath[0]) == null ? void 0 : _a2.id);
13296
+ onCategoryRootChange == null ? void 0 : onCategoryRootChange(baseCategoryId != null ? baseCategoryId : void 0);
13218
13297
  };
13219
- const renderSubcategoryTreeRow = ({
13220
- entry,
13221
- isExpanded,
13222
- isSelected,
13223
- onClick
13224
- }) => {
13225
- var _a2, _b2;
13226
- const hasKnownChildren = ((_b2 = (_a2 = childrenByParentId.get(entry.id)) == null ? void 0 : _a2.length) != null ? _b2 : 0) > 0;
13227
- return /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(
13228
- "button",
13229
- {
13230
- type: "button",
13231
- "aria-current": isSelected ? "true" : void 0,
13232
- className: isSelected ? subcategoryMenuSelectedRowClassName : subcategoryMenuIdleRowClassName,
13233
- onClick,
13234
- children: [
13235
- /* @__PURE__ */ (0, import_jsx_runtime130.jsx)("span", { className: "min-w-0 truncate first-letter:uppercase", children: entry.label }),
13236
- hasKnownChildren ? /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
13237
- Icon,
13238
- {
13239
- name: isExpanded ? "chevron-up" : "chevron-down",
13240
- size: "small",
13241
- color: "currentColor",
13242
- className: "shrink-0 text-agg-muted-foreground"
13243
- }
13244
- ) : /* @__PURE__ */ (0, import_jsx_runtime130.jsx)("span", { className: "shrink-0 text-agg-muted-foreground", children: entry.eventCount })
13245
- ]
13246
- },
13247
- entry.id
13248
- );
13249
- };
13250
- const renderSubcategoryBranch = (category, depth) => {
13251
- var _a2, _b2, _c2, _d, _e;
13252
- const label2 = (_a2 = category.displayName) != null ? _a2 : category.name;
13253
- const entry = {
13254
- id: category.id,
13255
- label: label2,
13256
- eventCount: (_b2 = category.eventCount) != null ? _b2 : 0
13257
- };
13258
- const childCategories = (_c2 = childrenByParentId.get(category.id)) != null ? _c2 : [];
13259
- const hasKnownChildren = childCategories.length > 0;
13260
- const isExpanded = ((_d = categoryPath[depth]) == null ? void 0 : _d.id) === category.id && !collapsedCategoryIds.has(category.id);
13261
- const isSelected = ((_e = categoryPath[depth]) == null ? void 0 : _e.id) === category.id && categoryPath.length === depth + 1;
13262
- return /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)("div", { className: "flex w-full flex-col gap-1", children: [
13263
- renderSubcategoryTreeRow({
13264
- entry,
13265
- isExpanded,
13266
- isSelected,
13267
- onClick: () => handleToggleSubcategory({
13268
- entry,
13269
- depth,
13270
- hasKnownChildren,
13271
- isExpanded,
13272
- isSelected
13273
- })
13274
- }),
13275
- isExpanded ? /* @__PURE__ */ (0, import_jsx_runtime130.jsx)("div", { className: "flex w-full flex-col gap-1 pl-4", children: childCategories.map(
13276
- (childCategory) => renderSubcategoryBranch(childCategory, depth + 1)
13277
- ) }) : null
13278
- ] }, category.id);
13279
- };
13280
- const subcategoriesListContent = /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(import_jsx_runtime130.Fragment, { children: [
13281
- /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(
13282
- "button",
13283
- {
13284
- type: "button",
13285
- "aria-current": !isDrilledIn ? "true" : void 0,
13286
- className: !isDrilledIn ? subcategoryMenuSelectedRowClassName : subcategoryMenuIdleRowClassName,
13287
- onClick: handleSelectAllCategories,
13288
- children: [
13289
- /* @__PURE__ */ (0, import_jsx_runtime130.jsx)("span", { className: "min-w-0 truncate", children: labels.eventList.subcategoriesAll }),
13290
- /* @__PURE__ */ (0, import_jsx_runtime130.jsx)("span", { className: "text-agg-muted-foreground", children: totalTopLevelEventCount })
13291
- ]
13292
- }
13293
- ),
13294
- sortedTopLevelCategories.map((category) => renderSubcategoryBranch(category, 0))
13295
- ] });
13296
13298
  if (shouldRenderLoadingState) {
13297
- return /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
13299
+ return /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
13298
13300
  Skeleton,
13299
13301
  {
13300
13302
  view: "event-list",
13301
13303
  ariaLabel: labels.eventList.loading(title2),
13302
- withSidebar: isDiscoveryFiltersEnabled
13304
+ withSidebar: shouldRenderSubcategoryFilters
13303
13305
  }
13304
13306
  );
13305
13307
  }
13306
- return /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)("section", { className: "agg-event-list flex w-full flex-col gap-2 md:gap-5 t", children: [
13307
- /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(
13308
+ return /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)("section", { className: "agg-event-list flex w-full flex-col gap-2 md:gap-5 t", children: [
13309
+ /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(
13308
13310
  "header",
13309
13311
  {
13310
- ref: headerRef,
13311
13312
  className: cn(
13312
13313
  "agg-event-list-header",
13313
13314
  "flex flex-col w-full items-start justify-between",
13314
13315
  "gap-2 sm:flex-row sm:items-center sm:gap-4"
13315
13316
  ),
13316
13317
  children: [
13317
- /* @__PURE__ */ (0, import_jsx_runtime130.jsx)("div", { ref: titleRef, className: "agg-event-list-title min-w-32", children: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(Typography, { as: "h2", variant: "title", className: "truncate first-letter:uppercase", children: title2 }) }),
13318
- /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)("div", { className: "hidden min-w-0 max-w-full items-center gap-3 md:flex", children: [
13319
- /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
13318
+ /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("div", { className: "agg-event-list-title min-w-32", children: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(Typography, { as: "h2", variant: "title", className: "truncate first-letter:uppercase", children: title2 }) }),
13319
+ /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)("div", { className: "hidden min-w-0 max-w-full items-center gap-3 md:flex", children: [
13320
+ /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
13320
13321
  EventListTabs,
13321
13322
  {
13322
13323
  ariaLabel: labels.eventList.tabsAria(title2),
13323
- className: cn(
13324
- "agg-event-list-tabs w-fit max-w-full flex-1",
13325
- shouldUseSelectOverflow ? "min-w-[220px]" : "min-w-[400px]"
13326
- ),
13324
+ className: "agg-event-list-tabs min-w-0 flex-1 max-w-[600px]!",
13327
13325
  activeTab: activeTabValue,
13328
13326
  onTabChange: setActiveTabValue,
13329
- overflowBehavior: shouldUseSelectOverflow ? "select" : "scroll"
13327
+ overflowBehavior: "scroll"
13330
13328
  }
13331
13329
  ),
13332
- /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
13330
+ /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
13333
13331
  Select,
13334
13332
  {
13335
13333
  ariaLabel: labels.eventList.sortByLabel,
@@ -13345,8 +13343,8 @@ var EventList = ({
13345
13343
  ]
13346
13344
  }
13347
13345
  ),
13348
- /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)("div", { className: "flex w-full gap-2 md:hidden mb-3", children: [
13349
- /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
13346
+ /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)("div", { className: "flex w-full gap-2 md:hidden mb-3", children: [
13347
+ /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
13350
13348
  EventListTabs,
13351
13349
  {
13352
13350
  ariaLabel: labels.eventList.tabsAria(title2),
@@ -13356,7 +13354,7 @@ var EventList = ({
13356
13354
  overflowBehavior: "select"
13357
13355
  }
13358
13356
  ),
13359
- /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
13357
+ /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
13360
13358
  Select,
13361
13359
  {
13362
13360
  ariaLabel: labels.eventList.sortByLabel,
@@ -13367,24 +13365,36 @@ var EventList = ({
13367
13365
  contentClassName: "rounded-[12px] py-2 shadow-[0_8px_16px_rgba(0,0,0,0.1)]"
13368
13366
  }
13369
13367
  ),
13370
- shouldRenderSubcategoryFilters ? /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
13368
+ shouldRenderSubcategoryFilters ? /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
13371
13369
  "button",
13372
13370
  {
13373
13371
  type: "button",
13374
13372
  className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-[8px] border-2 border-agg-primary bg-agg-secondary text-agg-foreground cursor-pointer",
13375
13373
  "aria-label": labels.eventList.subcategoriesOpenAria,
13376
13374
  onClick: () => setIsSubcategoriesModalOpen(true),
13377
- children: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(Icon, { name: "apps", size: "small", color: "currentColor" })
13375
+ children: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(Icon, { name: "apps", size: "small", color: "currentColor" })
13378
13376
  }
13379
13377
  ) : null
13380
13378
  ] }),
13381
- /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(
13379
+ /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(
13382
13380
  "div",
13383
13381
  {
13384
13382
  className: cn("flex w-full gap-6", shouldRenderSubcategoryFilters ? "md:items-start" : ""),
13385
13383
  children: [
13386
- shouldRenderSubcategoryFilters ? /* @__PURE__ */ (0, import_jsx_runtime130.jsx)("aside", { className: "hidden w-[200px] shrink-0 md:block", children: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)("div", { className: "flex w-full flex-col gap-1 rounded-[8px] border border-agg-separator bg-agg-secondary p-2", children: subcategoriesListContent }) }) : null,
13387
- /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(
13384
+ shouldRenderSubcategoryFilters ? /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("aside", { className: "hidden w-[200px] shrink-0 md:block self-start sticky top-4", children: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("div", { className: "agg-sidebar max-h-[calc(100vh-19rem)] overflow-y-auto rounded-[8px] border border-agg-separator bg-agg-secondary p-2", children: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
13385
+ CategorySidebar,
13386
+ {
13387
+ baseCategoryId,
13388
+ childrenByParentId,
13389
+ categoryPath,
13390
+ collapsedCategoryIds,
13391
+ totalEventCount: baseCategoryEventCount,
13392
+ labels: { subcategoriesAll: labels.eventList.subcategoriesAll },
13393
+ onSelectAll: handleSelectAllCategories,
13394
+ onToggleCategory: handleToggleSubcategory
13395
+ }
13396
+ ) }) }) : null,
13397
+ /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(
13388
13398
  "div",
13389
13399
  {
13390
13400
  className: cn(
@@ -13395,7 +13405,7 @@ var EventList = ({
13395
13405
  gridClassName
13396
13406
  ),
13397
13407
  children: [
13398
- tileEvents.map((event) => /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
13408
+ tileEvents.map((event) => /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
13399
13409
  EventListItem,
13400
13410
  {
13401
13411
  event,
@@ -13410,7 +13420,7 @@ var EventList = ({
13410
13420
  },
13411
13421
  event.id
13412
13422
  )),
13413
- shouldRenderPaginationLoadingItems ? Array.from({ length: 6 }).map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
13423
+ shouldRenderPaginationLoadingItems ? Array.from({ length: 6 }).map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
13414
13424
  EventListItem,
13415
13425
  {
13416
13426
  isLoading: true,
@@ -13420,20 +13430,20 @@ var EventList = ({
13420
13430
  },
13421
13431
  `loading-${index}`
13422
13432
  )) : null,
13423
- shouldRenderEmptyState ? /* @__PURE__ */ (0, import_jsx_runtime130.jsx)("div", { className: "col-span-full w-full", children: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
13433
+ shouldRenderEmptyState ? /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("div", { className: "col-span-full w-full", children: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
13424
13434
  StateMessage,
13425
13435
  {
13426
13436
  title: labels.eventList.emptyTitle,
13427
13437
  description: labels.eventList.emptyDescription,
13428
- icon: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(Icon, { name: "search-empty" })
13438
+ icon: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(Icon, { name: "search-empty" })
13429
13439
  }
13430
13440
  ) }) : null,
13431
- isError ? /* @__PURE__ */ (0, import_jsx_runtime130.jsx)("div", { className: "col-span-full w-full", children: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
13441
+ isError ? /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("div", { className: "col-span-full w-full", children: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
13432
13442
  StateMessage,
13433
13443
  {
13434
13444
  title: labels.eventList.errorTitle,
13435
13445
  description: labels.eventList.errorDescription,
13436
- icon: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(Icon, { name: "warning" })
13446
+ icon: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(Icon, { name: "warning" })
13437
13447
  }
13438
13448
  ) }) : null
13439
13449
  ]
@@ -13442,20 +13452,45 @@ var EventList = ({
13442
13452
  ]
13443
13453
  }
13444
13454
  ),
13445
- shouldRenderSubcategoryFilters ? /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(Modal, { open: isSubcategoriesModalOpen, onOpenChange: setIsSubcategoriesModalOpen, children: /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(
13455
+ shouldRenderSubcategoryFilters ? /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(Modal, { open: isSubcategoriesModalOpen, onOpenChange: setIsSubcategoriesModalOpen, children: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
13446
13456
  Modal.Container,
13447
13457
  {
13448
13458
  classNames: {
13449
- content: "items-end p-0",
13459
+ // pointer-events-none lets clicks on the empty area above the panel pass through
13460
+ // to Dialog.Overlay, which triggers Radix's outside-click dismiss.
13461
+ content: "items-end p-0 pointer-events-none",
13450
13462
  container: "w-full max-w-none border-0 bg-transparent shadow-none"
13451
13463
  },
13452
- children: [
13453
- /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(Dialog2.Title, { className: "sr-only", children: labels.eventList.subcategoriesLabel }),
13454
- /* @__PURE__ */ (0, import_jsx_runtime130.jsx)("div", { className: "w-full rounded-t-[12px] border border-agg-separator bg-agg-secondary p-4", children: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)("div", { className: "flex flex-col gap-1", children: subcategoriesListContent }) })
13455
- ]
13464
+ children: /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)("div", { className: "pointer-events-auto w-full rounded-t-[12px] border border-agg-separator bg-agg-secondary", children: [
13465
+ /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("div", { className: "flex justify-center pb-1 pt-3", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("div", { className: "h-1 w-10 rounded-full bg-agg-muted-foreground/30" }) }),
13466
+ /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)("div", { className: "flex items-center justify-between px-4 pb-2 pt-1", children: [
13467
+ /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(Dialog2.Title, { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: labels.eventList.subcategoriesLabel }),
13468
+ /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
13469
+ Dialog2.Close,
13470
+ {
13471
+ className: "flex cursor-pointer items-center justify-center rounded-full p-1 text-agg-muted-foreground hover:bg-agg-secondary-hover",
13472
+ "aria-label": labels.common.close,
13473
+ children: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(CloseIcon, { className: "h-5 w-5" })
13474
+ }
13475
+ )
13476
+ ] }),
13477
+ /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("div", { className: "flex flex-col gap-1 px-4 pb-4", children: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
13478
+ CategorySidebar,
13479
+ {
13480
+ baseCategoryId,
13481
+ childrenByParentId,
13482
+ categoryPath,
13483
+ collapsedCategoryIds,
13484
+ totalEventCount: baseCategoryEventCount,
13485
+ labels: { subcategoriesAll: labels.eventList.subcategoriesAll },
13486
+ onSelectAll: handleSelectAllCategories,
13487
+ onToggleCategory: handleToggleSubcategory
13488
+ }
13489
+ ) })
13490
+ ] })
13456
13491
  }
13457
13492
  ) }) : null,
13458
- shouldPaginate && hasNextPage ? /* @__PURE__ */ (0, import_jsx_runtime130.jsx)("div", { ref: loadMoreRef, className: "agg-event-list-sentinel h-px w-full", "aria-hidden": true }) : null
13493
+ shouldPaginate && hasNextPage ? /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("div", { ref: loadMoreRef, className: "agg-event-list-sentinel h-px w-full", "aria-hidden": true }) : null
13459
13494
  ] });
13460
13495
  };
13461
13496
  EventList.displayName = "EventList";