@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/pages.js CHANGED
@@ -99,7 +99,7 @@ module.exports = __toCommonJS(pages_exports);
99
99
 
100
100
  // src/pages/home/index.tsx
101
101
  var import_hooks62 = require("@agg-build/hooks");
102
- var import_sdk18 = require("@agg-build/sdk");
102
+ var import_sdk19 = require("@agg-build/sdk");
103
103
  var import_react42 = require("react");
104
104
 
105
105
  // src/events/item/index.tsx
@@ -1659,6 +1659,12 @@ var iconSizeClasses = {
1659
1659
  medium: "h-6 w-6",
1660
1660
  large: "h-8 w-8"
1661
1661
  };
1662
+ var iconSizePixels = {
1663
+ xs: 12,
1664
+ small: 16,
1665
+ medium: 24,
1666
+ large: 32
1667
+ };
1662
1668
 
1663
1669
  // src/primitives/search/search-empty-icon.tsx
1664
1670
  var import_jsx_runtime40 = require("react/jsx-runtime");
@@ -3260,6 +3266,8 @@ var Icon = (_a) => {
3260
3266
  __spreadValues({
3261
3267
  color,
3262
3268
  className: cn("group/agg-icon", resolvedClassName),
3269
+ width: iconSizePixels[size],
3270
+ height: iconSizePixels[size],
3263
3271
  style: resolvedStyle
3264
3272
  }, props)
3265
3273
  );
@@ -5011,7 +5019,7 @@ EventListSkeletonView.displayName = "EventListSkeletonView";
5011
5019
  var import_hooks13 = require("@agg-build/hooks");
5012
5020
 
5013
5021
  // src/events/item-details/event-list-item-details.constants.ts
5014
- var detailsBaseCardClassName = "w-full gap-6 p-5 md:gap-8";
5022
+ var detailsBaseCardClassName = "w-full gap-6 p-4 md:p-5 md:gap-8";
5015
5023
 
5016
5024
  // src/primitives/skeleton/views/event-list-item-details-skeleton-view.tsx
5017
5025
  var import_jsx_runtime98 = require("react/jsx-runtime");
