@agg-build/ui 2.4.2 → 2.4.5

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 (38) hide show
  1. package/dist/{chunk-EOCHFD2U.mjs → chunk-CXSIXL7M.mjs} +38 -36
  2. package/dist/{chunk-3FLLEJFM.mjs → chunk-GWRFSQQK.mjs} +75 -9
  3. package/dist/{chunk-MDO3NMXP.mjs → chunk-I4X5UNCT.mjs} +343 -193
  4. package/dist/{chunk-G5BXCT5Y.mjs → chunk-JVRTJQPZ.mjs} +1 -1
  5. package/dist/{chunk-GUYFQP7L.mjs → chunk-P5CVJQPW.mjs} +288 -291
  6. package/dist/{chunk-2ET5CXOU.mjs → chunk-PTNFXXOV.mjs} +53 -21
  7. package/dist/{chunk-G5Y45GIA.mjs → chunk-UH3DUTMG.mjs} +352 -43
  8. package/dist/events.js +679 -194
  9. package/dist/events.mjs +3 -3
  10. package/dist/index.js +1097 -547
  11. package/dist/index.mjs +13 -7
  12. package/dist/modals.js +333 -297
  13. package/dist/modals.mjs +3 -3
  14. package/dist/pages.js +809 -262
  15. package/dist/pages.mjs +6 -6
  16. package/dist/primitives.js +53 -21
  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 +3265 -2765
  21. package/dist/trading.mjs +10 -4
  22. package/dist/types/events/item-details/event-list-item-details.constants.d.mts +1 -1
  23. package/dist/types/events/item-details/event-list-item-details.constants.d.ts +1 -1
  24. package/dist/types/events/item-details/settlement-summary.d.mts +3 -1
  25. package/dist/types/events/item-details/settlement-summary.d.ts +3 -1
  26. package/dist/types/onboarding/index.d.mts +1 -1
  27. package/dist/types/onboarding/index.d.ts +1 -1
  28. package/dist/types/onboarding/steps/connect-accounts.d.mts +1 -1
  29. package/dist/types/onboarding/steps/connect-accounts.d.ts +1 -1
  30. package/dist/types/primitives/icon/icon.constants.d.mts +1 -0
  31. package/dist/types/primitives/icon/icon.constants.d.ts +1 -0
  32. package/dist/types/shared/use-horizontal-scroll-state.d.mts +3 -0
  33. package/dist/types/shared/use-horizontal-scroll-state.d.ts +3 -0
  34. package/dist/types/trading/place-order/index.place-order.utils.d.mts +1 -0
  35. package/dist/types/trading/place-order/index.place-order.utils.d.ts +1 -0
  36. package/dist/types/trading/settlement/index.d.mts +19 -1
  37. package/dist/types/trading/settlement/index.d.ts +19 -1
  38. package/package.json +2 -2
package/dist/events.js CHANGED
@@ -1387,6 +1387,12 @@ var iconSizeClasses = {
1387
1387
  medium: "h-6 w-6",
1388
1388
  large: "h-8 w-8"
1389
1389
  };
1390
+ var iconSizePixels = {
1391
+ xs: 12,
1392
+ small: 16,
1393
+ medium: 24,
1394
+ large: 32
1395
+ };
1390
1396
 
1391
1397
  // src/primitives/search/search-empty-icon.tsx
1392
1398
  var import_jsx_runtime38 = require("react/jsx-runtime");
@@ -2988,6 +2994,8 @@ var Icon = (_a) => {
2988
2994
  __spreadValues({
2989
2995
  color,
2990
2996
  className: cn("group/agg-icon", resolvedClassName),
2997
+ width: iconSizePixels[size],
2998
+ height: iconSizePixels[size],
2991
2999
  style: resolvedStyle
2992
3000
  }, props)
2993
3001
  );
@@ -4471,7 +4479,7 @@ EventListSkeletonView.displayName = "EventListSkeletonView";
4471
4479
  var import_hooks12 = require("@agg-build/hooks");
4472
4480
 
4473
4481
  // src/events/item-details/event-list-item-details.constants.ts
4474
- var detailsBaseCardClassName = "w-full gap-6 p-5 md:gap-8";
4482
+ var detailsBaseCardClassName = "w-full gap-6 p-4 md:p-5 md:gap-8";
4475
4483
 
4476
4484
  // src/primitives/skeleton/views/event-list-item-details-skeleton-view.tsx
4477
4485
  var import_jsx_runtime95 = require("react/jsx-runtime");
@@ -4782,17 +4790,10 @@ var SettlementSkeletonView = ({
4782
4790
  children: [
4783
4791
  /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { className: "flex w-full items-center justify-between gap-4", children: [
4784
4792
  /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(SkeletonBlock, { className: "h-4 w-[81px] rounded-agg-sm" }),
4785
- /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(SkeletonBlock, { className: "h-5 w-full max-w-[240px] rounded-agg-sm" })
4786
- ] }),
4787
- /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { className: "flex w-full flex-col gap-3", children: [
4788
- /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(SkeletonBlock, { className: "h-5 w-[200px] rounded-agg-sm" }),
4789
- /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { className: "flex flex-col gap-2", children: [
4790
- /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(SkeletonBlock, { className: "h-4 w-full max-w-[320px] rounded-agg-sm" }),
4791
- /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(SkeletonBlock, { className: "h-4 w-full max-w-[280px] rounded-agg-sm" })
4792
- ] })
4793
+ /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(SkeletonBlock, { className: "h-5 w-[240px] max-w-[60%] rounded-agg-sm" })
4793
4794
  ] }),
