@agg-build/ui 2.4.3 → 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-GLVLCXIM.mjs → chunk-CXSIXL7M.mjs} +29 -35
  2. package/dist/{chunk-PHAEFHBM.mjs → chunk-GWRFSQQK.mjs} +70 -17
  3. package/dist/{chunk-PHRYWSNV.mjs → chunk-I4X5UNCT.mjs} +307 -240
  4. package/dist/{chunk-3PSIO77N.mjs → chunk-JVRTJQPZ.mjs} +1 -1
  5. package/dist/{chunk-QDNG5UKJ.mjs → chunk-P5CVJQPW.mjs} +288 -291
  6. package/dist/{chunk-WZ55ERDO.mjs → chunk-PTNFXXOV.mjs} +50 -11
  7. package/dist/{chunk-STL4ZHLP.mjs → chunk-UH3DUTMG.mjs} +140 -115
  8. package/dist/events.js +440 -305
  9. package/dist/events.mjs +3 -3
  10. package/dist/index.js +840 -666
  11. package/dist/index.mjs +7 -7
  12. package/dist/modals.js +333 -297
  13. package/dist/modals.mjs +3 -3
  14. package/dist/pages.js +558 -381
  15. package/dist/pages.mjs +6 -6
  16. package/dist/primitives.js +50 -11
  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 +2597 -2384
  21. package/dist/trading.mjs +4 -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 +1 -1
  25. package/dist/types/events/item-details/settlement-summary.d.ts +1 -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 +1 -1
  37. package/dist/types/trading/settlement/index.d.ts +1 -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");
@@ -6613,14 +6621,23 @@ var import_react8 = require("react");
6613
6621
  var import_react7 = require("react");
6614
6622
  var useHorizontalScrollState = () => {
6615
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);
6616
6627
  const [canScrollLeft, setCanScrollLeft] = (0, import_react7.useState)(false);
6617
6628
  const [canScrollRight, setCanScrollRight] = (0, import_react7.useState)(false);
6618
6629
  const update = (0, import_react7.useCallback)(() => {
6619
6630
  const el = containerRef.current;
6620
6631
  if (!el) return;
6621
- const maxScroll = el.scrollWidth - el.clientWidth;
6622
- setCanScrollLeft(el.scrollLeft > 4);
6623
- 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);
6624
6641
  }, []);
6625
6642
  (0, import_react7.useEffect)(() => {
6626
6643
  const el = containerRef.current;
@@ -6636,7 +6653,15 @@ var useHorizontalScrollState = () => {
6636
6653
  ro.observe(el);
6637
6654
  return () => ro.disconnect();
6638
6655
  }, [update]);
6639
- return { containerRef, canScrollLeft, canScrollRight, update };
6656
+ return {
6657
+ containerRef,
6658
+ hasOverflow,
6659
+ isAtStart,
6660
+ isAtEnd,
6661
+ canScrollLeft,
6662
+ canScrollRight,
6663
+ update
6664
+ };
6640
6665
  };
6641
6666
 
6642
6667
  // src/primitives/tabs/tabs.constants.ts
@@ -6731,6 +6756,9 @@ var Tabs = ({
6731
6756
  });