@@ -5322,17 +5330,10 @@ var SettlementSkeletonView = ({
5322
5330
  children: [
5323
5331
  /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("div", { className: "flex w-full items-center justify-between gap-4", children: [
5324
5332
  /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(SkeletonBlock, { className: "h-4 w-[81px] rounded-agg-sm" }),
5325
- /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(SkeletonBlock, { className: "h-5 w-full max-w-[240px] rounded-agg-sm" })
5333
+ /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(SkeletonBlock, { className: "h-5 w-[240px] max-w-[60%] rounded-agg-sm" })
5326
5334
  ] }),
5327
- /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("div", { className: "flex w-full flex-col gap-3", children: [
5328
- /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(SkeletonBlock, { className: "h-5 w-[200px] rounded-agg-sm" }),
5329
- /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("div", { className: "flex flex-col gap-2", children: [
5330
- /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(SkeletonBlock, { className: "h-4 w-full max-w-[320px] rounded-agg-sm" }),
5331
- /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(SkeletonBlock, { className: "h-4 w-full max-w-[280px] rounded-agg-sm" })
5332
- ] })
5333
- ] }),
5334
- /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("div", { className: "h-px w-full bg-agg-separator" }),
5335
- /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("div", { className: "flex w-full flex-col gap-3", children: [
5335
+ /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(SkeletonBlock, { className: "h-5 w-[200px] rounded-agg-sm" }),
5336
+ /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("div", { className: "flex w-full flex-col gap-4", children: [
5336
5337
  /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("div", { className: "flex items-center gap-2", children: [
5337
5338
  /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(SkeletonBlock, { className: "size-4 rounded-agg-sm" }),
5338
5339
  /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(SkeletonBlock, { className: "h-5 w-[100px] rounded-agg-sm" })
@@ -8216,14 +8217,23 @@ var import_react11 = require("react");
8216
8217
  var import_react10 = require("react");
8217
8218
  var useHorizontalScrollState = () => {
8218
8219
  const containerRef = (0, import_react10.useRef)(null);
8220
+ const [hasOverflow, setHasOverflow] = (0, import_react10.useState)(false);
8221
+ const [isAtStart, setIsAtStart] = (0, import_react10.useState)(true);
8222
+ const [isAtEnd, setIsAtEnd] = (0, import_react10.useState)(true);
8219
8223
  const [canScrollLeft, setCanScrollLeft] = (0, import_react10.useState)(false);
8220
8224
  const [canScrollRight, setCanScrollRight] = (0, import_react10.useState)(false);
8221
8225
  const update = (0, import_react10.useCallback)(() => {
8222
8226
  const el = containerRef.current;
8223
8227
  if (!el) return;
8224
- const maxScroll = el.scrollWidth - el.clientWidth;
8225
- setCanScrollLeft(el.scrollLeft > 4);
8226
- setCanScrollRight(maxScroll - el.scrollLeft > 4);
8228
+ const epsilon = 2;
8229
+ const nextHasOverflow = el.scrollWidth > el.clientWidth + epsilon;
8230
+ const nextIsAtStart = el.scrollLeft <= epsilon;
8231
+ const nextIsAtEnd = el.scrollLeft + el.clientWidth >= el.scrollWidth - epsilon;
8232
+ setHasOverflow(nextHasOverflow);
8233
+ setIsAtStart(nextIsAtStart);
8234
+ setIsAtEnd(nextIsAtEnd);
8235
+ setCanScrollLeft(nextHasOverflow && !nextIsAtStart);
8236
+ setCanScrollRight(nextHasOverflow && !nextIsAtEnd);
8227
8237
  }, []);
8228
8238
  (0, import_react10.useEffect)(() => {
8229
8239
  const el = containerRef.current;
@@ -8239,7 +8249,15 @@ var useHorizontalScrollState = () => {
8239
8249
  ro.observe(el);
8240
8250
  return () => ro.disconnect();
8241
8251
  }, [update]);
8242
- return { containerRef, canScrollLeft, canScrollRight, update };
8252
+ return {
8253
+ containerRef,
8254
+ hasOverflow,
8255
+ isAtStart,
8256
+ isAtEnd,
8257
+ canScrollLeft,
8258
+ canScrollRight,
8259
+ update
8260
+ };
8243
8261
  };
8244
8262
 
8245
8263
  // src/primitives/tabs/tabs.constants.ts
@@ -8334,6 +8352,9 @@ var Tabs = ({
8334
8352
  });
8335
8353
  const {
8336
8354
  containerRef: tabListRef,
8355
+ hasOverflow,
8356
+ isAtStart,
8357
+ isAtEnd,
8337
8358
  canScrollLeft,
8338
8359
  canScrollRight,
8339
8360
  update: updateScrollState
@@ -8422,7 +8443,7 @@ var Tabs = ({
8422
8443
  "overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
8423
8444
  getMotionClassName(enableAnimations, "scroll-smooth")
8424
8445
  ) : "overflow-x-auto",
8425
- isBarVariant ? "items-start rounded-agg-lg border border-agg-separator p-1.5" : "h-15 border-b border-agg-separator -mb-[1px]",
8446
+ 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]",
8426
8447
  shouldUseOverflowScroll && "select-none",
8427
8448
  shouldUseOverflowScroll && !isBarVariant && "snap-x snap-mandatory",
8428
8449
  shouldUseOverflowScroll && (isDraggingTabs ? "cursor-grabbing" : "cursor-grab")
@@ -8580,7 +8601,10 @@ var Tabs = ({
8580
8601
  left: Math.max(0, nextScrollLeft),
8581
8602
  behavior: getScrollBehavior(enableAnimations)
8582
8603
  });
8583
- }, [enableAnimations, renderedItems, shouldUseOverflowScroll, value]);
8604
+ requestAnimationFrame(() => {
8605
+ updateScrollState();
8606
+ });
8607
+ }, [enableAnimations, renderedItems, shouldUseOverflowScroll, updateScrollState, value]);
8584
8608
  if (shouldUseOverflowSelect) {
8585
8609
  return /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("div", { className: cn("group/agg-tabs w-full", className, classNames == null ? void 0 : classNames.root), children: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
8586
8610
  Select,
@@ -8619,6 +8643,13 @@ var Tabs = ({
8619
8643
  onPointerUp: handleEndTabListDrag,
8620
8644
  onWheel: handleTabListWheel,
8621
8645
  children: [
8646
+ shouldUseOverflowScroll && !isBarVariant && hasOverflow ? /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
8647
+ "span",
8648
+ {
8649
+ "aria-hidden": true,
8650
+ className: "agg-tab-scroll-start-spacer h-full w-4 shrink-0 snap-start"
8651
+ }
8652
+ ) : null,
8622
8653
  renderedItems.map((item, index) => {
8623
8654
  var _a;
8624
8655
  const isActive = item.value === value;
@@ -8653,6 +8684,7 @@ var Tabs = ({
8653
8684
  isDisabled: !!item.disabled,
8654
8685
  size
8655
8686
  }),
8687
+ !isBarVariant && (size === "s" ? "px-3 md:px-4" : "h-14 px-3 md:h-15 md:px-4"),
8656
8688
  shouldUseOverflowScroll && !isBarVariant && "snap-start",
8657
8689
  classNames == null ? void 0 : classNames.tabTrigger
8658
8690
  ),
@@ -8702,9 +8734,9 @@ var Tabs = ({
8702
8734
  "aria-hidden": true,
8703
8735
  className: cn(
8704
8736
  "agg-tab-scroll-start",
8705
- "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",
8737
+ "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",
8706
8738
  getMotionClassName(enableAnimations, "transition-opacity duration-200"),
8707
- canScrollLeft ? "opacity-100" : "opacity-0"
8739
+ hasOverflow && canScrollLeft && !isAtStart ? "opacity-100" : "opacity-0"
8708
8740
  )
8709
8741
  }
8710
8742
  ),
@@ -8714,9 +8746,9 @@ var Tabs = ({
8714
8746
  "aria-hidden": true,
8715
8747
  className: cn(
8716
8748
  "agg-tab-scroll-end",
8717
- "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",
8749
+ "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",
8718
8750
  getMotionClassName(enableAnimations, "transition-opacity duration-200"),
8719
- canScrollRight ? "opacity-100" : "opacity-0"
8751
+ hasOverflow && canScrollRight && !isAtEnd ? "opacity-100" : "opacity-0"
8720
8752
  )
8721
8753
  }
8722
8754
  )
@@ -9128,8 +9160,85 @@ var EventListItemNotFoundState = ({
9128
9160
  );
9129
9161
  };
9130
9162
  var OUTCOMES_SCROLL_LOAD_THRESHOLD_PX = 16;
9163
+ var OUTCOMES_SCROLL_STATE_EPSILON_PX = 1;
9164
+ var OUTCOMES_SCROLL_MASK_HEIGHT_PX = 24;
9131
9165
  var MARKET_ID_QUERY_PARAM = "marketId";
9132
9166
  var OUTCOME_ID_QUERY_PARAM = "outcomeId";
9167
+ var OUTCOME_ROW_SELECTOR = ".agg-outcome-row";
9168
+ var DEFAULT_OUTCOMES_SCROLL_STATE = {
9169
+ hasOverflow: false,
9170
+ isAtTop: true,
9171
+ isAtBottom: true,
9172
+ remainingMarkets: 0
9173
+ };
9174
+ var areOutcomesScrollStatesEqual = (left, right) => {
9175
+ return left.hasOverflow === right.hasOverflow && left.isAtTop === right.isAtTop && left.isAtBottom === right.isAtBottom && left.remainingMarkets === right.remainingMarkets;
9176
+ };
9177
+ var useOutcomesScrollState = ({
9178
+ totalMarketCount,
9179
+ onReachScrollThreshold
9180
+ }) => {
9181
+ const containerRef = (0, import_react14.useRef)(null);
9182
+ const frameRef = (0, import_react14.useRef)(null);
9183
+ const scrollStateRef = (0, import_react14.useRef)(DEFAULT_OUTCOMES_SCROLL_STATE);
9184
+ const [scrollState, setScrollState] = (0, import_react14.useState)(
9185
+ DEFAULT_OUTCOMES_SCROLL_STATE
9186
+ );
9187
+ const measureScrollState = (0, import_react14.useCallback)(() => {
9188
+ frameRef.current = null;
9189
+ const element = containerRef.current;
9190
+ if (!element) return;
9191
+ const { clientHeight, scrollHeight, scrollTop } = element;
9192
+ const hasOverflow = scrollHeight > clientHeight + OUTCOMES_SCROLL_STATE_EPSILON_PX;
9193
+ const isAtTop = scrollTop <= OUTCOMES_SCROLL_STATE_EPSILON_PX;
9194
+ const isAtBottom = !hasOverflow || scrollTop + clientHeight >= scrollHeight - OUTCOMES_SCROLL_STATE_EPSILON_PX;
9195
+ const loadedRows = Array.from(element.querySelectorAll(OUTCOME_ROW_SELECTOR));
9196
+ const visibleMarketCount = loadedRows.reduce((count, row) => {
9197
+ return count + (row.offsetTop < clientHeight - OUTCOMES_SCROLL_STATE_EPSILON_PX ? 1 : 0);
9198
+ }, 0);
9199
+ const remainingMarkets = hasOverflow ? Math.max(0, totalMarketCount - visibleMarketCount) : 0;
9200
+ const nextScrollState = {
9201
+ hasOverflow,
9202
+ isAtTop,
9203
+ isAtBottom,
9204
+ remainingMarkets
9205
+ };
9206
+ if (!areOutcomesScrollStatesEqual(scrollStateRef.current, nextScrollState)) {
9207
+ scrollStateRef.current = nextScrollState;
9208
+ setScrollState(nextScrollState);
9209
+ }
9210
+ const distanceToBottom = scrollHeight - scrollTop - clientHeight;
9211
+ if (distanceToBottom <= OUTCOMES_SCROLL_LOAD_THRESHOLD_PX) {
9212
+ onReachScrollThreshold == null ? void 0 : onReachScrollThreshold();
9213
+ }
9214
+ }, [onReachScrollThreshold, totalMarketCount]);
9215
+ const updateScrollState = (0, import_react14.useCallback)(() => {
9216
+ if (frameRef.current != null) return;
9217
+ frameRef.current = window.requestAnimationFrame(measureScrollState);
9218
+ }, [measureScrollState]);
9219
+ (0, import_react14.useEffect)(() => {
9220
+ const element = containerRef.current;
9221
+ if (!element) return;
9222
+ element.addEventListener("scroll", updateScrollState, { passive: true });
9223
+ let resizeObserver = null;
9224
+ if (typeof ResizeObserver !== "undefined") {
9225
+ resizeObserver = new ResizeObserver(() => {
9226
+ updateScrollState();
9227
+ });
9228
+ resizeObserver.observe(element);
9229
+ }
9230
+ updateScrollState();
9231
+ return () => {
9232
+ element.removeEventListener("scroll", updateScrollState);
9233
+ resizeObserver == null ? void 0 : resizeObserver.disconnect();
9234
+ if (frameRef.current != null) {
9235
+ window.cancelAnimationFrame(frameRef.current);
9236
+ frameRef.current = null;
9237
+ }
9238
+ };
9239
+ }, [updateScrollState]);
9240
+ return { containerRef, scrollState, updateScrollState };
9241
+ };
9133
9242
  var buildOutcomeMidpointsByOutcomeId = (midpointRows) => {
9134
9243
  const outcomeMidpointsByOutcomeId = /* @__PURE__ */ new Map();
9135
9244
  const addOutcomeMidpoints = (value) => {
@@ -9296,6 +9405,31 @@ var EventListItemContent = ({
9296
9405
  const matchedCountLabel = labels.eventItem.matchedCount(
9297
9406
  Math.max(resolvedVenueCount, visibleFooterVenues.length)
9298
9407
  );
9408
+ const handleOutcomesScrollThreshold = (0, import_react14.useCallback)(() => {
9409
+ if (!shouldEnableLazyMarketLoading) return;
9410
+ if (!isLazyMarketsQueryEnabled) {
9411
+ setIsLazyMarketsQueryEnabled(true);
9412
+ return;
9413
+ }
9414
+ if (!hasNextLazyMarketsPage) return;
9415
+ if (isLoadingLazyMarkets || isFetchingNextLazyMarketsPage) return;
9416
+ void fetchNextLazyMarketsPage();
9417
+ }, [
9418
+ fetchNextLazyMarketsPage,
9419
+ hasNextLazyMarketsPage,
9420
+ isFetchingNextLazyMarketsPage,
9421
+ isLazyMarketsQueryEnabled,
9422
+ isLoadingLazyMarkets,
9423
+ shouldEnableLazyMarketLoading
9424
+ ]);
9425
+ const {
9426
+ containerRef: outcomesContainerRef,
9427
+ scrollState: outcomesScrollState,
9428
+ updateScrollState
9429
+ } = useOutcomesScrollState({
9430
+ totalMarketCount: resolvedMarketCount,
9431
+ onReachScrollThreshold: handleOutcomesScrollThreshold
9432
+ });
9299
9433
  const shouldUseNativeLinkNavigation3 = (eventToHandle) => {
9300
9434
  return eventToHandle.metaKey || eventToHandle.ctrlKey || eventToHandle.shiftKey || eventToHandle.altKey || eventToHandle.button === 1;
9301
9435
  };
@@ -9347,29 +9481,9 @@ var EventListItemContent = ({
9347
9481
  onEventClick == null ? void 0 : onEventClick(event);
9348
9482
  }
9349
9483
  };
9350
- const handleOutcomesScroll = (0, import_react14.useCallback)(
9351
- (eventToHandle) => {
9352
- if (!shouldEnableLazyMarketLoading) return;
9353
- const element = eventToHandle.currentTarget;
9354
- const distanceToBottom = element.scrollHeight - element.scrollTop - element.clientHeight;
9355
- if (distanceToBottom > OUTCOMES_SCROLL_LOAD_THRESHOLD_PX) return;
9356
- if (!isLazyMarketsQueryEnabled) {
9357
- setIsLazyMarketsQueryEnabled(true);
9358
- return;
9359
- }
9360
- if (!hasNextLazyMarketsPage) return;
9361
- if (isLoadingLazyMarkets || isFetchingNextLazyMarketsPage) return;
9362
- void fetchNextLazyMarketsPage();
9363
- },
9364
- [
9365
- fetchNextLazyMarketsPage,
9366
- hasNextLazyMarketsPage,
9367
- isFetchingNextLazyMarketsPage,
9368
- isLazyMarketsQueryEnabled,
9369
- isLoadingLazyMarkets,
9370
- shouldEnableLazyMarketLoading
9371
- ]
9372
- );
9484
+ (0, import_react14.useEffect)(() => {
9485
+ updateScrollState();
9486
+ }, [comparison.rows.length, shouldRenderLoadingOutcomeRow, updateScrollState]);
9373
9487
  const renderArbitrage = (value) => {
9374
9488
  if (value == null) return null;
9375
9489
  if (Math.abs(value) < config.market.arbitrageThreshold) return null;
@@ -9554,69 +9668,94 @@ var EventListItemContent = ({
9554
9668
  ) }) : null
9555
9669
  ] }) })
9556
9670
  ] }),
9557
- /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)(
9558
- "div",
9559
- {
9560
- className: cn(
9561
- "agg-outcomes flex max-h-[76px] flex-col gap-4 overflow-y-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
9562
- classNames == null ? void 0 : classNames.outcomes
9563
- ),
9564
- onScroll: handleOutcomesScroll,
9565
- children: [
9566
- comparison.rows.map((row) => {
9567
- var _a2;
9568
- const arbitragePercent = (_a2 = arbitrageByOutcomeId == null ? void 0 : arbitrageByOutcomeId[row.outcome.id]) != null ? _a2 : arbitrageByOutcomeId == null ? void 0 : arbitrageByOutcomeId[row.market.id];
9569
- const arbReturn = arbReturnByVenueMarketId.get(row.market.id);
9570
- const priceGapPercent = arbReturn == null ? gapsByVenueMarketId.get(row.market.id) : arbReturn;
9571
- const priceGapSource = arbReturn == null ? "percent" : "fraction";
9572
- return /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)(
9573
- "div",
9574
- {
9575
- className: cn(
9576
- "agg-outcome-row",
9577
- "flex h-10 w-full flex-row items-center justify-between gap-3",
9578
- classNames == null ? void 0 : classNames.outcomeRow
9579
- ),
9580
- children: [
9581
- /* @__PURE__ */ (0, import_jsx_runtime127.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_runtime127.jsx)(
9582
- Typography,
9583
- {
9584
- variant: "body",
9585
- className: "agg-outcome-label min-w-0 truncate text-agg-xs leading-agg-5 md:text-agg-base md:leading-agg-6",
9586
- children: row.label
9587
- }
9588
- ) }),
9589
- /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)("div", { className: "agg-outcome-meta flex shrink-0 flex-row items-center justify-end gap-2", children: [
9590
- renderArbitrage(arbitragePercent),
9591
- renderPriceGapPill(priceGapPercent, priceGapSource),
9592
- /* @__PURE__ */ (0, import_jsx_runtime127.jsx)("div", { className: "agg-outcome-price-strip relative flex shrink-0 items-center justify-end", children: isAwaitingMidpoints ? renderPriceStripSkeleton(row.prices.length) : row.prices.map(
9593
- (price, priceIndex) => renderComparisonPriceBadge(row, price, priceIndex)
9594
- ) })
9595
- ] })
9596
- ]
9597
- },
9598
- row.id
9599
- );
9600
- }),
9601
- shouldRenderLoadingOutcomeRow ? /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)("div", { className: "agg-outcome-row-loading flex w-full items-center justify-between gap-3", children: [
9602
- /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
9603
- "div",
9604
- {
9605
- "aria-hidden": "true",
9606
- className: "bg-agg-separator animate-pulse h-5 rounded-agg-sm w-[200px]"
9607
- }
9608
- ),
9609
- /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
9610
- "div",
9611
- {
9612
- "aria-hidden": "true",
9613
- className: "bg-agg-separator animate-pulse h-9 w-[100px] rounded-agg-full"
9614
- }
9615
- )
9616
- ] }) : null
9617
- ]
9618
- }
9619
- ),
9671
+ /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)("div", { className: "relative w-full", children: [
9672
+ /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)(
9673
+ "div",
9674
+ {
9675
+ ref: outcomesContainerRef,
9676
+ className: cn(
9677
+ "agg-outcomes flex max-h-[76px] flex-col gap-4 overflow-y-auto rounded-agg-md [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
9678
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-2 focus-visible:ring-offset-agg-secondary",
9679
+ classNames == null ? void 0 : classNames.outcomes
9680
+ ),
9681
+ "aria-label": labels.marketDetails.marketOutcomesAria,
9682
+ tabIndex: 0,
9683
+ children: [
9684
+ comparison.rows.map((row) => {
9685
+ var _a2;
9686
+ const arbitragePercent = (_a2 = arbitrageByOutcomeId == null ? void 0 : arbitrageByOutcomeId[row.outcome.id]) != null ? _a2 : arbitrageByOutcomeId == null ? void 0 : arbitrageByOutcomeId[row.market.id];
9687
+ const arbReturn = arbReturnByVenueMarketId.get(row.market.id);
9688
+ const priceGapPercent = arbReturn == null ? gapsByVenueMarketId.get(row.market.id) : arbReturn;
9689
+ const priceGapSource = arbReturn == null ? "percent" : "fraction";
9690
+ return /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)(
9691
+ "div",
9692
+ {
9693
+ className: cn(
9694
+ "agg-outcome-row",
9695
+ "flex h-10 w-full flex-row items-center justify-between gap-3",
9696
+ classNames == null ? void 0 : classNames.outcomeRow
9697
+ ),
9698
+ children: [
9699
+ /* @__PURE__ */ (0, import_jsx_runtime127.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_runtime127.jsx)(
9700
+ Typography,
9701
+ {
9702
+ variant: "body",
9703
+ className: "agg-outcome-label min-w-0 truncate text-agg-xs leading-agg-5 md:text-agg-base md:leading-agg-6",
9704
+ children: row.label
9705
+ }
9706
+ ) }),
9707
+ /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)("div", { className: "agg-outcome-meta flex shrink-0 flex-row items-center justify-end gap-2", children: [
9708
+ renderArbitrage(arbitragePercent),
9709
+ renderPriceGapPill(priceGapPercent, priceGapSource),
9710
+ /* @__PURE__ */ (0, import_jsx_runtime127.jsx)("div", { className: "agg-outcome-price-strip relative flex shrink-0 items-center justify-end", children: isAwaitingMidpoints ? renderPriceStripSkeleton(row.prices.length) : row.prices.map(
9711
+ (price, priceIndex) => renderComparisonPriceBadge(row, price, priceIndex)
9712
+ ) })
9713
+ ] })
9714
+ ]
9715
+ },
9716
+ row.id
9717
+ );
9718
+ }),
9719
+ shouldRenderLoadingOutcomeRow ? /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)("div", { className: "agg-outcome-row-loading flex w-full items-center justify-between gap-3", children: [
9720
+ /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
9721
+ "div",
9722
+ {
9723
+ "aria-hidden": "true",
9724
+ className: "bg-agg-separator animate-pulse h-5 rounded-agg-sm w-[200px]"
9725
+ }
9726
+ ),
9727
+ /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
9728
+ "div",
9729
+ {
9730
+ "aria-hidden": "true",
9731
+ className: "bg-agg-separator animate-pulse h-9 w-[100px] rounded-agg-full"
9732
+ }
9733
+ )
9734
+ ] }) : null
9735
+ ]
9736
+ }
9737
+ ),
9738
+ /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
9739
+ "div",
9740
+ {
9741
+ className: cn(
9742
+ "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",
9743
+ outcomesScrollState.hasOverflow && !outcomesScrollState.isAtTop ? "opacity-100" : "opacity-0"
9744
+ ),
9745
+ style: { height: OUTCOMES_SCROLL_MASK_HEIGHT_PX }
9746
+ }
9747
+ ),
9748
+ /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
9749
+ "div",
9750
+ {
9751
+ className: cn(
9752
+ "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",
9753
+ outcomesScrollState.hasOverflow && !outcomesScrollState.isAtBottom ? "opacity-100" : "opacity-0"
9754
+ ),
9755
+ style: { height: OUTCOMES_SCROLL_MASK_HEIGHT_PX }
9756
+ }
9757
+ )
9758
+ ] }),
9620
9759
  /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)(
9621
9760
  "div",
9622
9761
  {
@@ -9634,6 +9773,14 @@ var EventListItemContent = ({
9634
9773
  "agg-event-meta flex min-w-0 flex-1 items-center gap-2 text-agg-sm leading-agg-5 truncate"
9635
9774
  ),
9636
9775
  children: [
9776
+ outcomesScrollState.remainingMarkets > 0 ? /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
9777
+ Typography,
9778
+ {
9779
+ variant: "body",
9780
+ className: "agg-event-remaining-markets shrink-0 text-agg-sm leading-agg-5 text-agg-muted-foreground",
9781
+ children: labels.eventItem.remainingMarkets(outcomesScrollState.remainingMarkets)
9782
+ }
9783
+ ) : null,
9637
9784
  shouldShowMatchedVenueSummary ? /* @__PURE__ */ (0, import_jsx_runtime127.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,
9638
9785
  singleFooterVenue ? /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)("span", { className: "agg-event-single-venue flex min-w-0 items-center gap-1 overflow-hidden", children: [
9639
9786
  /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
@@ -9728,7 +9875,7 @@ EventListItemV2.displayName = "EventListItemV2";
9728
9875
 
9729
9876
  // src/events/list/index.tsx
9730
9877
  var import_hooks37 = require("@agg-build/hooks");
9731
- var import_sdk13 = require("@agg-build/sdk");
9878
+ var import_sdk14 = require("@agg-build/sdk");
9732
9879
  var Dialog2 = __toESM(require("@radix-ui/react-dialog"));
9733
9880
  var import_react17 = require("react");
9734
9881
 
@@ -9851,6 +9998,7 @@ CategorySidebar.displayName = "CategorySidebar";
9851
9998
 
9852
9999
  // src/events/list/event-list-tabs.tsx
9853
10000
  var import_hooks36 = require("@agg-build/hooks");
10001
+ var import_sdk13 = require("@agg-build/sdk");
9854
10002
  var import_react16 = require("react");
9855
10003
 
9856
10004
  // src/events/list/event-list.constants.ts
@@ -9875,12 +10023,6 @@ var getDefaultEventListTabs = (labels) => {
9875
10023
  venueLogo: import_sdk12.Venue.polymarket,
9876
10024
  venues: [import_sdk12.Venue.polymarket]
9877
10025
  },
9878
- {
9879
- value: import_sdk12.Venue.kalshi,
9880
- label: labels.venues.kalshi,
9881
- venueLogo: import_sdk12.Venue.kalshi,
9882
- venues: [import_sdk12.Venue.kalshi]
9883
- },
9884
10026
  {
9885
10027
  value: import_sdk12.Venue.limitless,
9886
10028
  label: labels.venues.limitless,
@@ -9944,6 +10086,7 @@ var useEventListTabs = (tabs) => {
9944
10086
  const baseTabs = tabs != null ? tabs : getDefaultEventListTabs(labels);
9945
10087
  return baseTabs.flatMap((tab) => {
9946
10088
  if (!tab.venueLogo) return [tab];
10089
+ if (!(0, import_sdk13.isVenueActive)(tab.venueLogo)) return [];
9947
10090
  const availabilityState = (0, import_hooks36.getVenueAvailabilityState)({
9948
10091
  venueId: tab.venueLogo,
9949
10092
  disabledVenues,
@@ -10136,7 +10279,7 @@ var EventList = ({
10136
10279
  const isDiscoveryFiltersEnabled = enableVenueEventDiscoveryFilters && !search;
10137
10280
  const resolvedTabs = useEventListTabs();
10138
10281
  const visibleVenues = (0, import_react17.useMemo)(
10139
- () => disabledVenues.length === 0 ? void 0 : (0, import_hooks37.getVisibleVenueIdsByConfig)(import_sdk13.VENUES, disabledVenues),
10282
+ () => disabledVenues.length === 0 ? void 0 : (0, import_hooks37.getVisibleVenueIdsByConfig)(import_sdk14.VENUES, disabledVenues),
10140
10283
  [disabledVenues]
10141
10284
  );
10142
10285
  const [activeTabValue, setActiveTabValue] = (0, import_react17.useState)(
@@ -10712,7 +10855,7 @@ ChartTypeSwitch.displayName = "ChartTypeSwitch";
10712
10855
  var import_hooks39 = require("@agg-build/hooks");
10713
10856
 
10714
10857
  // src/events/market-details/market-details.utils.ts
10715
- var import_sdk15 = require("@agg-build/sdk");
10858
+ var import_sdk16 = require("@agg-build/sdk");
10716
10859
  var import_dayjs5 = __toESM(require("dayjs"));
10717
10860
 
10718
10861
  // src/events/item-details/event-list-item-details.utils.ts
@@ -11058,7 +11201,7 @@ var resolveMarketChartLiveState = ({
11058
11201
  };
11059
11202
 
11060
11203
  // src/events/orderbook/orderbook.utils.ts
11061
- var import_sdk14 = require("@agg-build/sdk");
11204
+ var import_sdk15 = require("@agg-build/sdk");
11062
11205
  var formatProbabilityCents = (value) => {
11063
11206
  if (value == null) return "-";
11064
11207
  const cents = (value * 100).toFixed(1).replace(/\.0$/, "");
@@ -11114,7 +11257,7 @@ var hasBinaryLabels = (labels) => {
11114
11257
  return normalizedLabels.includes("yes") && normalizedLabels.includes("no");
11115
11258
  };
11116
11259
  var resolveInitialTab = (defaultTab) => {
11117
- const parsedTab = (0, import_sdk15.safeParse)(defaultTab, isMarketDetailsTab);
11260
+ const parsedTab = (0, import_sdk16.safeParse)(defaultTab, isMarketDetailsTab);
11118
11261
  if (parsedTab.success) return parsedTab.data;
11119
11262
  return "order-book";
11120
11263
  };
@@ -12489,13 +12632,6 @@ var parseSettlementBlocks = (input) => {
12489
12632
  }
12490
12633
  return blocks;
12491
12634
  };
12492
- var getFirstSettlementParagraph = (input) => {
12493
- if (!input) return "";
12494
- const blocks = parseSettlementBlocks(input);
12495
- const firstParagraph = blocks.find((block) => block.kind === "paragraph");
12496
- if (!firstParagraph || firstParagraph.kind !== "paragraph") return "";
12497
- return firstParagraph.lines.join(" ").trim();
12498
- };
12499
12635
  var normalizeSettlementForCompare = (input) => {
12500
12636
  return stripHtmlFragments(input).replace(/\s+/g, " ").trim().toLowerCase();
12501
12637
  };
@@ -12664,8 +12800,204 @@ SettlementTextRenderer.displayName = "SettlementTextRenderer";
12664
12800
  // src/trading/settlement/index.tsx
12665
12801
  var import_jsx_runtime134 = require("react/jsx-runtime");
12666
12802
  var SETTLEMENT_SECTION_ID = "agg-settlement-section";
12667
- var getSettlementHeaderClassName = () => {
12668
- return "flex items-center justify-between gap-4";
12803
+ var getSettlementDifferenceId = (sectionId, canonicalKey) => {
12804
+ return `${sectionId}-difference-${canonicalKey}`;
12805
+ };
12806
+ var dateOnlyRegex = /^(\d{4})-(\d{2})-(\d{2})$/;
12807
+ var isoTimestampWithTimezoneRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(?::\d{2}(?:\.\d{1,9})?)?(?:Z|[+-]\d{2}:?\d{2})$/i;
12808
+ var normalizeDifferenceText = (value) => {
12809
+ return value.trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
12810
+ };
12811
+ var resolveCanonicalDifferenceKey = (difference) => {
12812
+ const normalizedType = normalizeDifferenceText(difference.type);
12813
+ const combined = normalizeDifferenceText(`${difference.type} ${difference.title}`);
12814
+ if (combined.includes("start_date") || combined.includes("open_date")) return "start_date";
12815
+ if (combined.includes("end_date") || combined.includes("close_date") || combined.includes("closing_date") || combined.includes("expiration_date") || combined.includes("expiry_date")) {
12816
+ return "end_date";
12817
+ }
12818
+ 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")) {
12819
+ return "resolution_timing";
12820
+ }
12821
+ return normalizedType || "other";
12822
+ };
12823
+ var parseSettlementDateMs = (value) => {
12824
+ const trimmed = value.trim();
12825
+ const dateOnlyMatch = dateOnlyRegex.exec(trimmed);
12826
+ if (dateOnlyMatch) {
12827
+ const [, year, month, day] = dateOnlyMatch;
12828
+ return Date.UTC(Number(year), Number(month) - 1, Number(day));
12829
+ }
12830
+ if (!isoTimestampWithTimezoneRegex.test(trimmed)) return null;
12831
+ const ms = Date.parse(trimmed);
12832
+ return Number.isNaN(ms) ? null : ms;
12833
+ };
12834
+ var isDateLikeDifference = (canonicalKey) => {
12835
+ return canonicalKey === "resolution_timing" || canonicalKey === "start_date" || canonicalKey === "end_date";
12836
+ };
12837
+ var hasEqualNormalizedDateValues = (difference, canonicalKey) => {
12838
+ if (!isDateLikeDifference(canonicalKey)) return false;
12839
+ const values = Object.values(difference.perVenue);
12840
+ if (values.length < 2) return false;
12841
+ const timestamps = values.map(parseSettlementDateMs);
12842
+ if (timestamps.some((timestamp) => timestamp === null)) return false;
12843
+ return new Set(timestamps).size === 1;
12844
+ };
12845
+ var resolveDifferenceSeverity = (difference, canonicalKey) => {
12846
+ var _a;
12847
+ const combined = normalizeDifferenceText(
12848
+ `${difference.type} ${difference.title} ${(_a = difference.summary) != null ? _a : ""}`
12849
+ );
12850
+ if (isDateLikeDifference(canonicalKey)) return "critical";
12851
+ if (canonicalKey === "scope" || canonicalKey === "threshold" || canonicalKey === "edge_cases") {
12852
+ return "critical";
12853
+ }
12854
+ if (combined.includes("conflict") || combined.includes("void") || combined.includes("cancel") || combined.includes("postpone") || combined.includes("recount") || combined.includes("overtime") || combined.includes("extra_time")) {
12855
+ return "critical";
12856
+ }
12857
+ return "informational";
12858
+ };
12859
+ var mergePerVenueValues = (current, next) => {
12860
+ return Object.entries(next).reduce(
12861
+ (merged, [venue, value]) => {
12862
+ if (merged[venue] === void 0) merged[venue] = value;
12863
+ return merged;
12864
+ },
12865
+ __spreadValues({}, current)
12866
+ );
12867
+ };
12868
+ var prepareSettlementDifferences = (differences) => {
12869
+ const byCanonicalKey = /* @__PURE__ */ new Map();
12870
+ for (const [originalIndex, rawDifference] of (differences != null ? differences : []).entries()) {
12871
+ const title2 = rawDifference.title.trim();
12872
+ const perVenue = Object.fromEntries(
12873
+ Object.entries(rawDifference.perVenue).map(([venue, value]) => [venue.trim(), value.trim()]).filter(([venue, value]) => venue.length > 0 && value.length > 0)
12874
+ );
12875
+ if (!title2 || Object.keys(perVenue).length === 0) continue;
12876
+ const difference = __spreadProps(__spreadValues({}, rawDifference), { title: title2, perVenue });
12877
+ const canonicalKey = resolveCanonicalDifferenceKey(difference);
12878
+ if (hasEqualNormalizedDateValues(difference, canonicalKey)) continue;
12879
+ const existing = byCanonicalKey.get(canonicalKey);
12880
+ if (existing) {
12881
+ byCanonicalKey.set(canonicalKey, __spreadProps(__spreadValues({}, existing), {
12882
+ perVenue: mergePerVenueValues(existing.perVenue, difference.perVenue)
12883
+ }));
12884
+ continue;
12885
+ }
12886
+ byCanonicalKey.set(canonicalKey, __spreadProps(__spreadValues({}, difference), {
12887
+ canonicalKey,
12888
+ severity: resolveDifferenceSeverity(difference, canonicalKey),
12889
+ originalIndex
12890
+ }));
12891
+ }
12892
+ return Array.from(byCanonicalKey.values()).sort((left, right) => {
12893
+ const severityDelta = Number(right.severity === "critical") - Number(left.severity === "critical");
12894
+ if (severityDelta !== 0) return severityDelta;
12895
+ return left.originalIndex - right.originalIndex;
12896
+ });
12897
+ };
12898
+ var formatVenueFallbackLabel = (venue) => {
12899
+ return venue.split(/[-_\s]+/).filter(Boolean).map((part) => `${part.slice(0, 1).toUpperCase()}${part.slice(1)}`).join(" ");
12900
+ };
12901
+ var resolveSettlementVenueLabel = (venue, labels) => {
12902
+ var _a;
12903
+ return (_a = labels.venues[venue]) != null ? _a : formatVenueFallbackLabel(venue);
12904
+ };
12905
+ var resolveDifferenceVenueKeys = (difference, settlementVenues) => {
12906
+ const explicitVenues = Object.keys(difference.perVenue);
12907
+ if (!isDateLikeDifference(difference.canonicalKey)) return explicitVenues;
12908
+ const allVenues = [...settlementVenues != null ? settlementVenues : [], ...explicitVenues];
12909
+ return Array.from(new Set(allVenues.filter((venue) => venue.trim().length > 0)));
12910
+ };
12911
+ var resolveDifferenceIconClassName = (canonicalKey) => {
12912
+ if (canonicalKey.includes("source") || canonicalKey.includes("url")) return "fi-rr-world";
12913
+ if (canonicalKey === "resolution_timing" || canonicalKey.includes("timing")) {
12914
+ return "fi-rr-clock";
12915
+ }
12916
+ if (canonicalKey === "start_date" || canonicalKey.includes("start"))
12917
+ return "fi-rr-calendar-clock";
12918
+ if (canonicalKey === "end_date" || canonicalKey.includes("end")) return "fi-rr-calendar-clock";
12919
+ if (canonicalKey.includes("cancel") || canonicalKey.includes("void") || canonicalKey.includes("postpone")) {
12920
+ return "fi-rr-ban";
12921
+ }
12922
+ if (canonicalKey === "edge_cases" || canonicalKey.includes("edge")) {
12923
+ return "fi-rr-triangle-warning";
12924
+ }
12925
+ if (canonicalKey === "scope") return "fi-rr-layers";
12926
+ if (canonicalKey === "threshold") return "fi-rr-tachometer-alt-fastest";
12927
+ if (canonicalKey.includes("wording")) return "fi-rr-document";
12928
+ return "fi-rr-info";
12929
+ };
12930
+ var buildSettlementVenueRules = ({
12931
+ marketBlock,
12932
+ primaryRulesBlock,
12933
+ settlementVenues,
12934
+ settlementVenueRules
12935
+ }) => {
12936
+ var _a, _b;
12937
+ if (settlementVenueRules) {
12938
+ const rulesByVenue = /* @__PURE__ */ new Map();
12939
+ for (const rule of settlementVenueRules) {
12940
+ const venue2 = rule.venue.trim();
12941
+ const content2 = rule.content.trim();
12942
+ if (!venue2 || !content2) continue;
12943
+ const venueRules = (_a = rulesByVenue.get(venue2)) != null ? _a : [];
12944
+ if (!venueRules.includes(content2)) venueRules.push(content2);
12945
+ rulesByVenue.set(venue2, venueRules);
12946
+ }
12947
+ return Array.from(rulesByVenue, ([venue2, contents]) => ({
12948
+ venue: venue2,
12949
+ content: contents.join("\n\n")
12950
+ }));
12951
+ }
12952
+ 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");
12953
+ const venue = (_b = settlementVenues == null ? void 0 : settlementVenues.find((candidate) => candidate.trim().length > 0)) == null ? void 0 : _b.trim();
12954
+ return content && venue ? [{ venue, content }] : [];
12955
+ };
12956
+ var isDuplicatedByVenueRules = (content, venueRules) => {
12957
+ const normalizedContent = normalizeSettlementForCompare(content);
12958
+ if (!normalizedContent) return false;
12959
+ return venueRules.some((rule) => {
12960
+ const normalizedRule = normalizeSettlementForCompare(rule.content);
12961
+ return normalizedRule.includes(normalizedContent);
12962
+ });
12963
+ };
12964
+ var SettlementVenueRules = ({
12965
+ rules,
12966
+ labels
12967
+ }) => {
12968
+ return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "agg-settlement-venue-rules flex w-full flex-col items-start gap-4", children: [
12969
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: labels.trading.settlementFullRulesTitle }),
12970
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { className: "flex w-full flex-col items-start gap-4", children: rules.map((rule) => {
12971
+ const venueLabel = resolveSettlementVenueLabel(rule.venue, labels);
12972
+ return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("details", { className: "group/agg-settlement-rule w-full", children: [
12973
+ /* @__PURE__ */ (0, import_jsx_runtime134.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: [
12974
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
12975
+ VenueLogo,
12976
+ {
12977
+ venue: rule.venue,
12978
+ size: "small",
12979
+ className: "size-4",
12980
+ ariaLabel: venueLabel
12981
+ }
12982
+ ),
12983
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("span", { className: "text-agg-foreground group-hover/agg-settlement-rule:text-agg-muted-foreground transition-colors", children: venueLabel }),
12984
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
12985
+ "i",
12986
+ {
12987
+ className: cn(
12988
+ "fi fi-rr-angle-small-down text-[14px]!",
12989
+ "group-open/agg-settlement-rule:rotate-180",
12990
+ "size-3.5! shrink-0 text-agg-foreground group-hover/agg-settlement-rule:text-agg-muted-foreground transition-[colors,transform]"
12991
+ ),
12992
+ style: { fontSize: 14 },
12993
+ "aria-hidden": "true"
12994
+ }
12995
+ )
12996
+ ] }),
12997
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { className: "mt-3 pl-6", children: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(SettlementTextRenderer, { content: rule.content }) })
12998
+ ] }, rule.venue);
12999
+ }) })
13000
+ ] });
12669
13001
  };
12670
13002
  var Settlement = ({
12671
13003
  className,
@@ -12675,9 +13007,12 @@ var Settlement = ({
12675
13007
  eventDescription,
12676
13008
  marketDescription,
12677
13009
  primaryRules,
13010
+ settlementDiff,
13011
+ settlementVenues,
13012
+ settlementVenueRules,
12678
13013
  isLoading = false
12679
13014
  }) => {
12680
- var _a, _b, _c;
13015
+ var _a, _b, _c, _d, _e;
12681
13016
  const labels = (0, import_hooks44.useLabels)();
12682
13017
  const blocks = (0, import_react21.useMemo)(
12683
13018
  () => dedupeSettlementSources({
@@ -12687,9 +13022,41 @@ var Settlement = ({
12687
13022
  }),
12688
13023
  [eventDescription, marketDescription, primaryRules]
12689
13024
  );
13025
+ const settlementDifferences = (0, import_react21.useMemo)(
13026
+ () => prepareSettlementDifferences(settlementDiff == null ? void 0 : settlementDiff.differences),
13027
+ [settlementDiff == null ? void 0 : settlementDiff.differences]
13028
+ );
12690
13029
  const eventBlock = (_a = blocks.find((block) => block.key === "eventDescription")) != null ? _a : null;
12691
13030
  const marketBlock = (_b = blocks.find((block) => block.key === "marketDescription")) != null ? _b : null;
12692
13031
  const primaryRulesBlock = (_c = blocks.find((block) => block.key === "primaryRules")) != null ? _c : null;
13032
+ const venueRuleBlocks = (0, import_react21.useMemo)(
13033
+ () => buildSettlementVenueRules({
13034
+ marketBlock,
13035
+ primaryRulesBlock,
13036
+ settlementVenues,
13037
+ settlementVenueRules
13038
+ }),
13039
+ [marketBlock, primaryRulesBlock, settlementVenues, settlementVenueRules]
13040
+ );
13041
+ const hasSettlementDifferences = settlementDifferences.length > 0;
13042
+ const hasVenueSettlementRules = venueRuleBlocks.length > 0;
13043
+ const standaloneEventBlock = eventBlock && !isDuplicatedByVenueRules(eventBlock.content, venueRuleBlocks) ? eventBlock : null;
13044
+ const standaloneMarketBlock = hasVenueSettlementRules ? null : marketBlock;
13045
+ const standalonePrimaryRulesBlock = hasVenueSettlementRules ? null : primaryRulesBlock;
13046
+ const hasStandaloneSettlementText = hasVenueSettlementRules ? standaloneEventBlock !== null : blocks.length > 0;
13047
+ const hasSettlementContent = hasSettlementDifferences || hasVenueSettlementRules || hasStandaloneSettlementText;
13048
+ const defaultOpenDifferenceKey = (_e = (_d = settlementDifferences[0]) == null ? void 0 : _d.canonicalKey) != null ? _e : null;
13049
+ const [openDifferenceKeys, setOpenDifferenceKeys] = (0, import_react21.useState)(
13050
+ () => defaultOpenDifferenceKey ? [defaultOpenDifferenceKey] : []
13051
+ );
13052
+ (0, import_react21.useEffect)(() => {
13053
+ setOpenDifferenceKeys(defaultOpenDifferenceKey ? [defaultOpenDifferenceKey] : []);
13054
+ }, [defaultOpenDifferenceKey]);
13055
+ const handleToggleDifference = (canonicalKey) => {
13056
+ setOpenDifferenceKeys(
13057
+ (currentKeys) => currentKeys.includes(canonicalKey) ? currentKeys.filter((currentKey) => currentKey !== canonicalKey) : [...currentKeys, canonicalKey]
13058
+ );
13059
+ };
12693
13060
  if (isLoading) {
12694
13061
  return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
12695
13062
  Skeleton,
@@ -12700,6 +13067,7 @@ var Settlement = ({
12700
13067
  }
12701
13068
  );
12702
13069
  }
13070
+ if (!hasSettlementContent) return null;
12703
13071
  const resolvedSectionLabel = sectionLabel === defaultSettlementSectionLabel ? labels.trading.settlementSection : sectionLabel;
12704
13072
  return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(
12705
13073
  Card,
@@ -12707,38 +13075,117 @@ var Settlement = ({
12707
13075
  id,
12708
13076
  className: cn(
12709
13077
  "group/agg-settlement-card",
12710
- "flex flex-col w-full gap-5 rounded-agg-xl border border-agg-separator bg-agg-secondary p-5 shadow-none hover:shadow-none",
13078
+ "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",
12711
13079
  className
12712
13080
  ),
12713
13081
  children: [
12714
- /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: cn("agg-settlement-header", getSettlementHeaderClassName()), children: [
12715
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("p", { className: "text-agg-xs font-agg-bold leading-agg-4 uppercase text-agg-muted-foreground", children: resolvedSectionLabel }),
12716
- question ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("p", { className: "agg-settlement-question text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: question }) : null
13082
+ /* @__PURE__ */ (0, import_jsx_runtime134.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: [
13083
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("p", { className: "shrink-0 text-agg-xs font-agg-bold leading-agg-4 uppercase", children: resolvedSectionLabel }),
13084
+ question ? /* @__PURE__ */ (0, import_jsx_runtime134.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
12717
13085
  ] }),
12718
- blocks.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("p", { className: "agg-settlement-empty text-agg-sm leading-agg-5 text-agg-muted-foreground", children: labels.trading.settlementEmpty }) : /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "agg-settlement-sections flex flex-col gap-4", children: [
12719
- eventBlock || marketBlock ? /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(
12720
- "div",
12721
- {
12722
- className: "agg-settlement-section agg-settlement-section-description",
12723
- "data-source": "description",
12724
- children: [
12725
- eventBlock ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { "data-source": "eventDescription", children: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(SettlementTextRenderer, { content: eventBlock.content }) }) : null,
12726
- eventBlock && marketBlock ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("hr", { className: "agg-settlement-divider my-4 border-0 border-t border-agg-separator" }) : null,
12727
- marketBlock ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { "data-source": "marketDescription", children: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(SettlementTextRenderer, { content: marketBlock.content }) }) : null
12728
- ]
12729
- }
12730
- ) : null,
12731
- primaryRulesBlock ? /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(
12732
- "div",
12733
- {
12734
- className: "agg-settlement-section agg-settlement-section-primaryRules",
12735
- "data-source": "primaryRules",
12736
- children: [
12737
- /* @__PURE__ */ (0, import_jsx_runtime134.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 }),
12738
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(SettlementTextRenderer, { content: primaryRulesBlock.content })
12739
- ]
12740
- }
12741
- ) : null
13086
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "agg-settlement-sections flex w-full flex-col items-start gap-5", children: [
13087
+ hasStandaloneSettlementText ? /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "w-full", children: [
13088
+ standaloneEventBlock || standaloneMarketBlock ? /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(
13089
+ "div",
13090
+ {
13091
+ className: "agg-settlement-section agg-settlement-section-description",
13092
+ "data-source": "description",
13093
+ children: [
13094
+ standaloneEventBlock ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { "data-source": "eventDescription", children: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(SettlementTextRenderer, { content: standaloneEventBlock.content }) }) : null,
13095
+ standaloneEventBlock && standaloneMarketBlock ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("hr", { className: "agg-settlement-divider my-4 border-0 border-t border-agg-separator" }) : null,
13096
+ standaloneMarketBlock ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { "data-source": "marketDescription", children: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(SettlementTextRenderer, { content: standaloneMarketBlock.content }) }) : null
13097
+ ]
13098
+ }
13099
+ ) : null,
13100
+ standalonePrimaryRulesBlock ? /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(
13101
+ "div",
13102
+ {
13103
+ className: "agg-settlement-section agg-settlement-section-primaryRules",
13104
+ "data-source": "primaryRules",
13105
+ children: [
13106
+ /* @__PURE__ */ (0, import_jsx_runtime134.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 }),
13107
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(SettlementTextRenderer, { content: standalonePrimaryRulesBlock.content })
13108
+ ]
13109
+ }
13110
+ ) : null
13111
+ ] }) : null,
13112
+ hasSettlementDifferences ? /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "agg-settlement-differences flex w-full flex-col items-start gap-5", children: [
13113
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "flex items-center gap-2", children: [
13114
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: labels.trading.settlementDifferencesTitle }),
13115
+ /* @__PURE__ */ (0, import_jsx_runtime134.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 })
13116
+ ] }),
13117
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { className: "flex w-full flex-col items-start gap-5", children: settlementDifferences.map((difference) => {
13118
+ const venueKeys = resolveDifferenceVenueKeys(difference, settlementVenues);
13119
+ const isExpanded = openDifferenceKeys.includes(difference.canonicalKey) && venueKeys.length > 0;
13120
+ return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(
13121
+ "div",
13122
+ {
13123
+ id: getSettlementDifferenceId(id, difference.canonicalKey),
13124
+ className: "agg-settlement-difference flex w-full flex-col items-start gap-2 rounded-agg-lg",
13125
+ children: [
13126
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(
13127
+ "button",
13128
+ {
13129
+ type: "button",
13130
+ className: "flex w-full cursor-pointer items-center gap-2 text-left group/agg-settlement-difference",
13131
+ "aria-expanded": isExpanded,
13132
+ onClick: () => handleToggleDifference(difference.canonicalKey),
13133
+ children: [
13134
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
13135
+ "i",
13136
+ {
13137
+ className: cn(
13138
+ "fi",
13139
+ resolveDifferenceIconClassName(difference.canonicalKey),
13140
+ "inline-flex size-4! shrink-0 items-center justify-center text-[16px] leading-none text-agg-muted-foreground"
13141
+ ),
13142
+ "aria-hidden": "true"
13143
+ }
13144
+ ),
13145
+ /* @__PURE__ */ (0, import_jsx_runtime134.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 }),
13146
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
13147
+ "i",
13148
+ {
13149
+ className: cn(
13150
+ "fi fi-rr-angle-small-down text-[14px]!",
13151
+ isExpanded && "rotate-180",
13152
+ "size-3.5! shrink-0 text-agg-foreground group-hover/agg-settlement-difference:text-agg-muted-foreground transition-[colors,transform]"
13153
+ ),
13154
+ style: { fontSize: 14 },
13155
+ "aria-hidden": "true"
13156
+ }
13157
+ )
13158
+ ]
13159
+ }
13160
+ ),
13161
+ isExpanded ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("dl", { className: "flex w-full flex-col items-start gap-1 px-6", children: venueKeys.map((venue) => {
13162
+ var _a2;
13163
+ const venueValue = (_a2 = difference.perVenue[venue]) != null ? _a2 : labels.trading.settlementValueUnavailable;
13164
+ const venueLabel = resolveSettlementVenueLabel(venue, labels);
13165
+ return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "flex w-full items-start gap-2", children: [
13166
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
13167
+ VenueLogo,
13168
+ {
13169
+ venue,
13170
+ size: "small",
13171
+ className: "mt-0.5 size-4",
13172
+ ariaLabel: venueLabel
13173
+ }
13174
+ ),
13175
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("dt", { className: "w-[88px] shrink-0 text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground", children: venueLabel }),
13176
+ /* @__PURE__ */ (0, import_jsx_runtime134.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 })
13177
+ ] }, venue);
13178
+ }) }) : null
13179
+ ]
13180
+ },
13181
+ difference.canonicalKey
13182
+ );
13183
+ }) })
13184
+ ] }) : null,
13185
+ hasVenueSettlementRules ? /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(import_jsx_runtime134.Fragment, { children: [
13186
+ hasSettlementDifferences || hasStandaloneSettlementText ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { className: "h-px w-full bg-agg-separator" }) : null,
13187
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(SettlementVenueRules, { rules: venueRuleBlocks, labels })
13188
+ ] }) : null
12742
13189
  ] })