4794
- /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("div", { className: "h-px w-full bg-agg-separator" }),
4795
- /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { className: "flex w-full flex-col gap-3", children: [
4795
+ /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(SkeletonBlock, { className: "h-5 w-[200px] rounded-agg-sm" }),
4796
+ /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { className: "flex w-full flex-col gap-4", children: [
4796
4797
  /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { className: "flex items-center gap-2", children: [
4797
4798
  /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(SkeletonBlock, { className: "size-4 rounded-agg-sm" }),
4798
4799
  /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(SkeletonBlock, { className: "h-5 w-[100px] rounded-agg-sm" })
@@ -6620,14 +6621,23 @@ var import_react8 = require("react");
6620
6621
  var import_react7 = require("react");
6621
6622
  var useHorizontalScrollState = () => {
6622
6623
  const containerRef = (0, import_react7.useRef)(null);
6624
+ const [hasOverflow, setHasOverflow] = (0, import_react7.useState)(false);
6625
+ const [isAtStart, setIsAtStart] = (0, import_react7.useState)(true);
6626
+ const [isAtEnd, setIsAtEnd] = (0, import_react7.useState)(true);
6623
6627
  const [canScrollLeft, setCanScrollLeft] = (0, import_react7.useState)(false);
6624
6628
  const [canScrollRight, setCanScrollRight] = (0, import_react7.useState)(false);
6625
6629
  const update = (0, import_react7.useCallback)(() => {
6626
6630
  const el = containerRef.current;
6627
6631
  if (!el) return;
6628
- const maxScroll = el.scrollWidth - el.clientWidth;
6629
- setCanScrollLeft(el.scrollLeft > 4);
6630
- setCanScrollRight(maxScroll - el.scrollLeft > 4);
6632
+ const epsilon = 2;
6633
+ const nextHasOverflow = el.scrollWidth > el.clientWidth + epsilon;
6634
+ const nextIsAtStart = el.scrollLeft <= epsilon;
6635
+ const nextIsAtEnd = el.scrollLeft + el.clientWidth >= el.scrollWidth - epsilon;
6636
+ setHasOverflow(nextHasOverflow);
6637
+ setIsAtStart(nextIsAtStart);
6638
+ setIsAtEnd(nextIsAtEnd);
6639
+ setCanScrollLeft(nextHasOverflow && !nextIsAtStart);
6640
+ setCanScrollRight(nextHasOverflow && !nextIsAtEnd);
6631
6641
  }, []);
6632
6642
  (0, import_react7.useEffect)(() => {
6633
6643
  const el = containerRef.current;
@@ -6643,7 +6653,15 @@ var useHorizontalScrollState = () => {
6643
6653
  ro.observe(el);
6644
6654
  return () => ro.disconnect();
6645
6655
  }, [update]);
6646
- return { containerRef, canScrollLeft, canScrollRight, update };
6656
+ return {
6657
+ containerRef,
6658
+ hasOverflow,
6659
+ isAtStart,
6660
+ isAtEnd,
6661
+ canScrollLeft,
6662
+ canScrollRight,
6663
+ update
6664
+ };
6647
6665
  };
6648
6666
 
6649
6667
  // src/primitives/tabs/tabs.constants.ts
@@ -6738,6 +6756,9 @@ var Tabs = ({
6738
6756
  });
6739
6757
  const {
6740
6758
  containerRef: tabListRef,
6759
+ hasOverflow,
6760
+ isAtStart,
6761
+ isAtEnd,
6741
6762
  canScrollLeft,
6742
6763
  canScrollRight,
6743
6764
  update: updateScrollState
@@ -6826,7 +6847,7 @@ var Tabs = ({
6826
6847
  "overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
6827
6848
  getMotionClassName(enableAnimations, "scroll-smooth")
6828
6849
  ) : "overflow-x-auto",
6829
- isBarVariant ? "items-start rounded-agg-lg border border-agg-separator p-1.5" : "h-15 border-b border-agg-separator -mb-[1px]",
6850
+ isBarVariant ? "items-start rounded-agg-lg border border-agg-separator p-1.5" : "h-14 md:h-15 border-b border-agg-separator -mb-[1px]",
6830
6851
  shouldUseOverflowScroll && "select-none",
6831
6852
  shouldUseOverflowScroll && !isBarVariant && "snap-x snap-mandatory",
6832
6853
  shouldUseOverflowScroll && (isDraggingTabs ? "cursor-grabbing" : "cursor-grab")
@@ -6984,7 +7005,10 @@ var Tabs = ({
6984
7005
  left: Math.max(0, nextScrollLeft),
6985
7006
  behavior: getScrollBehavior(enableAnimations)
6986
7007
  });
6987
- }, [enableAnimations, renderedItems, shouldUseOverflowScroll, value]);
7008
+ requestAnimationFrame(() => {
7009
+ updateScrollState();
7010
+ });
7011
+ }, [enableAnimations, renderedItems, shouldUseOverflowScroll, updateScrollState, value]);
6988
7012
  if (shouldUseOverflowSelect) {
6989
7013
  return /* @__PURE__ */ (0, import_jsx_runtime117.jsx)("div", { className: cn("group/agg-tabs w-full", className, classNames == null ? void 0 : classNames.root), children: /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(
6990
7014
  Select,
@@ -7023,6 +7047,13 @@ var Tabs = ({
7023
7047
  onPointerUp: handleEndTabListDrag,
7024
7048
  onWheel: handleTabListWheel,
7025
7049
  children: [
7050
+ shouldUseOverflowScroll && !isBarVariant && hasOverflow ? /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(
7051
+ "span",
7052
+ {
7053
+ "aria-hidden": true,
7054
+ className: "agg-tab-scroll-start-spacer h-full w-4 shrink-0 snap-start"
7055
+ }
7056
+ ) : null,
7026
7057
  renderedItems.map((item, index) => {
7027
7058
  var _a;
7028
7059
  const isActive = item.value === value;
@@ -7057,6 +7088,7 @@ var Tabs = ({
7057
7088
  isDisabled: !!item.disabled,
7058
7089
  size
7059
7090
  }),
7091
+ !isBarVariant && (size === "s" ? "px-3 md:px-4" : "h-14 px-3 md:h-15 md:px-4"),
7060
7092
  shouldUseOverflowScroll && !isBarVariant && "snap-start",
7061
7093
  classNames == null ? void 0 : classNames.tabTrigger
7062
7094
  ),
@@ -7106,9 +7138,9 @@ var Tabs = ({
7106
7138
  "aria-hidden": true,
7107
7139
  className: cn(
7108
7140
  "agg-tab-scroll-start",
7109
- "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",
7141
+ "pointer-events-none absolute inset-y-0 left-0 z-10 w-6 md:w-[60px] bg-linear-to-r from-agg-secondary to-transparent",
7110
7142
  getMotionClassName(enableAnimations, "transition-opacity duration-200"),
7111
- canScrollLeft ? "opacity-100" : "opacity-0"
7143
+ hasOverflow && canScrollLeft && !isAtStart ? "opacity-100" : "opacity-0"
7112
7144
  )
7113
7145
  }
7114
7146
  ),
@@ -7118,9 +7150,9 @@ var Tabs = ({
7118
7150
  "aria-hidden": true,
7119
7151
  className: cn(
7120
7152
  "agg-tab-scroll-end",
7121
- "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",
7153
+ "pointer-events-none absolute inset-y-0 right-0 z-10 w-6 md:w-[60px] bg-linear-to-l from-agg-secondary to-transparent",
7122
7154
  getMotionClassName(enableAnimations, "transition-opacity duration-200"),
7123
- canScrollRight ? "opacity-100" : "opacity-0"
7155
+ hasOverflow && canScrollRight && !isAtEnd ? "opacity-100" : "opacity-0"
7124
7156
  )
7125
7157
  }
7126
7158
  )
@@ -7523,8 +7555,85 @@ var EventListItemNotFoundState = ({
7523
7555
  );
7524
7556
  };
7525
7557
  var OUTCOMES_SCROLL_LOAD_THRESHOLD_PX = 16;
7558
+ var OUTCOMES_SCROLL_STATE_EPSILON_PX = 1;
7559
+ var OUTCOMES_SCROLL_MASK_HEIGHT_PX = 24;
7526
7560
  var MARKET_ID_QUERY_PARAM = "marketId";
7527
7561
  var OUTCOME_ID_QUERY_PARAM = "outcomeId";
7562
+ var OUTCOME_ROW_SELECTOR = ".agg-outcome-row";
7563
+ var DEFAULT_OUTCOMES_SCROLL_STATE = {
7564
+ hasOverflow: false,
7565
+ isAtTop: true,
7566
+ isAtBottom: true,
7567
+ remainingMarkets: 0
7568
+ };
7569
+ var areOutcomesScrollStatesEqual = (left, right) => {
7570
+ return left.hasOverflow === right.hasOverflow && left.isAtTop === right.isAtTop && left.isAtBottom === right.isAtBottom && left.remainingMarkets === right.remainingMarkets;
7571
+ };
7572
+ var useOutcomesScrollState = ({
7573
+ totalMarketCount,
7574
+ onReachScrollThreshold
7575
+ }) => {
7576
+ const containerRef = (0, import_react10.useRef)(null);
7577
+ const frameRef = (0, import_react10.useRef)(null);
7578
+ const scrollStateRef = (0, import_react10.useRef)(DEFAULT_OUTCOMES_SCROLL_STATE);
7579
+ const [scrollState, setScrollState] = (0, import_react10.useState)(
7580
+ DEFAULT_OUTCOMES_SCROLL_STATE
7581
+ );
7582
+ const measureScrollState = (0, import_react10.useCallback)(() => {
7583
+ frameRef.current = null;
7584
+ const element = containerRef.current;
7585
+ if (!element) return;
7586
+ const { clientHeight, scrollHeight, scrollTop } = element;
7587
+ const hasOverflow = scrollHeight > clientHeight + OUTCOMES_SCROLL_STATE_EPSILON_PX;
7588
+ const isAtTop = scrollTop <= OUTCOMES_SCROLL_STATE_EPSILON_PX;
7589
+ const isAtBottom = !hasOverflow || scrollTop + clientHeight >= scrollHeight - OUTCOMES_SCROLL_STATE_EPSILON_PX;
7590
+ const loadedRows = Array.from(element.querySelectorAll(OUTCOME_ROW_SELECTOR));
7591
+ const visibleMarketCount = loadedRows.reduce((count, row) => {
7592
+ return count + (row.offsetTop < clientHeight - OUTCOMES_SCROLL_STATE_EPSILON_PX ? 1 : 0);
7593
+ }, 0);
7594
+ const remainingMarkets = hasOverflow ? Math.max(0, totalMarketCount - visibleMarketCount) : 0;
7595
+ const nextScrollState = {
7596
+ hasOverflow,
7597
+ isAtTop,
7598
+ isAtBottom,
7599
+ remainingMarkets
7600
+ };
7601
+ if (!areOutcomesScrollStatesEqual(scrollStateRef.current, nextScrollState)) {
7602
+ scrollStateRef.current = nextScrollState;
7603
+ setScrollState(nextScrollState);
7604
+ }
7605
+ const distanceToBottom = scrollHeight - scrollTop - clientHeight;
7606
+ if (distanceToBottom <= OUTCOMES_SCROLL_LOAD_THRESHOLD_PX) {
7607
+ onReachScrollThreshold == null ? void 0 : onReachScrollThreshold();
7608
+ }
7609
+ }, [onReachScrollThreshold, totalMarketCount]);
7610
+ const updateScrollState = (0, import_react10.useCallback)(() => {
7611
+ if (frameRef.current != null) return;
7612
+ frameRef.current = window.requestAnimationFrame(measureScrollState);
7613
+ }, [measureScrollState]);
7614
+ (0, import_react10.useEffect)(() => {
7615
+ const element = containerRef.current;
7616
+ if (!element) return;
7617
+ element.addEventListener("scroll", updateScrollState, { passive: true });
7618
+ let resizeObserver = null;
7619
+ if (typeof ResizeObserver !== "undefined") {
7620
+ resizeObserver = new ResizeObserver(() => {
7621
+ updateScrollState();
7622
+ });
7623
+ resizeObserver.observe(element);
7624
+ }
7625
+ updateScrollState();
7626
+ return () => {
7627
+ element.removeEventListener("scroll", updateScrollState);
7628
+ resizeObserver == null ? void 0 : resizeObserver.disconnect();
7629
+ if (frameRef.current != null) {
7630
+ window.cancelAnimationFrame(frameRef.current);
7631
+ frameRef.current = null;
7632
+ }
7633
+ };
7634
+ }, [updateScrollState]);
7635
+ return { containerRef, scrollState, updateScrollState };
7636
+ };
7528
7637
  var buildOutcomeMidpointsByOutcomeId = (midpointRows) => {
7529
7638
  const outcomeMidpointsByOutcomeId = /* @__PURE__ */ new Map();
7530
7639
  const addOutcomeMidpoints = (value) => {
@@ -7691,6 +7800,31 @@ var EventListItemContent = ({
7691
7800
  const matchedCountLabel = labels.eventItem.matchedCount(
7692
7801
  Math.max(resolvedVenueCount, visibleFooterVenues.length)
7693
7802
  );
7803
+ const handleOutcomesScrollThreshold = (0, import_react10.useCallback)(() => {
7804
+ if (!shouldEnableLazyMarketLoading) return;
7805
+ if (!isLazyMarketsQueryEnabled) {
7806
+ setIsLazyMarketsQueryEnabled(true);
7807
+ return;
7808
+ }
7809
+ if (!hasNextLazyMarketsPage) return;
7810
+ if (isLoadingLazyMarkets || isFetchingNextLazyMarketsPage) return;
7811
+ void fetchNextLazyMarketsPage();
7812
+ }, [
7813
+ fetchNextLazyMarketsPage,
7814
+ hasNextLazyMarketsPage,
7815
+ isFetchingNextLazyMarketsPage,
7816
+ isLazyMarketsQueryEnabled,
7817
+ isLoadingLazyMarkets,
7818
+ shouldEnableLazyMarketLoading
7819
+ ]);
7820
+ const {
7821
+ containerRef: outcomesContainerRef,
7822
+ scrollState: outcomesScrollState,
7823
+ updateScrollState
7824
+ } = useOutcomesScrollState({
7825
+ totalMarketCount: resolvedMarketCount,
7826
+ onReachScrollThreshold: handleOutcomesScrollThreshold
7827
+ });
7694
7828
  const shouldUseNativeLinkNavigation = (eventToHandle) => {
7695
7829
  return eventToHandle.metaKey || eventToHandle.ctrlKey || eventToHandle.shiftKey || eventToHandle.altKey || eventToHandle.button === 1;
7696
7830
  };
@@ -7742,29 +7876,9 @@ var EventListItemContent = ({
7742
7876
  onEventClick == null ? void 0 : onEventClick(event);
7743
7877
  }
7744
7878
  };
7745
- const handleOutcomesScroll = (0, import_react10.useCallback)(
7746
- (eventToHandle) => {
7747
- if (!shouldEnableLazyMarketLoading) return;
7748
- const element = eventToHandle.currentTarget;
7749
- const distanceToBottom = element.scrollHeight - element.scrollTop - element.clientHeight;
7750
- if (distanceToBottom > OUTCOMES_SCROLL_LOAD_THRESHOLD_PX) return;
7751
- if (!isLazyMarketsQueryEnabled) {
7752
- setIsLazyMarketsQueryEnabled(true);
7753
- return;
7754
- }
7755
- if (!hasNextLazyMarketsPage) return;
7756
- if (isLoadingLazyMarkets || isFetchingNextLazyMarketsPage) return;
7757
- void fetchNextLazyMarketsPage();
7758
- },
7759
- [
7760
- fetchNextLazyMarketsPage,
7761
- hasNextLazyMarketsPage,
7762
- isFetchingNextLazyMarketsPage,
7763
- isLazyMarketsQueryEnabled,
7764
- isLoadingLazyMarkets,
7765
- shouldEnableLazyMarketLoading
7766
- ]
7767
- );
7879
+ (0, import_react10.useEffect)(() => {
7880
+ updateScrollState();
7881
+ }, [comparison.rows.length, shouldRenderLoadingOutcomeRow, updateScrollState]);
7768
7882
  const renderArbitrage = (value) => {
7769
7883
  if (value == null) return null;
7770
7884
  if (Math.abs(value) < config.market.arbitrageThreshold) return null;
@@ -7949,69 +8063,94 @@ var EventListItemContent = ({
7949
8063
  ) }) : null
7950
8064
  ] }) })
7951
8065
  ] }),
7952
- /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)(
7953
- "div",
7954
- {
7955
- className: cn(
7956
- "agg-outcomes flex max-h-[76px] flex-col gap-4 overflow-y-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
7957
- classNames == null ? void 0 : classNames.outcomes
7958
- ),
7959
- onScroll: handleOutcomesScroll,
7960
- children: [
7961
- comparison.rows.map((row) => {
7962
- var _a2;
7963
- const arbitragePercent = (_a2 = arbitrageByOutcomeId == null ? void 0 : arbitrageByOutcomeId[row.outcome.id]) != null ? _a2 : arbitrageByOutcomeId == null ? void 0 : arbitrageByOutcomeId[row.market.id];
7964
- const arbReturn = arbReturnByVenueMarketId.get(row.market.id);
7965
- const priceGapPercent = arbReturn == null ? gapsByVenueMarketId.get(row.market.id) : arbReturn;
7966
- const priceGapSource = arbReturn == null ? "percent" : "fraction";
7967
- return /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)(
7968
- "div",
7969
- {
7970
- className: cn(
7971
- "agg-outcome-row",
7972
- "flex h-10 w-full flex-row items-center justify-between gap-3",
7973
- classNames == null ? void 0 : classNames.outcomeRow
7974
- ),
7975
- children: [
7976
- /* @__PURE__ */ (0, import_jsx_runtime119.jsx)("div", { className: "agg-outcome-label-row flex min-w-0 flex-1 flex-row items-center justify-start gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
7977
- Typography,
7978
- {
7979
- variant: "body",
7980
- className: "agg-outcome-label min-w-0 truncate text-agg-xs leading-agg-5 md:text-agg-base md:leading-agg-6",
7981
- children: row.label
7982
- }
7983
- ) }),
7984
- /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)("div", { className: "agg-outcome-meta flex shrink-0 flex-row items-center justify-end gap-2", children: [
7985
- renderArbitrage(arbitragePercent),
7986
- renderPriceGapPill(priceGapPercent, priceGapSource),
7987
- /* @__PURE__ */ (0, import_jsx_runtime119.jsx)("div", { className: "agg-outcome-price-strip relative flex shrink-0 items-center justify-end", children: isAwaitingMidpoints ? renderPriceStripSkeleton(row.prices.length) : row.prices.map(
7988
- (price, priceIndex) => renderComparisonPriceBadge(row, price, priceIndex)
7989
- ) })
7990
- ] })
7991
- ]
7992
- },
7993
- row.id
7994
- );
7995
- }),
7996
- shouldRenderLoadingOutcomeRow ? /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)("div", { className: "agg-outcome-row-loading flex w-full items-center justify-between gap-3", children: [
7997
- /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
7998
- "div",
7999
- {
8000
- "aria-hidden": "true",
8001
- className: "bg-agg-separator animate-pulse h-5 rounded-agg-sm w-[200px]"
8002
- }
8003
- ),
8004
- /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
8005
- "div",
8006
- {
8007
- "aria-hidden": "true",
8008
- className: "bg-agg-separator animate-pulse h-9 w-[100px] rounded-agg-full"
8009
- }
8010
- )
8011
- ] }) : null
8012
- ]
8013
- }
8014
- ),
8066
+ /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)("div", { className: "relative w-full", children: [
8067
+ /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)(
8068
+ "div",
8069
+ {
8070
+ ref: outcomesContainerRef,
8071
+ className: cn(
8072
+ "agg-outcomes flex max-h-[76px] flex-col gap-4 overflow-y-auto rounded-agg-md [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
8073
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-2 focus-visible:ring-offset-agg-secondary",
8074
+ classNames == null ? void 0 : classNames.outcomes
8075
+ ),
8076
+ "aria-label": labels.marketDetails.marketOutcomesAria,
8077
+ tabIndex: 0,
8078
+ children: [
8079
+ comparison.rows.map((row) => {
8080
+ var _a2;
8081
+ const arbitragePercent = (_a2 = arbitrageByOutcomeId == null ? void 0 : arbitrageByOutcomeId[row.outcome.id]) != null ? _a2 : arbitrageByOutcomeId == null ? void 0 : arbitrageByOutcomeId[row.market.id];
8082
+ const arbReturn = arbReturnByVenueMarketId.get(row.market.id);
8083
+ const priceGapPercent = arbReturn == null ? gapsByVenueMarketId.get(row.market.id) : arbReturn;
8084
+ const priceGapSource = arbReturn == null ? "percent" : "fraction";
8085
+ return /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)(
8086
+ "div",
8087
+ {
8088
+ className: cn(
8089
+ "agg-outcome-row",
8090
+ "flex h-10 w-full flex-row items-center justify-between gap-3",
8091
+ classNames == null ? void 0 : classNames.outcomeRow
8092
+ ),
8093
+ children: [
8094
+ /* @__PURE__ */ (0, import_jsx_runtime119.jsx)("div", { className: "agg-outcome-label-row flex min-w-0 flex-1 flex-row items-center justify-start gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
8095
+ Typography,
8096
+ {
8097
+ variant: "body",
8098
+ className: "agg-outcome-label min-w-0 truncate text-agg-xs leading-agg-5 md:text-agg-base md:leading-agg-6",
8099
+ children: row.label
8100
+ }
8101
+ ) }),
8102
+ /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)("div", { className: "agg-outcome-meta flex shrink-0 flex-row items-center justify-end gap-2", children: [
8103
+ renderArbitrage(arbitragePercent),
8104
+ renderPriceGapPill(priceGapPercent, priceGapSource),
8105
+ /* @__PURE__ */ (0, import_jsx_runtime119.jsx)("div", { className: "agg-outcome-price-strip relative flex shrink-0 items-center justify-end", children: isAwaitingMidpoints ? renderPriceStripSkeleton(row.prices.length) : row.prices.map(
8106
+ (price, priceIndex) => renderComparisonPriceBadge(row, price, priceIndex)
8107
+ ) })
8108
+ ] })
8109
+ ]
8110
+ },
8111
+ row.id
8112
+ );
8113
+ }),
8114
+ shouldRenderLoadingOutcomeRow ? /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)("div", { className: "agg-outcome-row-loading flex w-full items-center justify-between gap-3", children: [
8115
+ /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
8116
+ "div",
8117
+ {
8118
+ "aria-hidden": "true",
8119
+ className: "bg-agg-separator animate-pulse h-5 rounded-agg-sm w-[200px]"
8120
+ }
8121
+ ),
8122
+ /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
8123
+ "div",
8124
+ {
8125
+ "aria-hidden": "true",
8126
+ className: "bg-agg-separator animate-pulse h-9 w-[100px] rounded-agg-full"
8127
+ }
8128
+ )
8129
+ ] }) : null
8130
+ ]
8131
+ }
8132
+ ),
8133
+ /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
8134
+ "div",
8135
+ {
8136
+ className: cn(
8137
+ "agg-outcomes-scroll-gradient-top pointer-events-none absolute inset-x-0 top-0 z-10 bg-gradient-to-b from-agg-secondary to-transparent transition-opacity duration-150",
8138
+ outcomesScrollState.hasOverflow && !outcomesScrollState.isAtTop ? "opacity-100" : "opacity-0"
8139
+ ),
8140
+ style: { height: OUTCOMES_SCROLL_MASK_HEIGHT_PX }
8141
+ }
8142
+ ),
8143
+ /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
8144
+ "div",
8145
+ {
8146
+ className: cn(
8147
+ "agg-outcomes-scroll-gradient-bottom pointer-events-none absolute inset-x-0 bottom-0 z-10 bg-gradient-to-t from-agg-secondary to-transparent transition-opacity duration-150",
8148
+ outcomesScrollState.hasOverflow && !outcomesScrollState.isAtBottom ? "opacity-100" : "opacity-0"
8149
+ ),
8150
+ style: { height: OUTCOMES_SCROLL_MASK_HEIGHT_PX }
8151
+ }
8152
+ )
8153
+ ] }),
8015
8154
  /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)(
8016
8155
  "div",
8017
8156
  {
@@ -8029,6 +8168,14 @@ var EventListItemContent = ({
8029
8168
  "agg-event-meta flex min-w-0 flex-1 items-center gap-2 text-agg-sm leading-agg-5 truncate"
8030
8169
  ),
8031
8170
  children: [
8171
+ outcomesScrollState.remainingMarkets > 0 ? /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
8172
+ Typography,
8173
+ {
8174
+ variant: "body",
8175
+ className: "agg-event-remaining-markets shrink-0 text-agg-sm leading-agg-5 text-agg-muted-foreground",
8176
+ children: labels.eventItem.remainingMarkets(outcomesScrollState.remainingMarkets)
8177
+ }
8178
+ ) : null,
8032
8179
  shouldShowMatchedVenueSummary ? /* @__PURE__ */ (0, import_jsx_runtime119.jsx)("span", { className: "agg-event-matched-badge rounded-agg-full bg-agg-primary/10 px-2 py-[3px] text-agg-2xs font-agg-bold uppercase leading-agg-14 text-agg-primary", children: matchedCountLabel }) : null,
8033
8180
  singleFooterVenue ? /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)("span", { className: "agg-event-single-venue flex min-w-0 items-center gap-1 overflow-hidden", children: [
8034
8181
  /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
@@ -10046,13 +10193,6 @@ var parseSettlementBlocks = (input) => {
10046
10193
  }
10047
10194
  return blocks;
10048
10195
  };
10049
- var getFirstSettlementParagraph = (input) => {
10050
- if (!input) return "";
10051
- const blocks = parseSettlementBlocks(input);
10052
- const firstParagraph = blocks.find((block) => block.kind === "paragraph");
10053
- if (!firstParagraph || firstParagraph.kind !== "paragraph") return "";
10054
- return firstParagraph.lines.join(" ").trim();
10055
- };
10056
10196
  var normalizeSettlementForCompare = (input) => {
10057
10197
  return stripHtmlFragments(input).replace(/\s+/g, " ").trim().toLowerCase();
10058
10198
  };
@@ -10221,8 +10361,204 @@ SettlementTextRenderer.displayName = "SettlementTextRenderer";
10221
10361
  // src/trading/settlement/index.tsx
10222
10362
  var import_jsx_runtime123 = require("react/jsx-runtime");
10223
10363
  var SETTLEMENT_SECTION_ID = "agg-settlement-section";
10224
- var getSettlementHeaderClassName = () => {
10225
- return "flex items-center justify-between gap-4";
10364
+ var getSettlementDifferenceId = (sectionId, canonicalKey) => {
10365
+ return `${sectionId}-difference-${canonicalKey}`;
10366
+ };
10367
+ var dateOnlyRegex = /^(\d{4})-(\d{2})-(\d{2})$/;
10368
+ var isoTimestampWithTimezoneRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(?::\d{2}(?:\.\d{1,9})?)?(?:Z|[+-]\d{2}:?\d{2})$/i;
10369
+ var normalizeDifferenceText = (value) => {
10370
+ return value.trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
10371
+ };
10372
+ var resolveCanonicalDifferenceKey = (difference) => {
10373
+ const normalizedType = normalizeDifferenceText(difference.type);
10374
+ const combined = normalizeDifferenceText(`${difference.type} ${difference.title}`);
10375
+ if (combined.includes("start_date") || combined.includes("open_date")) return "start_date";
10376
+ if (combined.includes("end_date") || combined.includes("close_date") || combined.includes("closing_date") || combined.includes("expiration_date") || combined.includes("expiry_date")) {
10377
+ return "end_date";
10378
+ }
10379
+ if (combined.includes("resolution_timing") || combined.includes("resolution_date") || combined.includes("resolution_deadline") || combined.includes("settlement_date") || combined.includes("settlement_deadline") || combined.includes("settlement_timing")) {
10380
+ return "resolution_timing";
10381
+ }
10382
+ return normalizedType || "other";
10383
+ };
10384
+ var parseSettlementDateMs = (value) => {
10385
+ const trimmed = value.trim();
10386
+ const dateOnlyMatch = dateOnlyRegex.exec(trimmed);
10387
+ if (dateOnlyMatch) {
10388
+ const [, year, month, day] = dateOnlyMatch;
10389
+ return Date.UTC(Number(year), Number(month) - 1, Number(day));
10390
+ }
10391
+ if (!isoTimestampWithTimezoneRegex.test(trimmed)) return null;
10392
+ const ms = Date.parse(trimmed);
10393
+ return Number.isNaN(ms) ? null : ms;
10394
+ };
10395
+ var isDateLikeDifference = (canonicalKey) => {
10396
+ return canonicalKey === "resolution_timing" || canonicalKey === "start_date" || canonicalKey === "end_date";
10397
+ };
10398
+ var hasEqualNormalizedDateValues = (difference, canonicalKey) => {
10399
+ if (!isDateLikeDifference(canonicalKey)) return false;
10400
+ const values = Object.values(difference.perVenue);
10401
+ if (values.length < 2) return false;
10402
+ const timestamps = values.map(parseSettlementDateMs);
10403
+ if (timestamps.some((timestamp) => timestamp === null)) return false;
10404
+ return new Set(timestamps).size === 1;
10405
+ };
10406
+ var resolveDifferenceSeverity = (difference, canonicalKey) => {
10407
+ var _a;
10408
+ const combined = normalizeDifferenceText(
10409
+ `${difference.type} ${difference.title} ${(_a = difference.summary) != null ? _a : ""}`
10410
+ );
10411
+ if (isDateLikeDifference(canonicalKey)) return "critical";
10412
+ if (canonicalKey === "scope" || canonicalKey === "threshold" || canonicalKey === "edge_cases") {
10413
+ return "critical";
10414
+ }
10415
+ if (combined.includes("conflict") || combined.includes("void") || combined.includes("cancel") || combined.includes("postpone") || combined.includes("recount") || combined.includes("overtime") || combined.includes("extra_time")) {
10416
+ return "critical";
10417
+ }
10418
+ return "informational";
10419
+ };
10420
+ var mergePerVenueValues = (current, next) => {
10421
+ return Object.entries(next).reduce(
10422
+ (merged, [venue, value]) => {
10423
+ if (merged[venue] === void 0) merged[venue] = value;
10424
+ return merged;
10425
+ },
10426
+ __spreadValues({}, current)
10427
+ );
10428
+ };
10429
+ var prepareSettlementDifferences = (differences) => {
10430
+ const byCanonicalKey = /* @__PURE__ */ new Map();
10431
+ for (const [originalIndex, rawDifference] of (differences != null ? differences : []).entries()) {
10432
+ const title2 = rawDifference.title.trim();
10433
+ const perVenue = Object.fromEntries(
10434
+ Object.entries(rawDifference.perVenue).map(([venue, value]) => [venue.trim(), value.trim()]).filter(([venue, value]) => venue.length > 0 && value.length > 0)
10435
+ );
10436
+ if (!title2 || Object.keys(perVenue).length === 0) continue;
10437
+ const difference = __spreadProps(__spreadValues({}, rawDifference), { title: title2, perVenue });
10438
+ const canonicalKey = resolveCanonicalDifferenceKey(difference);
10439
+ if (hasEqualNormalizedDateValues(difference, canonicalKey)) continue;
10440
+ const existing = byCanonicalKey.get(canonicalKey);
10441
+ if (existing) {
10442
+ byCanonicalKey.set(canonicalKey, __spreadProps(__spreadValues({}, existing), {
10443
+ perVenue: mergePerVenueValues(existing.perVenue, difference.perVenue)
10444
+ }));
10445
+ continue;
10446
+ }
10447
+ byCanonicalKey.set(canonicalKey, __spreadProps(__spreadValues({}, difference), {
10448
+ canonicalKey,
10449
+ severity: resolveDifferenceSeverity(difference, canonicalKey),
10450
+ originalIndex
10451
+ }));
10452
+ }
10453
+ return Array.from(byCanonicalKey.values()).sort((left, right) => {
10454
+ const severityDelta = Number(right.severity === "critical") - Number(left.severity === "critical");
10455
+ if (severityDelta !== 0) return severityDelta;
10456
+ return left.originalIndex - right.originalIndex;
10457
+ });
10458
+ };
10459
+ var formatVenueFallbackLabel = (venue) => {
10460
+ return venue.split(/[-_\s]+/).filter(Boolean).map((part) => `${part.slice(0, 1).toUpperCase()}${part.slice(1)}`).join(" ");
10461
+ };
10462
+ var resolveSettlementVenueLabel = (venue, labels) => {
10463
+ var _a;
10464
+ return (_a = labels.venues[venue]) != null ? _a : formatVenueFallbackLabel(venue);
10465
+ };
10466
+ var resolveDifferenceVenueKeys = (difference, settlementVenues) => {
10467
+ const explicitVenues = Object.keys(difference.perVenue);
10468
+ if (!isDateLikeDifference(difference.canonicalKey)) return explicitVenues;
10469
+ const allVenues = [...settlementVenues != null ? settlementVenues : [], ...explicitVenues];
10470
+ return Array.from(new Set(allVenues.filter((venue) => venue.trim().length > 0)));
10471
+ };
10472
+ var resolveDifferenceIconClassName = (canonicalKey) => {
10473
+ if (canonicalKey.includes("source") || canonicalKey.includes("url")) return "fi-rr-world";
10474
+ if (canonicalKey === "resolution_timing" || canonicalKey.includes("timing")) {
10475
+ return "fi-rr-clock";
10476
+ }
10477
+ if (canonicalKey === "start_date" || canonicalKey.includes("start"))
10478
+ return "fi-rr-calendar-clock";
10479
+ if (canonicalKey === "end_date" || canonicalKey.includes("end")) return "fi-rr-calendar-clock";
10480
+ if (canonicalKey.includes("cancel") || canonicalKey.includes("void") || canonicalKey.includes("postpone")) {
10481
+ return "fi-rr-ban";
10482
+ }
10483
+ if (canonicalKey === "edge_cases" || canonicalKey.includes("edge")) {
10484
+ return "fi-rr-triangle-warning";
10485
+ }
10486
+ if (canonicalKey === "scope") return "fi-rr-layers";
10487
+ if (canonicalKey === "threshold") return "fi-rr-tachometer-alt-fastest";
10488
+ if (canonicalKey.includes("wording")) return "fi-rr-document";
10489
+ return "fi-rr-info";
10490
+ };
10491
+ var buildSettlementVenueRules = ({
10492
+ marketBlock,
10493
+ primaryRulesBlock,
10494
+ settlementVenues,
10495
+ settlementVenueRules
10496
+ }) => {
10497
+ var _a, _b;
10498
+ if (settlementVenueRules) {
10499
+ const rulesByVenue = /* @__PURE__ */ new Map();
10500
+ for (const rule of settlementVenueRules) {
10501
+ const venue2 = rule.venue.trim();
10502
+ const content2 = rule.content.trim();
10503
+ if (!venue2 || !content2) continue;
10504
+ const venueRules = (_a = rulesByVenue.get(venue2)) != null ? _a : [];
10505
+ if (!venueRules.includes(content2)) venueRules.push(content2);
10506
+ rulesByVenue.set(venue2, venueRules);
10507
+ }
10508
+ return Array.from(rulesByVenue, ([venue2, contents]) => ({
10509
+ venue: venue2,
10510
+ content: contents.join("\n\n")
10511
+ }));
10512
+ }
10513
+ const content = [marketBlock == null ? void 0 : marketBlock.content, primaryRulesBlock == null ? void 0 : primaryRulesBlock.content].filter((value) => typeof value === "string" && value.trim().length > 0).join("\n\n");
10514
+ const venue = (_b = settlementVenues == null ? void 0 : settlementVenues.find((candidate) => candidate.trim().length > 0)) == null ? void 0 : _b.trim();
10515
+ return content && venue ? [{ venue, content }] : [];
10516
+ };
10517
+ var isDuplicatedByVenueRules = (content, venueRules) => {
10518
+ const normalizedContent = normalizeSettlementForCompare(content);
10519
+ if (!normalizedContent) return false;
10520
+ return venueRules.some((rule) => {
10521
+ const normalizedRule = normalizeSettlementForCompare(rule.content);
10522
+ return normalizedRule.includes(normalizedContent);
10523
+ });
10524
+ };
10525
+ var SettlementVenueRules = ({
10526
+ rules,
10527
+ labels
10528
+ }) => {
10529
+ return /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "agg-settlement-venue-rules flex w-full flex-col items-start gap-4", children: [
10530
+ /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: labels.trading.settlementFullRulesTitle }),
10531
+ /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("div", { className: "flex w-full flex-col items-start gap-4", children: rules.map((rule) => {
10532
+ const venueLabel = resolveSettlementVenueLabel(rule.venue, labels);
10533
+ return /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("details", { className: "group/agg-settlement-rule w-full", children: [
10534
+ /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("summary", { className: "flex cursor-pointer list-none items-center gap-2 text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground group-hover/agg-settlement-rule:text-agg-muted-foreground transition-colors marker:hidden", children: [
10535
+ /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
10536
+ VenueLogo,
10537
+ {
10538
+ venue: rule.venue,
10539
+ size: "small",
10540
+ className: "size-4",
10541
+ ariaLabel: venueLabel
10542
+ }
10543
+ ),
10544
+ /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("span", { className: "text-agg-foreground group-hover/agg-settlement-rule:text-agg-muted-foreground transition-colors", children: venueLabel }),
10545
+ /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
10546
+ "i",
10547
+ {
10548
+ className: cn(
10549
+ "fi fi-rr-angle-small-down text-[14px]!",
10550
+ "group-open/agg-settlement-rule:rotate-180",
10551
+ "size-3.5! shrink-0 text-agg-foreground group-hover/agg-settlement-rule:text-agg-muted-foreground transition-[colors,transform]"
10552
+ ),
10553
+ style: { fontSize: 14 },
10554
+ "aria-hidden": "true"
10555
+ }
10556
+ )
10557
+ ] }),
10558
+ /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("div", { className: "mt-3 pl-6", children: /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(SettlementTextRenderer, { content: rule.content }) })
10559
+ ] }, rule.venue);
10560
+ }) })
10561
+ ] });
10226
10562
  };