6732
6757
  const {
6733
6758
  containerRef: tabListRef,
6759
+ hasOverflow,
6760
+ isAtStart,
6761
+ isAtEnd,
6734
6762
  canScrollLeft,
6735
6763
  canScrollRight,
6736
6764
  update: updateScrollState
@@ -6819,7 +6847,7 @@ var Tabs = ({
6819
6847
  "overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
6820
6848
  getMotionClassName(enableAnimations, "scroll-smooth")
6821
6849
  ) : "overflow-x-auto",
6822
- 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]",
6823
6851
  shouldUseOverflowScroll && "select-none",
6824
6852
  shouldUseOverflowScroll && !isBarVariant && "snap-x snap-mandatory",
6825
6853
  shouldUseOverflowScroll && (isDraggingTabs ? "cursor-grabbing" : "cursor-grab")
@@ -6977,7 +7005,10 @@ var Tabs = ({
6977
7005
  left: Math.max(0, nextScrollLeft),
6978
7006
  behavior: getScrollBehavior(enableAnimations)
6979
7007
  });
6980
- }, [enableAnimations, renderedItems, shouldUseOverflowScroll, value]);
7008
+ requestAnimationFrame(() => {
7009
+ updateScrollState();
7010
+ });
7011
+ }, [enableAnimations, renderedItems, shouldUseOverflowScroll, updateScrollState, value]);
6981
7012
  if (shouldUseOverflowSelect) {
6982
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)(
6983
7014
  Select,
@@ -7016,6 +7047,13 @@ var Tabs = ({
7016
7047
  onPointerUp: handleEndTabListDrag,
7017
7048
  onWheel: handleTabListWheel,
7018
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,
7019
7057
  renderedItems.map((item, index) => {
7020
7058
  var _a;
7021
7059
  const isActive = item.value === value;
@@ -7050,6 +7088,7 @@ var Tabs = ({
7050
7088
  isDisabled: !!item.disabled,
7051
7089
  size
7052
7090
  }),
7091
+ !isBarVariant && (size === "s" ? "px-3 md:px-4" : "h-14 px-3 md:h-15 md:px-4"),
7053
7092
  shouldUseOverflowScroll && !isBarVariant && "snap-start",
7054
7093
  classNames == null ? void 0 : classNames.tabTrigger
7055
7094
  ),
@@ -7099,9 +7138,9 @@ var Tabs = ({
7099
7138
  "aria-hidden": true,
7100
7139
  className: cn(
7101
7140
  "agg-tab-scroll-start",
7102
- "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",
7103
7142
  getMotionClassName(enableAnimations, "transition-opacity duration-200"),
7104
- canScrollLeft ? "opacity-100" : "opacity-0"
7143
+ hasOverflow && canScrollLeft && !isAtStart ? "opacity-100" : "opacity-0"
7105
7144
  )
7106
7145
  }
7107
7146
  ),
@@ -7111,9 +7150,9 @@ var Tabs = ({
7111
7150
  "aria-hidden": true,
7112
7151
  className: cn(
7113
7152
  "agg-tab-scroll-end",
7114
- "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",
7115
7154
  getMotionClassName(enableAnimations, "transition-opacity duration-200"),
7116
- canScrollRight ? "opacity-100" : "opacity-0"
7155
+ hasOverflow && canScrollRight && !isAtEnd ? "opacity-100" : "opacity-0"
7117
7156
  )
7118
7157
  }
7119
7158
  )
@@ -7516,8 +7555,85 @@ var EventListItemNotFoundState = ({
7516
7555
  );
7517
7556
  };
7518
7557
  var OUTCOMES_SCROLL_LOAD_THRESHOLD_PX = 16;
7558
+ var OUTCOMES_SCROLL_STATE_EPSILON_PX = 1;
7559
+ var OUTCOMES_SCROLL_MASK_HEIGHT_PX = 24;
7519
7560
  var MARKET_ID_QUERY_PARAM = "marketId";
7520
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
+ };
7521
7637
  var buildOutcomeMidpointsByOutcomeId = (midpointRows) => {
7522
7638
  const outcomeMidpointsByOutcomeId = /* @__PURE__ */ new Map();
7523
7639
  const addOutcomeMidpoints = (value) => {
@@ -7684,6 +7800,31 @@ var EventListItemContent = ({
7684
7800
  const matchedCountLabel = labels.eventItem.matchedCount(
7685
7801
  Math.max(resolvedVenueCount, visibleFooterVenues.length)
7686
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
+ });
7687
7828
  const shouldUseNativeLinkNavigation = (eventToHandle) => {
7688
7829
  return eventToHandle.metaKey || eventToHandle.ctrlKey || eventToHandle.shiftKey || eventToHandle.altKey || eventToHandle.button === 1;
7689
7830
  };
@@ -7735,29 +7876,9 @@ var EventListItemContent = ({
7735
7876
  onEventClick == null ? void 0 : onEventClick(event);
7736
7877
  }
7737
7878
  };
7738
- const handleOutcomesScroll = (0, import_react10.useCallback)(
7739
- (eventToHandle) => {
7740
- if (!shouldEnableLazyMarketLoading) return;
7741
- const element = eventToHandle.currentTarget;
7742
- const distanceToBottom = element.scrollHeight - element.scrollTop - element.clientHeight;
7743
- if (distanceToBottom > OUTCOMES_SCROLL_LOAD_THRESHOLD_PX) return;
7744
- if (!isLazyMarketsQueryEnabled) {
7745
- setIsLazyMarketsQueryEnabled(true);
7746
- return;
7747
- }
7748
- if (!hasNextLazyMarketsPage) return;
7749
- if (isLoadingLazyMarkets || isFetchingNextLazyMarketsPage) return;
7750
- void fetchNextLazyMarketsPage();
7751
- },
7752
- [
7753
- fetchNextLazyMarketsPage,
7754
- hasNextLazyMarketsPage,
7755
- isFetchingNextLazyMarketsPage,
7756
- isLazyMarketsQueryEnabled,
7757
- isLoadingLazyMarkets,
7758
- shouldEnableLazyMarketLoading
7759
- ]
7760
- );
7879
+ (0, import_react10.useEffect)(() => {
7880
+ updateScrollState();
7881
+ }, [comparison.rows.length, shouldRenderLoadingOutcomeRow, updateScrollState]);
7761
7882
  const renderArbitrage = (value) => {
7762
7883
  if (value == null) return null;
7763
7884
  if (Math.abs(value) < config.market.arbitrageThreshold) return null;
@@ -7942,69 +8063,94 @@ var EventListItemContent = ({
7942
8063
  ) }) : null
7943
8064
  ] }) })
7944
8065
  ] }),