12743
13190
  ]
12744
13191
  }
@@ -12749,13 +13196,16 @@ Settlement.displayName = "Settlement";
12749
13196
  // src/events/item-details/settlement-summary.tsx
12750
13197
  var import_jsx_runtime135 = require("react/jsx-runtime");
12751
13198
  var SettlementSummary = ({
12752
- content,
13199
+ settlementDiff,
12753
13200
  settlementSectionId = SETTLEMENT_SECTION_ID,
12754
13201
  className
12755
13202
  }) => {
12756
13203
  const labels = (0, import_hooks45.useLabels)();
12757
- const firstParagraph = (0, import_react22.useMemo)(() => getFirstSettlementParagraph(content), [content]);
12758
- if (!firstParagraph) return null;
13204
+ const settlementDifferences = (0, import_react22.useMemo)(
13205
+ () => prepareSettlementDifferences(settlementDiff == null ? void 0 : settlementDiff.differences),
13206
+ [settlementDiff == null ? void 0 : settlementDiff.differences]
13207
+ );
13208
+ if (settlementDifferences.length === 0) return null;
12759
13209
  const handleReadFullDetails = (event) => {
12760
13210
  event.preventDefault();
12761
13211
  event.stopPropagation();
@@ -12764,43 +13214,78 @@ var SettlementSummary = ({
12764
13214
  if (!target) return;
12765
13215
  target.scrollIntoView({ behavior: "smooth", block: "start" });
12766
13216
  };
12767
- return /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)("div", { className: cn("agg-settlement-summary flex w-full flex-col gap-2", className), children: [
12768
- /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
12769
- Typography,
12770
- {
12771
- variant: "caption-caps",
12772
- className: "agg-settlement-summary-label text-agg-muted-foreground",
12773
- children: labels.settlementSummary.title
12774
- }
12775
- ),
12776
- /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)("div", { className: "agg-settlement-summary-row flex w-full items-center gap-3", children: [
12777
- /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
12778
- "p",
12779
- {
12780
- className: cn(
12781
- "agg-settlement-summary-text",
12782
- "min-w-0 flex-1 truncate text-agg-sm leading-agg-5 text-agg-foreground"
12783
- ),
12784
- children: firstParagraph
12785
- }
13217
+ const actionButton = /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)(
13218
+ "button",
13219
+ {
13220
+ type: "button",
13221
+ className: cn(
13222
+ "agg-settlement-summary-toggle",
13223
+ "inline-flex shrink-0 cursor-pointer items-center gap-1 whitespace-nowrap text-agg-sm font-agg-bold leading-agg-5 text-agg-primary",
13224
+ "hover:opacity-80",
13225
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-0 focus-visible:ring-offset-agg-secondary"
12786
13226
  ),
12787
- /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
12788
- "button",
12789
- {
12790
- type: "button",
12791
- className: cn(
12792
- "agg-settlement-summary-toggle",
12793
- "shrink-0 cursor-pointer whitespace-nowrap text-agg-sm font-agg-bold leading-agg-5 text-agg-primary",
12794
- "hover:opacity-80",
12795
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-0 focus-visible:ring-offset-agg-secondary"
12796
- ),
12797
- "aria-controls": settlementSectionId,
12798
- onClick: handleReadFullDetails,
12799
- children: labels.settlementSummary.readFullDetails
12800
- }
12801
- )
12802
- ] })
12803
- ] });
13227
+ "aria-controls": settlementSectionId,
13228
+ onClick: handleReadFullDetails,
13229
+ children: [
13230
+ /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("span", { children: labels.settlementSummary.readFullDetails }),
13231
+ /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
13232
+ "i",
13233
+ {
13234
+ className: "fi fi-rr-arrow-small-down size-3.5!",
13235
+ "aria-hidden": "true",
13236
+ style: { fontSize: 14 }
13237
+ }
13238
+ )
13239
+ ]
13240
+ }
13241
+ );
13242
+ const visibleDifferences = settlementDifferences.slice(0, 2);
13243
+ const hiddenDifferenceCount = settlementDifferences.length - visibleDifferences.length;
13244
+ return /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)(
13245
+ "div",
13246
+ {
13247
+ className: cn(
13248
+ "agg-settlement-summary flex w-full flex-wrap items-start justify-between gap-x-4 gap-y-2",
13249
+ className
13250
+ ),
13251
+ children: [
13252
+ /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)("div", { className: "flex min-w-[240px] flex-1 flex-wrap items-center gap-x-5 gap-y-3", children: [
13253
+ /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)("div", { className: "agg-settlement-summary-heading flex shrink-0 items-center gap-2", children: [
13254
+ /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("p", { className: "text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground", children: labels.settlementSummary.title }),
13255
+ /* @__PURE__ */ (0, import_jsx_runtime135.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 })
13256
+ ] }),
13257
+ /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)("div", { className: "agg-settlement-summary-pills flex min-w-[240px] flex-1 flex-wrap items-center gap-2", children: [
13258
+ visibleDifferences.map((difference) => /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)(
13259
+ "span",
13260
+ {
13261
+ 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]",
13262
+ children: [
13263
+ /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
13264
+ "i",
13265
+ {
13266
+ className: cn(
13267
+ "fi",
13268
+ resolveDifferenceIconClassName(difference.canonicalKey),
13269
+ "inline-flex size-3 shrink-0 items-center justify-center text-[12px] leading-none text-agg-muted-foreground"
13270
+ ),
13271
+ "aria-hidden": "true"
13272
+ }
13273
+ ),
13274
+ /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("span", { className: "min-w-0 truncate", children: difference.title })
13275
+ ]
13276
+ },
13277
+ difference.canonicalKey
13278
+ )),
13279
+ hiddenDifferenceCount > 0 ? /* @__PURE__ */ (0, import_jsx_runtime135.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: [
13280
+ "+",
13281
+ hiddenDifferenceCount
13282
+ ] }) : null
13283
+ ] })
13284
+ ] }),
13285
+ actionButton
13286
+ ]
13287
+ }
13288
+ );
12804
13289
  };