10227
10563
  var Settlement = ({
10228
10564
  className,
@@ -10232,9 +10568,12 @@ var Settlement = ({
10232
10568
  eventDescription,
10233
10569
  marketDescription,
10234
10570
  primaryRules,
10571
+ settlementDiff,
10572
+ settlementVenues,
10573
+ settlementVenueRules,
10235
10574
  isLoading = false
10236
10575
  }) => {
10237
- var _a, _b, _c;
10576
+ var _a, _b, _c, _d, _e;
10238
10577
  const labels = (0, import_hooks38.useLabels)();
10239
10578
  const blocks = (0, import_react14.useMemo)(
10240
10579
  () => dedupeSettlementSources({
@@ -10244,9 +10583,41 @@ var Settlement = ({
10244
10583
  }),
10245
10584
  [eventDescription, marketDescription, primaryRules]
10246
10585
  );
10586
+ const settlementDifferences = (0, import_react14.useMemo)(
10587
+ () => prepareSettlementDifferences(settlementDiff == null ? void 0 : settlementDiff.differences),
10588
+ [settlementDiff == null ? void 0 : settlementDiff.differences]
10589
+ );
10247
10590
  const eventBlock = (_a = blocks.find((block) => block.key === "eventDescription")) != null ? _a : null;
10248
10591
  const marketBlock = (_b = blocks.find((block) => block.key === "marketDescription")) != null ? _b : null;
10249
10592
  const primaryRulesBlock = (_c = blocks.find((block) => block.key === "primaryRules")) != null ? _c : null;
10593
+ const venueRuleBlocks = (0, import_react14.useMemo)(
10594
+ () => buildSettlementVenueRules({
10595
+ marketBlock,
10596
+ primaryRulesBlock,
10597
+ settlementVenues,
10598
+ settlementVenueRules
10599
+ }),
10600
+ [marketBlock, primaryRulesBlock, settlementVenues, settlementVenueRules]
10601
+ );
10602
+ const hasSettlementDifferences = settlementDifferences.length > 0;
10603
+ const hasVenueSettlementRules = venueRuleBlocks.length > 0;
10604
+ const standaloneEventBlock = eventBlock && !isDuplicatedByVenueRules(eventBlock.content, venueRuleBlocks) ? eventBlock : null;
10605
+ const standaloneMarketBlock = hasVenueSettlementRules ? null : marketBlock;
10606
+ const standalonePrimaryRulesBlock = hasVenueSettlementRules ? null : primaryRulesBlock;
10607
+ const hasStandaloneSettlementText = hasVenueSettlementRules ? standaloneEventBlock !== null : blocks.length > 0;
10608
+ const hasSettlementContent = hasSettlementDifferences || hasVenueSettlementRules || hasStandaloneSettlementText;
10609
+ const defaultOpenDifferenceKey = (_e = (_d = settlementDifferences[0]) == null ? void 0 : _d.canonicalKey) != null ? _e : null;
10610
+ const [openDifferenceKeys, setOpenDifferenceKeys] = (0, import_react14.useState)(
10611
+ () => defaultOpenDifferenceKey ? [defaultOpenDifferenceKey] : []
10612
+ );
10613
+ (0, import_react14.useEffect)(() => {
10614
+ setOpenDifferenceKeys(defaultOpenDifferenceKey ? [defaultOpenDifferenceKey] : []);
10615
+ }, [defaultOpenDifferenceKey]);
10616
+ const handleToggleDifference = (canonicalKey) => {
10617
+ setOpenDifferenceKeys(
10618
+ (currentKeys) => currentKeys.includes(canonicalKey) ? currentKeys.filter((currentKey) => currentKey !== canonicalKey) : [...currentKeys, canonicalKey]
10619
+ );
10620
+ };
10250
10621
  if (isLoading) {
10251
10622
  return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
10252
10623
  Skeleton,
@@ -10257,6 +10628,7 @@ var Settlement = ({
10257
10628
  }
10258
10629
  );
10259
10630
  }
10631
+ if (!hasSettlementContent) return null;
10260
10632
  const resolvedSectionLabel = sectionLabel === defaultSettlementSectionLabel ? labels.trading.settlementSection : sectionLabel;
10261
10633
  return /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(
10262
10634
  Card,
@@ -10264,38 +10636,117 @@ var Settlement = ({
10264
10636
  id,
10265
10637
  className: cn(
10266
10638
  "group/agg-settlement-card",
10267
- "flex flex-col w-full gap-5 rounded-agg-xl border border-agg-separator bg-agg-secondary p-5 shadow-none hover:shadow-none",
10639
+ "flex w-full flex-col items-start gap-4 rounded-agg-xl border border-agg-separator bg-agg-secondary p-5 shadow-none hover:shadow-none sm:gap-5",
10268
10640
  className
10269
10641
  ),
10270
10642
  children: [
10271
- /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: cn("agg-settlement-header", getSettlementHeaderClassName()), children: [
10272
- /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("p", { className: "text-agg-xs font-agg-bold leading-agg-4 uppercase text-agg-muted-foreground", children: resolvedSectionLabel }),
10273
- question ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("p", { className: "agg-settlement-question text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: question }) : null
10643
+ /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "agg-settlement-header flex w-full flex-col items-start gap-1 text-agg-muted-foreground sm:flex-row sm:items-center sm:justify-between sm:gap-4", children: [
10644
+ /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("p", { className: "shrink-0 text-agg-xs font-agg-bold leading-agg-4 uppercase", children: resolvedSectionLabel }),
10645
+ question ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("p", { className: "agg-settlement-question min-w-0 text-agg-sm font-agg-normal leading-agg-5 sm:max-w-[314px] sm:truncate", children: question }) : null
10274
10646
  ] }),
10275
- blocks.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("p", { className: "agg-settlement-empty text-agg-sm leading-agg-5 text-agg-muted-foreground", children: labels.trading.settlementEmpty }) : /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "agg-settlement-sections flex flex-col gap-4", children: [
10276
- eventBlock || marketBlock ? /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(
10277
- "div",
10278
- {
10279
- className: "agg-settlement-section agg-settlement-section-description",
10280
- "data-source": "description",
10281
- children: [
10282
- eventBlock ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("div", { "data-source": "eventDescription", children: /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(SettlementTextRenderer, { content: eventBlock.content }) }) : null,
10283
- eventBlock && marketBlock ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("hr", { className: "agg-settlement-divider my-4 border-0 border-t border-agg-separator" }) : null,
10284
- marketBlock ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("div", { "data-source": "marketDescription", children: /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(SettlementTextRenderer, { content: marketBlock.content }) }) : null
10285
- ]
10286
- }
10287
- ) : null,
10288
- primaryRulesBlock ? /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(
10289
- "div",
10290
- {
10291
- className: "agg-settlement-section agg-settlement-section-primaryRules",
10292
- "data-source": "primaryRules",
10293
- children: [
10294
- /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("p", { className: "agg-settlement-section-label text-agg-xs font-agg-bold leading-agg-4 uppercase text-agg-muted-foreground mb-2", children: labels.trading.settlementPrimaryRulesLabel }),
10295
- /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(SettlementTextRenderer, { content: primaryRulesBlock.content })
10296
- ]
10297
- }
10298
- ) : null
10647
+ /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "agg-settlement-sections flex w-full flex-col items-start gap-5", children: [
10648
+ hasStandaloneSettlementText ? /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "w-full", children: [
10649
+ standaloneEventBlock || standaloneMarketBlock ? /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(
10650
+ "div",
10651
+ {
10652
+ className: "agg-settlement-section agg-settlement-section-description",
10653
+ "data-source": "description",
10654
+ children: [
10655
+ standaloneEventBlock ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("div", { "data-source": "eventDescription", children: /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(SettlementTextRenderer, { content: standaloneEventBlock.content }) }) : null,
10656
+ standaloneEventBlock && standaloneMarketBlock ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("hr", { className: "agg-settlement-divider my-4 border-0 border-t border-agg-separator" }) : null,
10657
+ standaloneMarketBlock ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("div", { "data-source": "marketDescription", children: /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(SettlementTextRenderer, { content: standaloneMarketBlock.content }) }) : null
10658
+ ]
10659
+ }
10660
+ ) : null,
10661
+ standalonePrimaryRulesBlock ? /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(
10662
+ "div",
10663
+ {
10664
+ className: "agg-settlement-section agg-settlement-section-primaryRules",
10665
+ "data-source": "primaryRules",
10666
+ children: [
10667
+ /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("p", { className: "agg-settlement-section-label text-agg-xs font-agg-bold leading-agg-4 uppercase text-agg-muted-foreground mb-2", children: labels.trading.settlementPrimaryRulesLabel }),
10668
+ /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(SettlementTextRenderer, { content: standalonePrimaryRulesBlock.content })
10669
+ ]
10670
+ }
10671
+ ) : null
10672
+ ] }) : null,
10673
+ hasSettlementDifferences ? /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "agg-settlement-differences flex w-full flex-col items-start gap-5", children: [
10674
+ /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "flex items-center gap-2", children: [
10675
+ /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: labels.trading.settlementDifferencesTitle }),
10676
+ /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("span", { className: "flex size-4 shrink-0 items-center justify-center rounded-agg-full bg-agg-primary text-[10px] font-agg-bold leading-[14px] text-agg-on-primary", children: settlementDifferences.length })
10677
+ ] }),
10678
+ /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("div", { className: "flex w-full flex-col items-start gap-5", children: settlementDifferences.map((difference) => {
10679
+ const venueKeys = resolveDifferenceVenueKeys(difference, settlementVenues);
10680
+ const isExpanded = openDifferenceKeys.includes(difference.canonicalKey) && venueKeys.length > 0;
10681
+ return /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(
10682
+ "div",
10683
+ {
10684
+ id: getSettlementDifferenceId(id, difference.canonicalKey),
10685
+ className: "agg-settlement-difference flex w-full flex-col items-start gap-2 rounded-agg-lg",
10686
+ children: [
10687
+ /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(
10688
+ "button",
10689
+ {
10690
+ type: "button",
10691
+ className: "flex w-full cursor-pointer items-center gap-2 text-left group/agg-settlement-difference",
10692
+ "aria-expanded": isExpanded,
10693
+ onClick: () => handleToggleDifference(difference.canonicalKey),
10694
+ children: [
10695
+ /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
10696
+ "i",
10697
+ {
10698
+ className: cn(
10699
+ "fi",
10700
+ resolveDifferenceIconClassName(difference.canonicalKey),
10701
+ "inline-flex size-4! shrink-0 items-center justify-center text-[16px] leading-none text-agg-muted-foreground"
10702
+ ),
10703
+ "aria-hidden": "true"
10704
+ }
10705
+ ),
10706
+ /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("p", { className: "min-w-0 text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground group-hover/agg-settlement-difference:text-agg-muted-foreground transition-colors break-words [overflow-wrap:anywhere]", children: difference.title }),
10707
+ /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
10708
+ "i",
10709
+ {
10710
+ className: cn(
10711
+ "fi fi-rr-angle-small-down text-[14px]!",
10712
+ isExpanded && "rotate-180",
10713
+ "size-3.5! shrink-0 text-agg-foreground group-hover/agg-settlement-difference:text-agg-muted-foreground transition-[colors,transform]"
10714
+ ),
10715
+ style: { fontSize: 14 },
10716
+ "aria-hidden": "true"
10717
+ }
10718
+ )
10719
+ ]
10720
+ }
10721
+ ),
10722
+ isExpanded ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("dl", { className: "flex w-full flex-col items-start gap-1 px-6", children: venueKeys.map((venue) => {
10723
+ var _a2;
10724
+ const venueValue = (_a2 = difference.perVenue[venue]) != null ? _a2 : labels.trading.settlementValueUnavailable;
10725
+ const venueLabel = resolveSettlementVenueLabel(venue, labels);
10726
+ return /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "flex w-full items-start gap-2", children: [
10727
+ /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
10728
+ VenueLogo,
10729
+ {
10730
+ venue,
10731
+ size: "small",
10732
+ className: "mt-0.5 size-4",
10733
+ ariaLabel: venueLabel
10734
+ }
10735
+ ),
10736
+ /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("dt", { className: "w-[88px] shrink-0 text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground", children: venueLabel }),
10737
+ /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("dd", { className: "min-w-0 flex-1 text-agg-sm font-agg-normal leading-agg-5 text-agg-muted-foreground break-words [overflow-wrap:anywhere]", children: venueValue })
10738
+ ] }, venue);
10739
+ }) }) : null
10740
+ ]
10741
+ },
10742
+ difference.canonicalKey
10743
+ );
10744
+ }) })
10745
+ ] }) : null,
10746
+ hasVenueSettlementRules ? /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(import_jsx_runtime123.Fragment, { children: [
10747
+ hasSettlementDifferences || hasStandaloneSettlementText ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("div", { className: "h-px w-full bg-agg-separator" }) : null,
10748
+ /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(SettlementVenueRules, { rules: venueRuleBlocks, labels })
10749
+ ] }) : null
10299
10750
  ] })