7945
- /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)(
7946
- "div",
7947
- {
7948
- className: cn(
7949
- "agg-outcomes flex max-h-[76px] flex-col gap-4 overflow-y-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
7950
- classNames == null ? void 0 : classNames.outcomes
7951
- ),
7952
- onScroll: handleOutcomesScroll,
7953
- children: [
7954
- comparison.rows.map((row) => {
7955
- var _a2;
7956
- const arbitragePercent = (_a2 = arbitrageByOutcomeId == null ? void 0 : arbitrageByOutcomeId[row.outcome.id]) != null ? _a2 : arbitrageByOutcomeId == null ? void 0 : arbitrageByOutcomeId[row.market.id];
7957
- const arbReturn = arbReturnByVenueMarketId.get(row.market.id);
7958
- const priceGapPercent = arbReturn == null ? gapsByVenueMarketId.get(row.market.id) : arbReturn;
7959
- const priceGapSource = arbReturn == null ? "percent" : "fraction";
7960
- return /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)(
7961
- "div",
7962
- {
7963
- className: cn(
7964
- "agg-outcome-row",
7965
- "flex h-10 w-full flex-row items-center justify-between gap-3",
7966
- classNames == null ? void 0 : classNames.outcomeRow
7967
- ),
7968
- children: [
7969
- /* @__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)(
7970
- Typography,
7971
- {
7972
- variant: "body",
7973
- className: "agg-outcome-label min-w-0 truncate text-agg-xs leading-agg-5 md:text-agg-base md:leading-agg-6",
7974
- children: row.label
7975
- }
7976
- ) }),
7977
- /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)("div", { className: "agg-outcome-meta flex shrink-0 flex-row items-center justify-end gap-2", children: [
7978
- renderArbitrage(arbitragePercent),
7979
- renderPriceGapPill(priceGapPercent, priceGapSource),
7980
- /* @__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(
7981
- (price, priceIndex) => renderComparisonPriceBadge(row, price, priceIndex)
7982
- ) })
7983
- ] })
7984
- ]
7985
- },
7986
- row.id
7987
- );
7988
- }),
7989
- shouldRenderLoadingOutcomeRow ? /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)("div", { className: "agg-outcome-row-loading flex w-full items-center justify-between gap-3", children: [
7990
- /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
7991
- "div",
7992
- {
7993
- "aria-hidden": "true",
7994
- className: "bg-agg-separator animate-pulse h-5 rounded-agg-sm w-[200px]"
7995
- }
7996
- ),
7997
- /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
7998
- "div",
7999
- {
8000
- "aria-hidden": "true",
8001
- className: "bg-agg-separator animate-pulse h-9 w-[100px] rounded-agg-full"
8002
- }
8003
- )
8004
- ] }) : null
8005
- ]
8006
- }
8007
- ),
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
+ ] }),
8008
8154
  /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)(
8009
8155
  "div",
8010
8156
  {
@@ -8022,6 +8168,14 @@ var EventListItemContent = ({
8022
8168
  "agg-event-meta flex min-w-0 flex-1 items-center gap-2 text-agg-sm leading-agg-5 truncate"
8023
8169
  ),
8024
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,
8025
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,
8026
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: [
8027
8181
  /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
@@ -10039,13 +10193,6 @@ var parseSettlementBlocks = (input) => {
10039
10193
  }
10040
10194
  return blocks;
10041
10195
  };
10042
- var getFirstSettlementParagraph = (input) => {
10043
- if (!input) return "";
10044
- const blocks = parseSettlementBlocks(input);
10045
- const firstParagraph = blocks.find((block) => block.kind === "paragraph");
10046
- if (!firstParagraph || firstParagraph.kind !== "paragraph") return "";
10047
- return firstParagraph.lines.join(" ").trim();
10048
- };
10049
10196
  var normalizeSettlementForCompare = (input) => {
10050
10197
  return stripHtmlFragments(input).replace(/\s+/g, " ").trim().toLowerCase();
10051
10198
  };
@@ -10281,7 +10428,13 @@ var mergePerVenueValues = (current, next) => {
10281
10428
  };
10282
10429
  var prepareSettlementDifferences = (differences) => {
10283
10430
  const byCanonicalKey = /* @__PURE__ */ new Map();
10284
- for (const [originalIndex, difference] of (differences != null ? differences : []).entries()) {
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 });
10285
10438
  const canonicalKey = resolveCanonicalDifferenceKey(difference);
10286
10439
  if (hasEqualNormalizedDateValues(difference, canonicalKey)) continue;
10287
10440
  const existing = byCanonicalKey.get(canonicalKey);
@@ -10336,17 +10489,76 @@ var resolveDifferenceIconClassName = (canonicalKey) => {
10336
10489
  return "fi-rr-info";
10337
10490
  };
10338
10491
  var buildSettlementVenueRules = ({
10339
- eventBlock,
10340
10492
  marketBlock,
10341
10493
  primaryRulesBlock,
10494
+ settlementVenues,
10342
10495
  settlementVenueRules
10343
10496
  }) => {
10344
- if (settlementVenueRules) return settlementVenueRules;
10345
- const content = [marketBlock == null ? void 0 : marketBlock.content, primaryRulesBlock == null ? void 0 : primaryRulesBlock.content, eventBlock == null ? void 0 : eventBlock.content].filter((value) => typeof value === "string" && value.trim().length > 0).join("\n\n");
10346
- return content ? [{ venue: "polymarket", content }] : [];
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
+ });
10347
10524
  };
10348
- var getSettlementHeaderClassName = () => {
10349
- return "flex items-center justify-between gap-4";
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
+ ] });
10350
10562
  };
10351
10563
  var Settlement = ({
10352
10564
  className,
@@ -10380,13 +10592,20 @@ var Settlement = ({
10380
10592
  const primaryRulesBlock = (_c = blocks.find((block) => block.key === "primaryRules")) != null ? _c : null;
10381
10593
  const venueRuleBlocks = (0, import_react14.useMemo)(
10382
10594
  () => buildSettlementVenueRules({
10383
- eventBlock,
10384
10595
  marketBlock,
10385
10596
  primaryRulesBlock,
10597
+ settlementVenues,
10386
10598
  settlementVenueRules
10387
10599
  }),
10388
- [eventBlock, marketBlock, primaryRulesBlock, settlementVenueRules]
10389
- );
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;
10390
10609
  const defaultOpenDifferenceKey = (_e = (_d = settlementDifferences[0]) == null ? void 0 : _d.canonicalKey) != null ? _e : null;
10391
10610
  const [openDifferenceKeys, setOpenDifferenceKeys] = (0, import_react14.useState)(
10392
10611
  () => defaultOpenDifferenceKey ? [defaultOpenDifferenceKey] : []
@@ -10409,25 +10628,51 @@ var Settlement = ({
10409
10628
  }
10410
10629
  );
10411
10630
  }
10631
+ if (!hasSettlementContent) return null;
10412
10632
  const resolvedSectionLabel = sectionLabel === defaultSettlementSectionLabel ? labels.trading.settlementSection : sectionLabel;
10413
- if (settlementDifferences.length > 0) {
10414
- return /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(
10415
- Card,
10416
- {
10417
- id,
10418
- className: cn(
10419
- "group/agg-settlement-card",
10420
- "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",
10421
- className
10422
- ),
10423
- children: [
10424
- /* @__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: [
10425
- /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("p", { className: "shrink-0 text-agg-xs font-agg-bold leading-agg-4 uppercase", children: resolvedSectionLabel }),
10426
- 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
10427
- ] }),
10428
- /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "agg-settlement-differences flex w-full flex-col items-start gap-5", children: [
10633
+ return /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(
10634
+ Card,
10635
+ {
10636
+ id,
10637
+ className: cn(
10638
+ "group/agg-settlement-card",
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",
10640
+ className
10641
+ ),
10642
+ children: [
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
10646
+ ] }),
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: [
10429
10674
  /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "flex items-center gap-2", children: [
10430
- /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: "Key differences" }),
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 }),
10431
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 })
10432
10677
  ] }),
10433
10678
  /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("div", { className: "flex w-full flex-col items-start gap-5", children: settlementDifferences.map((difference) => {
@@ -10443,7 +10688,7 @@ var Settlement = ({
10443
10688
  "button",
10444
10689
  {
10445
10690
  type: "button",
10446
- className: "flex w-full cursor-pointer items-start gap-2 text-left",
10691
+ className: "flex w-full cursor-pointer items-center gap-2 text-left group/agg-settlement-difference",
10447
10692
  "aria-expanded": isExpanded,
10448
10693
  onClick: () => handleToggleDifference(difference.canonicalKey),
10449
10694
  children: [
@@ -10458,12 +10703,16 @@ var Settlement = ({
10458
10703
  "aria-hidden": "true"
10459
10704
  }
10460
10705
  ),
10461
- /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("p", { className: "min-w-0 text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground break-words [overflow-wrap:anywhere]", children: difference.title }),
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 }),
10462
10707
  /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
10463
- Icon,
10708
+ "i",
10464
10709
  {
10465
- name: isExpanded ? "chevron-up" : "chevron-down",
10466
- className: "size-4! mt-0.5 shrink-0 text-agg-foreground",
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 },
10467
10716
  "aria-hidden": "true"
10468
10717
  }
10469
10718
  )
@@ -10492,80 +10741,12 @@ var Settlement = ({
10492
10741
  },
10493
10742
  difference.canonicalKey
10494
10743
  );
10495
- }) }),
10496
- venueRuleBlocks.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(import_jsx_runtime123.Fragment, { children: [
10497
- /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("div", { className: "h-px w-full bg-agg-separator" }),
10498
- /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: "Full rules by venue" }),
10499
- /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("div", { className: "flex w-full flex-col items-start gap-4", children: venueRuleBlocks.map((rule) => {
10500
- const venueLabel = resolveSettlementVenueLabel(rule.venue, labels);
10501
- return /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("details", { className: "group/agg-settlement-rule w-full", children: [
10502
- /* @__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 marker:hidden", children: [
10503
- /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
10504
- VenueLogo,
10505
- {
10506
- venue: rule.venue,
10507
- size: "small",
10508
- className: "size-4",
10509
- ariaLabel: venueLabel
10510
- }
10511
- ),
10512
- /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("span", { children: venueLabel }),
10513
- /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
10514
- Icon,
10515
- {
10516
- name: "chevron-down",
10517
- className: "size-4! shrink-0 text-agg-foreground transition-transform group-open/agg-settlement-rule:rotate-180",
10518
- "aria-hidden": "true"
10519
- }
10520
- )
10521
- ] }),
10522
- /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("div", { className: "mt-3 pl-6", children: /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(SettlementTextRenderer, { content: rule.content }) })
10523
- ] }, rule.venue);
10524
- }) })
10525
- ] }) : null
10526
- ] })
10527
- ]
10528
- }
10529
- );
10530
- }
10531
- return /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(
10532
- Card,
10533
- {
10534
- id,
10535
- className: cn(
10536
- "group/agg-settlement-card",
10537
- "flex flex-col w-full gap-5 rounded-agg-xl border border-agg-separator bg-agg-secondary p-5 shadow-none hover:shadow-none",
10538
- className
10539
- ),
10540
- children: [
10541
- /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: cn("agg-settlement-header", getSettlementHeaderClassName()), children: [
10542
- /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("p", { className: "text-agg-xs font-agg-bold leading-agg-4 uppercase text-agg-muted-foreground", children: resolvedSectionLabel }),
10543
- 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
10544
- ] }),
10545
- blocks.length === 0 && settlementDifferences.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: [
10546
- eventBlock || marketBlock ? /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(
10547
- "div",
10548
- {
10549
- className: "agg-settlement-section agg-settlement-section-description",
10550
- "data-source": "description",
10551
- children: [
10552
- eventBlock ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("div", { "data-source": "eventDescription", children: /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(SettlementTextRenderer, { content: eventBlock.content }) }) : null,
10553
- eventBlock && marketBlock ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("hr", { className: "agg-settlement-divider my-4 border-0 border-t border-agg-separator" }) : null,
10554
- marketBlock ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("div", { "data-source": "marketDescription", children: /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(SettlementTextRenderer, { content: marketBlock.content }) }) : null
10555
- ]
10556
- }
10557
- ) : null,
10558
- primaryRulesBlock ? /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(
10559
- "div",
10560
- {
10561
- className: "agg-settlement-section agg-settlement-section-primaryRules",
10562
- "data-source": "primaryRules",
10563
- children: [
10564
- /* @__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 }),
10565
- /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(SettlementTextRenderer, { content: primaryRulesBlock.content })
10566
- ]
10567
- }
10568
- ) : null
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
10569
10750
  ] })
10570
10751
  ]
10571
10752
  }
@@ -10576,18 +10757,16 @@ Settlement.displayName = "Settlement";
10576
10757
  // src/events/item-details/settlement-summary.tsx
10577
10758
  var import_jsx_runtime124 = require("react/jsx-runtime");
10578
10759
  var SettlementSummary = ({
10579
- content,
10580
10760
  settlementDiff,
10581
10761
  settlementSectionId = SETTLEMENT_SECTION_ID,
10582
10762
  className
10583
10763
  }) => {
10584
10764
  const labels = (0, import_hooks39.useLabels)();
10585
- const firstParagraph = (0, import_react15.useMemo)(() => getFirstSettlementParagraph(content), [content]);
10586
10765
  const settlementDifferences = (0, import_react15.useMemo)(
10587
10766
  () => prepareSettlementDifferences(settlementDiff == null ? void 0 : settlementDiff.differences),
10588
10767
  [settlementDiff == null ? void 0 : settlementDiff.differences]
10589
10768
  );
10590
- if (!firstParagraph && settlementDifferences.length === 0) return null;
10769
+ if (settlementDifferences.length === 0) return null;
10591
10770
  const handleReadFullDetails = (event) => {
10592
10771
  event.preventDefault();
10593
10772
  event.stopPropagation();
@@ -10596,20 +10775,6 @@ var SettlementSummary = ({
10596
10775
  if (!target) return;
10597
10776
  target.scrollIntoView({ behavior: "smooth", block: "start" });
10598
10777
  };
10599
- const handleDifferencePillClick = (event, canonicalKey) => {
10600
- event.preventDefault();
10601
- event.stopPropagation();
10602
- if (typeof document === "undefined") return;
10603
- const target = document.getElementById(
10604
- getSettlementDifferenceId(settlementSectionId, canonicalKey)
10605
- );
10606
- if (!target) return;
10607
- const trigger = target.querySelector("button[aria-expanded]");
10608
- if ((trigger == null ? void 0 : trigger.getAttribute("aria-expanded")) === "false") {
10609
- trigger.click();
10610
- }
10611
- target.scrollIntoView({ behavior: "smooth", block: "start" });
10612
- };
10613
10778
  const actionButton = /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)(
10614
10779
  "button",
10615
10780
  {
@@ -10624,85 +10789,59 @@ var SettlementSummary = ({
10624
10789
  onClick: handleReadFullDetails,
10625
10790
  children: [
10626
10791
  /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("span", { children: labels.settlementSummary.readFullDetails }),
10627
- /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(Icon, { name: "chevron-down", className: "size-[14px]", "aria-hidden": "true" })
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
+ )
10628
10800
  ]
10629
10801
  }
10630
10802
  );
10631
- if (settlementDifferences.length > 0) {
10632
- const visibleDifferences = settlementDifferences.slice(0, 2);
10633
- const hiddenDifferenceCount = settlementDifferences.length - visibleDifferences.length;
10634
- return /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)(
10635
- "div",
10636
- {
10637
- className: cn(
10638
- "agg-settlement-summary flex w-full flex-wrap items-start justify-between gap-x-4 gap-y-2",
10639
- className
10640
- ),
10641
- children: [
10642
- /* @__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: [
10643
- /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("div", { className: "agg-settlement-summary-heading flex shrink-0 items-center gap-2", children: [
10644
- /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("p", { className: "text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground", children: labels.settlementSummary.title }),
10645
- /* @__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 })
10646
- ] }),
10647
- /* @__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: [
10648
- visibleDifferences.map((difference) => /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)(
10649
- "button",
10650
- {
10651
- type: "button",
10652
- className: cn(
10653
- "flex h-6 max-w-full shrink-0 cursor-pointer 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]",
10654
- "hover:opacity-80",
10655
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-0 focus-visible:ring-offset-agg-secondary"
10656
- ),
10657
- onClick: (event) => handleDifferencePillClick(event, difference.canonicalKey),
10658
- children: [
10659
- /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
10660
- "i",
10661
- {
10662
- className: cn(
10663
- "fi",
10664
- resolveDifferenceIconClassName(difference.canonicalKey),
10665
- "inline-flex size-3 shrink-0 items-center justify-center text-[12px] leading-none text-agg-muted-foreground"
10666
- ),
10667
- "aria-hidden": "true"
10668
- }
10669
- ),
10670
- /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("span", { className: "min-w-0 truncate", children: difference.title })
10671
- ]
10672
- },
10673
- difference.canonicalKey
10674
- )),
10675
- 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: [
10676
- "+",
10677
- hiddenDifferenceCount
10678
- ] }) : null
10679
- ] })
10680
- ] }),
10681
- actionButton
10682
- ]
10683
- }
10684
- );
10685
- }
10803
+ const visibleDifferences = settlementDifferences.slice(0, 2);
10804
+ const hiddenDifferenceCount = settlementDifferences.length - visibleDifferences.length;
10686
10805
  return /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)(
10687
10806
  "div",
10688
10807
  {
10689
10808
  className: cn(
10690
- "agg-settlement-summary flex w-full items-center justify-between gap-4",
10809
+ "agg-settlement-summary flex w-full flex-wrap items-start justify-between gap-x-4 gap-y-2",
10691
10810
  className
10692
10811
  ),
10693
10812
  children: [
10694
- /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("div", { className: "agg-settlement-summary-row flex min-w-0 flex-1 items-center gap-5", children: [
10695
- /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("div", { className: "agg-settlement-summary-heading flex shrink-0 items-center gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("p", { className: "text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground", children: labels.settlementSummary.title }) }),
10696
- /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
10697
- "p",
10698
- {
10699
- className: cn(
10700
- "agg-settlement-summary-text",
10701
- "min-w-0 flex-1 truncate text-agg-sm leading-agg-5 text-agg-foreground"
10702
- ),
10703
- children: firstParagraph
10704
- }
10705
- )
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
+ ] })
10706
10845
  ] }),
10707
10846
  actionButton
10708
10847
  ]
@@ -13329,7 +13468,7 @@ var MarketDetailsContent = ({
13329
13468
  value: selectedTab === "other" ? "order-book" : selectedTab,
13330
13469
  onChange: (nextValue) => setSelectedTab(nextValue),
13331
13470
  variant: "underline",
13332
- className: "agg-market-tabs w-full px-5"
13471
+ className: "agg-market-tabs flex! w-full px-5"
13333
13472
  }
13334
13473
  ) }),
13335
13474
  /* @__PURE__ */ (0, import_jsx_runtime130.jsx)("div", { className: "h-px w-full bg-agg-separator" })
@@ -13699,7 +13838,7 @@ MarketDetailsList.displayName = "MarketDetailsList";
13699
13838
 
13700
13839
  // src/events/list/index.tsx
13701
13840
  var import_hooks45 = require("@agg-build/hooks");
13702
- var import_sdk14 = require("@agg-build/sdk");
13841
+ var import_sdk15 = require("@agg-build/sdk");
13703
13842
  var Dialog2 = __toESM(require("@radix-ui/react-dialog"));
13704
13843
  var import_react23 = require("react");
13705
13844
 
@@ -13822,6 +13961,7 @@ CategorySidebar.displayName = "CategorySidebar";
13822
13961
 
13823
13962
  // src/events/list/event-list-tabs.tsx
13824
13963
  var import_hooks44 = require("@agg-build/hooks");
13964
+ var import_sdk14 = require("@agg-build/sdk");
13825
13965
  var import_react22 = require("react");
13826
13966
 
13827
13967
  // src/events/list/event-list.constants.ts
@@ -13846,12 +13986,6 @@ var getDefaultEventListTabs = (labels) => {
13846
13986
  venueLogo: import_sdk13.Venue.polymarket,
13847
13987
  venues: [import_sdk13.Venue.polymarket]
13848
13988
  },
13849
- {
13850
- value: import_sdk13.Venue.kalshi,
13851
- label: labels.venues.kalshi,
13852
- venueLogo: import_sdk13.Venue.kalshi,
13853
- venues: [import_sdk13.Venue.kalshi]
13854
- },
13855
13989
  {
13856
13990
  value: import_sdk13.Venue.limitless,
13857
13991
  label: labels.venues.limitless,
@@ -13915,6 +14049,7 @@ var useEventListTabs = (tabs) => {
13915
14049
  const baseTabs = tabs != null ? tabs : getDefaultEventListTabs(labels);
13916
14050
  return baseTabs.flatMap((tab) => {
13917
14051
  if (!tab.venueLogo) return [tab];
14052
+ if (!(0, import_sdk14.isVenueActive)(tab.venueLogo)) return [];
13918
14053
  const availabilityState = (0, import_hooks44.getVenueAvailabilityState)({
13919
14054
  venueId: tab.venueLogo,
13920
14055
  disabledVenues,
@@ -14036,7 +14171,7 @@ var EventList = ({
14036
14171
  const isDiscoveryFiltersEnabled = enableVenueEventDiscoveryFilters && !search;
14037
14172
  const resolvedTabs = useEventListTabs();
14038
14173
  const visibleVenues = (0, import_react23.useMemo)(
14039
- () => 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),
14040
14175
  [disabledVenues]
14041
14176
  );
14042
14177
  const [activeTabValue, setActiveTabValue] = (0, import_react23.useState)(