12805
13290
  SettlementSummary.displayName = "SettlementSummary";
12806
13291
 
@@ -13535,7 +14020,7 @@ var EventListItemDetailsContent = ({
13535
14020
  }
13536
14021
  )
13537
14022
  ] }),
13538
- event.description ? /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(SettlementSummary, { content: event.description }) : null
14023
+ event.description || event.settlementDiff ? /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(SettlementSummary, { content: event.description, settlementDiff: event.settlementDiff }) : null
13539
14024
  ]
13540
14025
  }
13541
14026
  );
@@ -15441,7 +15926,7 @@ var MarketDetailsContent = ({
15441
15926
  value: selectedTab === "other" ? "order-book" : selectedTab,
15442
15927
  onChange: (nextValue) => setSelectedTab(nextValue),
15443
15928
  variant: "underline",
15444
- className: "agg-market-tabs w-full px-5"
15929
+ className: "agg-market-tabs flex! w-full px-5"
15445
15930
  }
15446
15931
  ) }),
15447
15932
  /* @__PURE__ */ (0, import_jsx_runtime141.jsx)("div", { className: "h-px w-full bg-agg-separator" })
@@ -15810,9 +16295,9 @@ var MarketDetailsList = ({
15810
16295
  MarketDetailsList.displayName = "MarketDetailsList";
15811
16296
 
15812
16297
  // src/trading/types.ts
15813
- var import_sdk16 = require("@agg-build/sdk");
15814
- var isVenue = (0, import_sdk16.enumGuard)(import_sdk16.Venue);
15815
- var parseVenue = (v) => (0, import_sdk16.safeParse)(v, isVenue);
16298
+ var import_sdk17 = require("@agg-build/sdk");
16299
+ var isVenue = (0, import_sdk17.enumGuard)(import_sdk17.Venue);
16300
+ var parseVenue = (v) => (0, import_sdk17.safeParse)(v, isVenue);
15816
16301
 
15817
16302
  // src/trading/settlement/settlement-details.tsx
15818
16303
  var import_hooks50 = require("@agg-build/hooks");
@@ -15820,26 +16305,63 @@ var import_jsx_runtime142 = require("react/jsx-runtime");
15820
16305
  var hasContent = (value) => {
15821
16306
  return typeof value === "string" && value.trim().length > 0;
15822
16307
  };
16308
+ var buildVenueSettlementRules = (venueMarkets) => {
16309
+ var _a;
16310
+ const contentByVenue = /* @__PURE__ */ new Map();
16311
+ for (const venueMarket of venueMarkets) {
16312
+ const content = [venueMarket.description, venueMarket.rulesPrimary, venueMarket.rulesSecondary].filter(hasContent).map((value) => value.trim());
16313
+ if (content.length === 0) continue;
16314
+ const venueContent = (_a = contentByVenue.get(venueMarket.venue)) != null ? _a : [];
16315
+ for (const value of content) {
16316
+ if (!venueContent.includes(value)) venueContent.push(value);
16317
+ }
16318
+ contentByVenue.set(venueMarket.venue, venueContent);
16319
+ }
16320
+ return Array.from(contentByVenue, ([venue, content]) => ({
16321
+ venue,
16322
+ content: content.join("\n\n")
16323
+ }));
16324
+ };
15823
16325
  var SettlementDetails = ({ className }) => {
15824
16326
  var _a, _b, _c, _d, _e, _f;
15825
16327
  const tradingContext = (0, import_hooks50.useEventTradingContext)();
15826
16328
  const selectedEvent = (_a = tradingContext == null ? void 0 : tradingContext.selectedEvent) != null ? _a : null;
15827
16329
  const selectedMarket = (_b = tradingContext == null ? void 0 : tradingContext.selectedMarket) != null ? _b : null;
15828
16330
  if (!selectedEvent) return null;
15829
- if (!selectedMarket) return null;
16331
+ const activeMarket = selectedMarket != null ? selectedMarket : (0, import_hooks50.resolveDefaultTradingMarket)(selectedEvent);
16332
+ if (!activeMarket) return null;
16333
+ const allVenueMarkets = normalizeVenueMarketCluster(selectedEvent.venueMarkets);
16334
+ const activeMarketCluster = normalizeVenueMarketCluster(
16335
+ selectedEvent.venueMarkets,
16336
+ activeMarket.id
16337
+ );
16338
+ const activeMarketIds = new Set(activeMarketCluster.map((market) => market.id));
16339
+ const orderedActiveMarketCluster = allVenueMarkets.filter(
16340
+ (market) => activeMarketIds.has(market.id)
16341
+ );
15830
16342
  const eventDescription = (_c = selectedEvent.description) != null ? _c : null;
15831
- const marketDescription = (_d = selectedMarket.description) != null ? _d : null;
15832
- const primaryRules = (_e = selectedMarket.rulesPrimary) != null ? _e : null;
15833
- if (!hasContent(eventDescription) && !hasContent(marketDescription) && !hasContent(primaryRules)) {
16343
+ const marketDescription = (_d = activeMarket.description) != null ? _d : null;
16344
+ const primaryRules = (_e = activeMarket.rulesPrimary) != null ? _e : null;
16345
+ const settlementDiff = (_f = selectedEvent.settlementDiff) != null ? _f : null;
16346
+ const settlementVenues = Array.from(
16347
+ new Set(orderedActiveMarketCluster.map((market) => market.venue))
16348
+ );
16349
+ const settlementVenueRules = buildVenueSettlementRules(orderedActiveMarketCluster);
16350
+ const hasSettlementDifferences = prepareSettlementDifferences(settlementDiff == null ? void 0 : settlementDiff.differences).length > 0;
16351
+ const hasVenueSettlementRules = settlementVenueRules.length > 0;
16352
+ if (!hasContent(eventDescription) && !hasVenueSettlementRules && !hasSettlementDifferences) {
15834
16353
  return null;
15835
16354
  }
15836
16355
  return /* @__PURE__ */ (0, import_jsx_runtime142.jsx)("div", { className: "agg-settlement-list flex flex-col gap-6", children: /* @__PURE__ */ (0, import_jsx_runtime142.jsx)("div", { className: "agg-settlement-list-item", children: /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
15837
16356
  Settlement,
15838
16357
  {
15839
- question: (_f = selectedMarket.question) != null ? _f : selectedEvent.title,
16358
+ question: selectedEvent.title,
15840
16359
  eventDescription,
15841
16360
  marketDescription,
15842
16361
  primaryRules,
16362
+ settlementDiff,
16363
+ settlementVenues,
16364
+ settlementVenueRules,
15843
16365
  className
15844
16366
  }
15845
16367
  ) }) });
@@ -16382,7 +16904,7 @@ var enableExecutionDebugInBrowser = (initial) => {
16382
16904
  };
16383
16905
 
16384
16906
  // src/trading/place-order/index.place-order.execution-steps.ts
16385
- var import_sdk17 = require("@agg-build/sdk");
16907
+ var import_sdk18 = require("@agg-build/sdk");
16386
16908
  var WAIT_STEP_TYPES = /* @__PURE__ */ new Set(["_wait", "wait"]);
16387
16909
  var CHECKING_BALANCE_STEP_TYPES = /* @__PURE__ */ new Set([
16388
16910
  "check-balance",
@@ -16393,14 +16915,14 @@ var CHECKING_BALANCE_STEP_TYPES = /* @__PURE__ */ new Set([
16393
16915
  var VENUE_BUY_SELL_REGEX = /^(?:buy|sell)-([a-z]+)$/;
16394
16916
  var VENUE_FINALIZE_REGEX = /^([a-z]+)-finalize$/;
16395
16917
  var VENUE_NAME_MAP = {
16396
- kalshi: import_sdk17.Venue.kalshi,
16397
- polymarket: import_sdk17.Venue.polymarket,
16398
- limitless: import_sdk17.Venue.limitless,
16399
- opinion: import_sdk17.Venue.opinion,
16400
- predict: import_sdk17.Venue.predict,
16401
- probable: import_sdk17.Venue.probable,
16402
- myriad: import_sdk17.Venue.myriad,
16403
- hyperliquid: import_sdk17.Venue.hyperliquid
16918
+ kalshi: import_sdk18.Venue.kalshi,
16919
+ polymarket: import_sdk18.Venue.polymarket,
16920
+ limitless: import_sdk18.Venue.limitless,
16921
+ opinion: import_sdk18.Venue.opinion,
16922
+ predict: import_sdk18.Venue.predict,
16923
+ probable: import_sdk18.Venue.probable,
16924
+ myriad: import_sdk18.Venue.myriad,
16925
+ hyperliquid: import_sdk18.Venue.hyperliquid
16404
16926
  };
16405
16927
  var parseVenueName = (raw) => VENUE_NAME_MAP[raw];
16406
16928
  var NON_VENUE_FINALIZE_PREFIXES = /* @__PURE__ */ new Set(["bridge"]);
@@ -16581,6 +17103,10 @@ var extractGeoBlockedVenues = (warnings) => {
16581
17103
  warnings.filter((w) => w.venue && isGeoBlockWarningReason(w.reason)).map((w) => w.venue)
16582
17104
  );
16583
17105
  };
17106
+ var hasLowLiquidityWarning = (warnings) => {
17107
+ if (!(warnings == null ? void 0 : warnings.length)) return false;
17108
+ return warnings.some((warning) => (warning == null ? void 0 : warning.reason) === "low_liquidity");
17109
+ };
16584
17110
  var getPlaceOrderContainerClassName = () => {
16585
17111
  return PLACE_ORDER_CONTAINER_CLASS_NAME;
16586
17112
  };
@@ -19547,6 +20073,7 @@ var PlaceOrder = ({
19547
20073
  return fills.length > 0 && fills.every((f) => geoBlockedVenuesFromWarnings.has(f.venue));
19548
20074
  }, [selectedRouteCard, geoBlockedVenuesFromWarnings]);
19549
20075
  const shouldShowGeoBlockBanner = isTradingBlocked || selectedRouteGeoBlocked || isPrimaryVenueGeoBlocked;
20076
+ const shouldShowLowLiquidityWarning = !isQuoteInputEditing && !isQuoteLoading && (activeQuoteData == null ? void 0 : activeQuoteData.venueMarketOutcomeId) === scopedSelectedOutcomeId && hasLowLiquidityWarning(activeQuoteData.warnings);
19550
20077
  const actionLabel = `${internalTab === "buy" ? tradingLabels.buy : tradingLabels.sell} ${selectedOutcomeLabel}`.trim();
19551
20078
  const isActionDisabled = isPrimaryActionDisabled || !orderEligibility.canPlaceOrder || isActionLoading || !hasEnteredAmount || !scopedSelectedMarket || isInsufficientBalance || isQuoteInsufficientBalance || isBelowMinimum || isQuoteLoading || !selectedRouteCard || !selectedRouteCard.quoteData.quoteId || selectedRouteGeoBlocked || !isAuthenticated || quoteStatus !== void 0;
19552
20079
  const shouldShowSmartRouting = orderEligibility.canPlaceOrder && hasEnteredAmount && !isBelowMinimum && (orderedRouteCards.length > 0 || smartRoute.isFetching || smartRoute.isLoading);
@@ -20353,6 +20880,25 @@ var PlaceOrder = ({
20353
20880
  children: actionLabel
20354
20881
  }
20355
20882
  ),
20883
+ shouldShowLowLiquidityWarning ? /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)(
20884
+ "div",
20885
+ {
20886
+ className: "agg-order-low-liquidity-warning flex w-full items-center gap-2 rounded-agg-lg bg-agg-warning/10 px-3 py-2",
20887
+ role: "status",
20888
+ children: [
20889
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(
20890
+ Icon,
20891
+ {
20892
+ name: "warning-filled",
20893
+ size: "small",
20894
+ className: "h-4! w-4! shrink-0 text-agg-warning",
20895
+ "aria-hidden": "true"
20896
+ }
20897
+ ),
20898
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("p", { className: "min-w-0 flex-1 wrap-break-word text-agg-sm leading-agg-5 text-agg-foreground", children: tradingLabels.lowLiquidityWarning })
20899
+ ]
20900
+ }
20901
+ ) : null,
20356
20902
  !shouldShowGeoBlockBanner && internalTab === "buy" && showFeesBreakdown ? /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { className: "agg-order-platform-fee mt-1 flex items-center justify-center gap-1.5 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: [
20357
20903
  /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(
20358
20904
  Icon,
@@ -20972,7 +21518,14 @@ var EventMarketPageLoadingState = ({
20972
21518
  /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(MarketDetails, { isLoading: true, isOpened: true, classNames: { root: "w-full" } }),
20973
21519
  /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(MarketDetails, { isLoading: true, isOpened: false, classNames: { root: "w-full" } }),
20974
21520
  /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(MarketDetails, { isLoading: true, isOpened: false, classNames: { root: "w-full" } })
20975
- ] })
21521
+ ] }),
21522
+ /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(
21523
+ Skeleton,
21524
+ {
21525
+ view: skeletonViews.settlement,
21526
+ className: cn("agg-settlement-list-item", classNames == null ? void 0 : classNames.settlement)
21527
+ }
21528
+ )
20976
21529
  ]
20977
21530
  }
20978
21531
  ),