10300
10751
  ]
10301
10752
  }
@@ -10306,13 +10757,16 @@ Settlement.displayName = "Settlement";
10306
10757
  // src/events/item-details/settlement-summary.tsx
10307
10758
  var import_jsx_runtime124 = require("react/jsx-runtime");
10308
10759
  var SettlementSummary = ({
10309
- content,
10760
+ settlementDiff,
10310
10761
  settlementSectionId = SETTLEMENT_SECTION_ID,
10311
10762
  className
10312
10763
  }) => {
10313
10764
  const labels = (0, import_hooks39.useLabels)();
10314
- const firstParagraph = (0, import_react15.useMemo)(() => getFirstSettlementParagraph(content), [content]);
10315
- if (!firstParagraph) return null;
10765
+ const settlementDifferences = (0, import_react15.useMemo)(
10766
+ () => prepareSettlementDifferences(settlementDiff == null ? void 0 : settlementDiff.differences),
10767
+ [settlementDiff == null ? void 0 : settlementDiff.differences]
10768
+ );
10769
+ if (settlementDifferences.length === 0) return null;
10316
10770
  const handleReadFullDetails = (event) => {
10317
10771
  event.preventDefault();
10318
10772
  event.stopPropagation();
@@ -10321,43 +10775,78 @@ var SettlementSummary = ({
10321
10775
  if (!target) return;
10322
10776
  target.scrollIntoView({ behavior: "smooth", block: "start" });
10323
10777
  };
10324
- return /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("div", { className: cn("agg-settlement-summary flex w-full flex-col gap-2", className), children: [
10325
- /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
10326
- Typography,
10327
- {
10328
- variant: "caption-caps",
10329
- className: "agg-settlement-summary-label text-agg-muted-foreground",
10330
- children: labels.settlementSummary.title
10331
- }
10332
- ),
10333
- /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("div", { className: "agg-settlement-summary-row flex w-full items-center gap-3", children: [
10334
- /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
10335
- "p",
10336
- {
10337
- className: cn(
10338
- "agg-settlement-summary-text",
10339
- "min-w-0 flex-1 truncate text-agg-sm leading-agg-5 text-agg-foreground"
10340
- ),
10341
- children: firstParagraph
10342
- }
10778
+ const actionButton = /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)(
10779
+ "button",
10780
+ {
10781
+ type: "button",
10782
+ className: cn(
10783
+ "agg-settlement-summary-toggle",
10784
+ "inline-flex shrink-0 cursor-pointer items-center gap-1 whitespace-nowrap text-agg-sm font-agg-bold leading-agg-5 text-agg-primary",
10785
+ "hover:opacity-80",
10786
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-0 focus-visible:ring-offset-agg-secondary"
10343
10787
  ),
10344
- /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
10345
- "button",
10346
- {
10347
- type: "button",
10348
- className: cn(
10349
- "agg-settlement-summary-toggle",
10350
- "shrink-0 cursor-pointer whitespace-nowrap text-agg-sm font-agg-bold leading-agg-5 text-agg-primary",
10351
- "hover:opacity-80",
10352
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-0 focus-visible:ring-offset-agg-secondary"
10353
- ),
10354
- "aria-controls": settlementSectionId,
10355
- onClick: handleReadFullDetails,
10356
- children: labels.settlementSummary.readFullDetails
10357
- }
10358
- )
10359
- ] })
10360
- ] });
10788
+ "aria-controls": settlementSectionId,
10789
+ onClick: handleReadFullDetails,
10790
+ children: [
10791
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("span", { children: labels.settlementSummary.readFullDetails }),
10792
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
10793
+ "i",
10794
+ {
10795
+ className: "fi fi-rr-arrow-small-down size-3.5!",
10796
+ "aria-hidden": "true",
10797
+ style: { fontSize: 14 }
10798
+ }
10799
+ )
10800
+ ]
10801
+ }
10802
+ );
10803
+ const visibleDifferences = settlementDifferences.slice(0, 2);
10804
+ const hiddenDifferenceCount = settlementDifferences.length - visibleDifferences.length;
10805
+ return /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)(
10806
+ "div",
10807
+ {
10808
+ className: cn(
10809
+ "agg-settlement-summary flex w-full flex-wrap items-start justify-between gap-x-4 gap-y-2",
10810
+ className
10811
+ ),
10812
+ children: [
10813
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("div", { className: "flex min-w-[240px] flex-1 flex-wrap items-center gap-x-5 gap-y-3", children: [
10814
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("div", { className: "agg-settlement-summary-heading flex shrink-0 items-center gap-2", children: [
10815
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("p", { className: "text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground", children: labels.settlementSummary.title }),
10816
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("span", { className: "flex size-4 shrink-0 items-center justify-center rounded-agg-full bg-agg-primary text-[10px] font-agg-bold leading-[14px] text-agg-on-primary", children: settlementDifferences.length })
10817
+ ] }),
10818
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("div", { className: "agg-settlement-summary-pills flex min-w-[240px] flex-1 flex-wrap items-center gap-2", children: [
10819
+ visibleDifferences.map((difference) => /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)(
10820
+ "span",
10821
+ {
10822
+ className: "flex h-6 max-w-full shrink-0 items-center gap-2 rounded-agg-full bg-agg-secondary-hover px-3 py-1 text-agg-xs font-agg-normal leading-agg-4 text-agg-foreground sm:max-w-[220px]",
10823
+ children: [
10824
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
10825
+ "i",
10826
+ {
10827
+ className: cn(
10828
+ "fi",
10829
+ resolveDifferenceIconClassName(difference.canonicalKey),
10830
+ "inline-flex size-3 shrink-0 items-center justify-center text-[12px] leading-none text-agg-muted-foreground"
10831
+ ),
10832
+ "aria-hidden": "true"
10833
+ }
10834
+ ),
10835
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("span", { className: "min-w-0 truncate", children: difference.title })
10836
+ ]
10837
+ },
10838
+ difference.canonicalKey
10839
+ )),
10840
+ hiddenDifferenceCount > 0 ? /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("span", { className: "flex h-6 shrink-0 items-center rounded-agg-full bg-agg-secondary-hover px-3 py-1 text-agg-xs font-agg-normal leading-agg-4 text-agg-foreground", children: [
10841
+ "+",
10842
+ hiddenDifferenceCount
10843
+ ] }) : null
10844
+ ] })
10845
+ ] }),
10846
+ actionButton
10847
+ ]
10848
+ }
10849
+ );
10361
10850
  };