@@ -23094,7 +23647,7 @@ var HomeSearchResults = ({
23094
23647
  const eventListTabs = useEventListTabs();
23095
23648
  const { headerRef, titleRef, shouldUseSelectOverflow } = useEventListTabsHeaderOverflow(eventListTabs);
23096
23649
  const visibleVenues = (0, import_react42.useMemo)(
23097
- () => disabledVenues.length === 0 ? void 0 : (0, import_hooks62.getVisibleVenueIdsByConfig)(import_sdk18.VENUES, disabledVenues),
23650
+ () => disabledVenues.length === 0 ? void 0 : (0, import_hooks62.getVisibleVenueIdsByConfig)(import_sdk19.VENUES, disabledVenues),
23098
23651
  [disabledVenues]
23099
23652
  );
23100
23653
  const activeVenueTab = (0, import_react42.useMemo)(() => {
@@ -23581,7 +24134,7 @@ HomePage.displayName = "HomePage";
23581
24134
 
23582
24135
  // src/pages/user-profile/index.tsx
23583
24136
  var import_hooks68 = require("@agg-build/hooks");
23584
- var import_sdk20 = require("@agg-build/sdk");
24137
+ var import_sdk21 = require("@agg-build/sdk");
23585
24138
  var import_react44 = require("react");
23586
24139
 
23587
24140
  // src/pages/user-profile/chain-display.ts
@@ -23820,17 +24373,17 @@ AvailableBalanceCard.displayName = "AvailableBalanceCard";
23820
24373
 
23821
24374
  // src/pages/user-profile/components/claim-activity-breakdown-modal.tsx
23822
24375
  var import_hooks64 = require("@agg-build/hooks");
23823
- var import_sdk19 = require("@agg-build/sdk");
24376
+ var import_sdk20 = require("@agg-build/sdk");
23824
24377
  var import_jsx_runtime156 = require("react/jsx-runtime");
23825
24378
  var CLAIM_VENUE_LABELS = {
23826
- [import_sdk19.Venue.kalshi]: "Kalshi",
23827
- [import_sdk19.Venue.polymarket]: "Polymarket",
23828
- [import_sdk19.Venue.limitless]: "Limitless",
23829
- [import_sdk19.Venue.opinion]: "Opinion",
23830
- [import_sdk19.Venue.predict]: "Predict",
23831
- [import_sdk19.Venue.probable]: "Probable",
23832
- [import_sdk19.Venue.myriad]: "Myriad",
23833
- [import_sdk19.Venue.hyperliquid]: "Hyperliquid"
24379
+ [import_sdk20.Venue.kalshi]: "Kalshi",
24380
+ [import_sdk20.Venue.polymarket]: "Polymarket",
24381
+ [import_sdk20.Venue.limitless]: "Limitless",
24382
+ [import_sdk20.Venue.opinion]: "Opinion",
24383
+ [import_sdk20.Venue.predict]: "Predict",
24384
+ [import_sdk20.Venue.probable]: "Probable",
24385
+ [import_sdk20.Venue.myriad]: "Myriad",
24386
+ [import_sdk20.Venue.hyperliquid]: "Hyperliquid"
23834
24387
  };
23835
24388
  var ClaimActivityBreakdownModal = ({
23836
24389
  activity,
@@ -24737,10 +25290,6 @@ EmptyState.displayName = "EmptyState";
24737
25290
  // src/pages/user-profile/components/position-row.tsx
24738
25291
  var import_hooks65 = require("@agg-build/hooks");
24739
25292
  var import_jsx_runtime159 = require("react/jsx-runtime");
24740
- var floorToTwoDecimals = (value) => {
24741
- if (!Number.isFinite(value) || value <= 0) return 0;
24742
- return Math.trunc(value * 100) / 100;
24743
- };
24744
25293
  var shouldUseNativeLinkNavigation2 = (event) => {
24745
25294
  return event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button === 1;
24746
25295
  };
@@ -24753,32 +25302,21 @@ var OutcomePill = ({ label: label2 }) => /* @__PURE__ */ (0, import_jsx_runtime1
24753
25302
  var ResolutionPill = ({ label: label2 }) => /* @__PURE__ */ (0, import_jsx_runtime159.jsx)("span", { className: "agg-position-resolution-pill inline-flex w-full items-center justify-center overflow-hidden rounded-full bg-agg-secondary-hover px-4 py-[6px] md:w-auto", children: /* @__PURE__ */ (0, import_jsx_runtime159.jsx)("span", { className: "truncate whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: label2 }) });
24754
25303
  var VenueShares = ({
24755
25304
  model,
24756
- totalSharesLabel,
24757
25305
  className,
24758
25306
  keyPrefix
24759
25307
  }) => {
24760
- if (!totalSharesLabel && model.venueShareBreakdown.length === 0) return null;
24761
- return /* @__PURE__ */ (0, import_jsx_runtime159.jsxs)("div", { className: cn(className, "gap-2"), children: [
24762
- model.venueShareBreakdown.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime159.jsx)("div", { className: "flex items-center gap-1", children: model.venueShareBreakdown.map((row, index) => /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(
24763
- Tooltip,
24764
- {
24765
- content: /* @__PURE__ */ (0, import_jsx_runtime159.jsx)("span", { children: row.sharesLabel }),
24766
- "aria-label": `${row.venue} shares`,
24767
- side: "top",
24768
- children: /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(
24769
- "span",
24770
- {
24771
- tabIndex: 0,
24772
- className: "cursor-help rounded-agg-xs focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-0 focus-visible:ring-offset-agg-secondary",
24773
- "aria-label": `${row.venue} shares`,
24774
- children: /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(VenueLogo, { venue: row.venue, size: "small", className: "size-4 shrink-0" })
24775
- }
24776
- )
24777
- },
24778
- `${keyPrefix}-${row.venue}-${String(index)}`
24779
- )) }) : null,
24780
- totalSharesLabel ? /* @__PURE__ */ (0, import_jsx_runtime159.jsx)("span", { className: "whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: totalSharesLabel }) : null
24781
- ] });
25308
+ if (model.venueShareBreakdown.length === 0) return null;
25309
+ return /* @__PURE__ */ (0, import_jsx_runtime159.jsx)("div", { className: cn(className, "gap-x-3 gap-y-2"), children: model.venueShareBreakdown.map((row, index) => /* @__PURE__ */ (0, import_jsx_runtime159.jsxs)(
25310
+ "div",
25311
+ {
25312
+ className: "flex min-w-0 max-w-full items-center gap-1",
25313
+ children: [
25314
+ /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(VenueLogo, { venue: row.venue, size: "small", className: "size-4 shrink-0" }),
25315
+ /* @__PURE__ */ (0, import_jsx_runtime159.jsx)("span", { className: "truncate whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: row.sharesLabel })
25316
+ ]
25317
+ },
25318
+ `${keyPrefix}-${row.venue}-${row.sharesLabel}-${String(index)}`
25319
+ )) });
24782
25320
  };
24783
25321
  var StatusBadge = ({
24784
25322
  status,
@@ -24895,7 +25433,6 @@ var PositionRow = ({
24895
25433
  finalPrefix: labels.finalPrefix
24896
25434
  });
24897
25435
  const isClosed = (variant != null ? variant : model.bucket) === "closed";
24898
- const totalSharesLabel = typeof position.totalShares === "number" && Number.isFinite(position.totalShares) ? `${String(floorToTwoDecimals(position.totalShares))} shares` : null;
24899
25436
  const handleClaim = (event) => {
24900
25437
  event.preventDefault();
24901
25438
  event.stopPropagation();
@@ -24956,7 +25493,6 @@ var PositionRow = ({
24956
25493
  VenueShares,
24957
25494
  {
24958
25495
  model,
24959
- totalSharesLabel,
24960
25496
  keyPrefix: "desktop",
24961
25497
  className: "agg-position-venues flex flex-1 flex-wrap content-center items-center gap-x-3 gap-y-2"
24962
25498
  }
@@ -24971,7 +25507,6 @@ var PositionRow = ({
24971
25507
  VenueShares,
24972
25508
  {
24973
25509
  model,
24974
- totalSharesLabel,
24975
25510
  keyPrefix: "mobile",
24976
25511
  className: "agg-position-venues flex min-w-0 flex-1 flex-wrap content-center items-center gap-x-3 gap-y-2 md:hidden"
24977
25512
  }
@@ -26166,10 +26701,10 @@ var toRedeemTransactions = (item) => {
26166
26701
  });
26167
26702
  };
26168
26703
  var POSITION_ROW_VENUE_ORDER = [
26169
- import_sdk20.Venue.polymarket,
26170
- import_sdk20.Venue.kalshi,
26171
- import_sdk20.Venue.opinion,
26172
- import_sdk20.Venue.limitless
26704
+ import_sdk21.Venue.polymarket,
26705
+ import_sdk21.Venue.kalshi,
26706
+ import_sdk21.Venue.opinion,
26707
+ import_sdk21.Venue.limitless
26173
26708
  ];
26174
26709
  function venueBreakdownSortKey(venue) {
26175
26710
  const idx = POSITION_ROW_VENUE_ORDER.indexOf(venue);
@@ -26183,7 +26718,19 @@ function buildVenueShareBreakdown(outcome) {
26183
26718
  if (breakdown.length === 0) {
26184
26719
  return [];
26185
26720
  }
26186
- const sorted = [...breakdown].sort(
26721
+ const aggregatedByVenue = breakdown.reduce(
26722
+ (acc, row) => {
26723
+ const existing = acc.get(row.venue);
26724
+ if (existing) {
26725
+ existing.size += row.size;
26726
+ return acc;
26727
+ }
26728
+ acc.set(row.venue, { venue: row.venue, size: row.size });
26729
+ return acc;
26730
+ },
26731
+ /* @__PURE__ */ new Map()
26732
+ );
26733
+ const sorted = [...aggregatedByVenue.values()].sort(
26187
26734
  (a, b) => venueBreakdownSortKey(a.venue) - venueBreakdownSortKey(b.venue)
26188
26735
  );
26189
26736
  return sorted.map((row) => ({