10362
10851
  SettlementSummary.displayName = "SettlementSummary";
10363
10852
 
@@ -11092,7 +11581,7 @@ var EventListItemDetailsContent = ({
11092
11581
  }
11093
11582
  )
11094
11583
  ] }),
11095
- event.description ? /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(SettlementSummary, { content: event.description }) : null
11584
+ event.description || event.settlementDiff ? /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(SettlementSummary, { content: event.description, settlementDiff: event.settlementDiff }) : null
11096
11585
  ]
11097
11586
  }
11098
11587
  );
@@ -12979,7 +13468,7 @@ var MarketDetailsContent = ({
12979
13468
  value: selectedTab === "other" ? "order-book" : selectedTab,
12980
13469
  onChange: (nextValue) => setSelectedTab(nextValue),
12981
13470
  variant: "underline",
12982
- className: "agg-market-tabs w-full px-5"
13471
+ className: "agg-market-tabs flex! w-full px-5"
12983
13472
  }
12984
13473
  ) }),
12985
13474
  /* @__PURE__ */ (0, import_jsx_runtime130.jsx)("div", { className: "h-px w-full bg-agg-separator" })
@@ -13349,7 +13838,7 @@ MarketDetailsList.displayName = "MarketDetailsList";
13349
13838
 
13350
13839
  // src/events/list/index.tsx
13351
13840
  var import_hooks45 = require("@agg-build/hooks");
13352
- var import_sdk14 = require("@agg-build/sdk");
13841
+ var import_sdk15 = require("@agg-build/sdk");
13353
13842
  var Dialog2 = __toESM(require("@radix-ui/react-dialog"));
13354
13843
  var import_react23 = require("react");
13355
13844
 
@@ -13472,6 +13961,7 @@ CategorySidebar.displayName = "CategorySidebar";
13472
13961
 
13473
13962
  // src/events/list/event-list-tabs.tsx
13474
13963
  var import_hooks44 = require("@agg-build/hooks");
13964
+ var import_sdk14 = require("@agg-build/sdk");
13475
13965
  var import_react22 = require("react");
13476
13966
 
13477
13967
  // src/events/list/event-list.constants.ts
@@ -13496,12 +13986,6 @@ var getDefaultEventListTabs = (labels) => {
13496
13986
  venueLogo: import_sdk13.Venue.polymarket,
13497
13987
  venues: [import_sdk13.Venue.polymarket]
13498
13988
  },
13499
- {
13500
- value: import_sdk13.Venue.kalshi,
13501
- label: labels.venues.kalshi,
13502
- venueLogo: import_sdk13.Venue.kalshi,
13503
- venues: [import_sdk13.Venue.kalshi]
13504
- },
13505
13989
  {
13506
13990
  value: import_sdk13.Venue.limitless,
13507
13991
  label: labels.venues.limitless,
@@ -13565,6 +14049,7 @@ var useEventListTabs = (tabs) => {
13565
14049
  const baseTabs = tabs != null ? tabs : getDefaultEventListTabs(labels);
13566
14050
  return baseTabs.flatMap((tab) => {
13567
14051
  if (!tab.venueLogo) return [tab];
14052
+ if (!(0, import_sdk14.isVenueActive)(tab.venueLogo)) return [];
13568
14053
  const availabilityState = (0, import_hooks44.getVenueAvailabilityState)({
13569
14054
  venueId: tab.venueLogo,
13570
14055
  disabledVenues,
@@ -13686,7 +14171,7 @@ var EventList = ({
13686
14171
  const isDiscoveryFiltersEnabled = enableVenueEventDiscoveryFilters && !search;
13687
14172
  const resolvedTabs = useEventListTabs();
13688
14173
  const visibleVenues = (0, import_react23.useMemo)(
13689
- () => disabledVenues.length === 0 ? void 0 : (0, import_hooks45.getVisibleVenueIdsByConfig)(import_sdk14.VENUES, disabledVenues),
14174
+ () => disabledVenues.length === 0 ? void 0 : (0, import_hooks45.getVisibleVenueIdsByConfig)(import_sdk15.VENUES, disabledVenues),
13690
14175
  [disabledVenues]
13691
14176
  );
13692
14177
  const [activeTabValue, setActiveTabValue] = (0, import_react23.useState)(