@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/index.js CHANGED
@@ -236,6 +236,7 @@ __export(src_exports, {
236
236
  getMotionClassName: () => getMotionClassName,
237
237
  getPendingCardSession: () => getPendingCardSession,
238
238
  getScrollBehavior: () => getScrollBehavior,
239
+ getSettlementDifferenceId: () => getSettlementDifferenceId,
239
240
  getTradingAveragePriceLabel: () => getTradingAveragePriceLabel,
240
241
  getTradingBalanceLabel: () => getTradingBalanceLabel,
241
242
  getTradingDateLabel: () => getTradingDateLabel,
@@ -251,8 +252,10 @@ __export(src_exports, {
251
252
  orderbookRowLimitDefault: () => orderbookRowLimitDefault,
252
253
  parseAmount: () => parseAmount,
253
254
  parseVenue: () => parseVenue,
255
+ prepareSettlementDifferences: () => prepareSettlementDifferences,
254
256
  requestAggDepositModalOpen: () => requestAggDepositModalOpen,
255
257
  requestAggWithdrawModalOpen: () => requestAggWithdrawModalOpen,
258
+ resolveDifferenceIconClassName: () => resolveDifferenceIconClassName,
256
259
  resolveEventDetailsSyncKey: () => resolveEventDetailsSyncKey,
257
260
  resolveOrderBookRows: () => resolveOrderBookRows,
258
261
  resolveResolvedOutcomeLabel: () => resolveResolvedOutcomeLabel,
@@ -1862,6 +1865,12 @@ var iconSizeClasses = {
1862
1865
  medium: "h-6 w-6",
1863
1866
  large: "h-8 w-8"
1864
1867
  };
1868
+ var iconSizePixels = {
1869
+ xs: 12,
1870
+ small: 16,
1871
+ medium: 24,
1872
+ large: 32
1873
+ };
1865
1874
 
1866
1875
  // src/primitives/search/search-empty-icon.tsx
1867
1876
  var import_jsx_runtime40 = require("react/jsx-runtime");
@@ -3463,6 +3472,8 @@ var Icon = (_a) => {
3463
3472
  __spreadValues({
3464
3473
  color,
3465
3474
  className: cn("group/agg-icon", resolvedClassName),
3475
+ width: iconSizePixels[size],
3476
+ height: iconSizePixels[size],
3466
3477
  style: resolvedStyle
3467
3478
  }, props)
3468
3479
  );
@@ -5781,7 +5792,7 @@ EventListSkeletonView.displayName = "EventListSkeletonView";
5781
5792
  var import_hooks13 = require("@agg-build/hooks");
5782
5793
 
5783
5794
  // src/events/item-details/event-list-item-details.constants.ts
5784
- var detailsBaseCardClassName = "w-full gap-6 p-5 md:gap-8";
5795
+ var detailsBaseCardClassName = "w-full gap-6 p-4 md:p-5 md:gap-8";
5785
5796
 
5786
5797
  // src/primitives/skeleton/views/event-list-item-details-skeleton-view.tsx
5787
5798
  var import_jsx_runtime101 = require("react/jsx-runtime");
@@ -6092,17 +6103,10 @@ var SettlementSkeletonView = ({
6092
6103
  children: [
6093
6104
  /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)("div", { className: "flex w-full items-center justify-between gap-4", children: [
6094
6105
  /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(SkeletonBlock, { className: "h-4 w-[81px] rounded-agg-sm" }),
6095
- /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(SkeletonBlock, { className: "h-5 w-full max-w-[240px] rounded-agg-sm" })
6096
- ] }),
6097
- /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)("div", { className: "flex w-full flex-col gap-3", children: [
6098
- /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(SkeletonBlock, { className: "h-5 w-[200px] rounded-agg-sm" }),
6099
- /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)("div", { className: "flex flex-col gap-2", children: [
6100
- /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(SkeletonBlock, { className: "h-4 w-full max-w-[320px] rounded-agg-sm" }),
6101
- /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(SkeletonBlock, { className: "h-4 w-full max-w-[280px] rounded-agg-sm" })
6102
- ] })
6106
+ /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(SkeletonBlock, { className: "h-5 w-[240px] max-w-[60%] rounded-agg-sm" })
6103
6107
  ] }),
6104
- /* @__PURE__ */ (0, import_jsx_runtime105.jsx)("div", { className: "h-px w-full bg-agg-separator" }),
6105
- /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)("div", { className: "flex w-full flex-col gap-3", children: [
6108
+ /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(SkeletonBlock, { className: "h-5 w-[200px] rounded-agg-sm" }),
6109
+ /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)("div", { className: "flex w-full flex-col gap-4", children: [
6106
6110
  /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)("div", { className: "flex items-center gap-2", children: [
6107
6111
  /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(SkeletonBlock, { className: "size-4 rounded-agg-sm" }),
6108
6112
  /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(SkeletonBlock, { className: "h-5 w-[100px] rounded-agg-sm" })
@@ -9059,14 +9063,23 @@ var import_react14 = require("react");
9059
9063
  var import_react13 = require("react");
9060
9064
  var useHorizontalScrollState = () => {
9061
9065
  const containerRef = (0, import_react13.useRef)(null);
9066
+ const [hasOverflow, setHasOverflow] = (0, import_react13.useState)(false);
9067
+ const [isAtStart, setIsAtStart] = (0, import_react13.useState)(true);
9068
+ const [isAtEnd, setIsAtEnd] = (0, import_react13.useState)(true);
9062
9069
  const [canScrollLeft, setCanScrollLeft] = (0, import_react13.useState)(false);
9063
9070
  const [canScrollRight, setCanScrollRight] = (0, import_react13.useState)(false);
9064
9071
  const update = (0, import_react13.useCallback)(() => {
9065
9072
  const el = containerRef.current;
9066
9073
  if (!el) return;
9067
- const maxScroll = el.scrollWidth - el.clientWidth;
9068
- setCanScrollLeft(el.scrollLeft > 4);
9069
- setCanScrollRight(maxScroll - el.scrollLeft > 4);
9074
+ const epsilon = 2;
9075
+ const nextHasOverflow = el.scrollWidth > el.clientWidth + epsilon;
9076
+ const nextIsAtStart = el.scrollLeft <= epsilon;
9077
+ const nextIsAtEnd = el.scrollLeft + el.clientWidth >= el.scrollWidth - epsilon;
9078
+ setHasOverflow(nextHasOverflow);
9079
+ setIsAtStart(nextIsAtStart);
9080
+ setIsAtEnd(nextIsAtEnd);
9081
+ setCanScrollLeft(nextHasOverflow && !nextIsAtStart);
9082
+ setCanScrollRight(nextHasOverflow && !nextIsAtEnd);
9070
9083
  }, []);
9071
9084
  (0, import_react13.useEffect)(() => {
9072
9085
  const el = containerRef.current;
@@ -9082,7 +9095,15 @@ var useHorizontalScrollState = () => {
9082
9095
  ro.observe(el);
9083
9096
  return () => ro.disconnect();
9084
9097
  }, [update]);
9085
- return { containerRef, canScrollLeft, canScrollRight, update };
9098
+ return {
9099
+ containerRef,
9100
+ hasOverflow,
9101
+ isAtStart,
9102
+ isAtEnd,
9103
+ canScrollLeft,
9104
+ canScrollRight,
9105
+ update
9106
+ };
9086
9107
  };
9087
9108
 
9088
9109
  // src/primitives/tabs/tabs.constants.ts
@@ -9177,6 +9198,9 @@ var Tabs = ({
9177
9198
  });
9178
9199
  const {
9179
9200
  containerRef: tabListRef,
9201
+ hasOverflow,
9202
+ isAtStart,
9203
+ isAtEnd,
9180
9204
  canScrollLeft,
9181
9205
  canScrollRight,
9182
9206
  update: updateScrollState
@@ -9265,7 +9289,7 @@ var Tabs = ({
9265
9289
  "overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
9266
9290
  getMotionClassName(enableAnimations, "scroll-smooth")
9267
9291
  ) : "overflow-x-auto",
9268
- isBarVariant ? "items-start rounded-agg-lg border border-agg-separator p-1.5" : "h-15 border-b border-agg-separator -mb-[1px]",
9292
+ 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]",
9269
9293
  shouldUseOverflowScroll && "select-none",
9270
9294
  shouldUseOverflowScroll && !isBarVariant && "snap-x snap-mandatory",
9271
9295
  shouldUseOverflowScroll && (isDraggingTabs ? "cursor-grabbing" : "cursor-grab")
@@ -9423,7 +9447,10 @@ var Tabs = ({
9423
9447
  left: Math.max(0, nextScrollLeft),
9424
9448
  behavior: getScrollBehavior(enableAnimations)
9425
9449
  });
9426
- }, [enableAnimations, renderedItems, shouldUseOverflowScroll, value]);
9450
+ requestAnimationFrame(() => {
9451
+ updateScrollState();
9452
+ });
9453
+ }, [enableAnimations, renderedItems, shouldUseOverflowScroll, updateScrollState, value]);
9427
9454
  if (shouldUseOverflowSelect) {
9428
9455
  return /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("div", { className: cn("group/agg-tabs w-full", className, classNames == null ? void 0 : classNames.root), children: /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
9429
9456
  Select,
@@ -9462,6 +9489,13 @@ var Tabs = ({
9462
9489
  onPointerUp: handleEndTabListDrag,
9463
9490
  onWheel: handleTabListWheel,
9464
9491
  children: [
9492
+ shouldUseOverflowScroll && !isBarVariant && hasOverflow ? /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
9493
+ "span",
9494
+ {
9495
+ "aria-hidden": true,
9496
+ className: "agg-tab-scroll-start-spacer h-full w-4 shrink-0 snap-start"
9497
+ }
9498
+ ) : null,
9465
9499
  renderedItems.map((item, index) => {
9466
9500
  var _a;
9467
9501
  const isActive = item.value === value;
@@ -9496,6 +9530,7 @@ var Tabs = ({
9496
9530
  isDisabled: !!item.disabled,
9497
9531
  size
9498
9532
  }),
9533
+ !isBarVariant && (size === "s" ? "px-3 md:px-4" : "h-14 px-3 md:h-15 md:px-4"),
9499
9534
  shouldUseOverflowScroll && !isBarVariant && "snap-start",
9500
9535
  classNames == null ? void 0 : classNames.tabTrigger
9501
9536
  ),
@@ -9545,9 +9580,9 @@ var Tabs = ({
9545
9580
  "aria-hidden": true,
9546
9581
  className: cn(
9547
9582
  "agg-tab-scroll-start",
9548
- "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",
9583
+ "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",
9549
9584
  getMotionClassName(enableAnimations, "transition-opacity duration-200"),
9550
- canScrollLeft ? "opacity-100" : "opacity-0"
9585
+ hasOverflow && canScrollLeft && !isAtStart ? "opacity-100" : "opacity-0"
9551
9586
  )
9552
9587
  }
9553
9588
  ),
@@ -9557,9 +9592,9 @@ var Tabs = ({
9557
9592
  "aria-hidden": true,
9558
9593
  className: cn(
9559
9594
  "agg-tab-scroll-end",
9560
- "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",
9595
+ "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",
9561
9596
  getMotionClassName(enableAnimations, "transition-opacity duration-200"),
9562
- canScrollRight ? "opacity-100" : "opacity-0"
9597
+ hasOverflow && canScrollRight && !isAtEnd ? "opacity-100" : "opacity-0"
9563
9598
  )
9564
9599
  }
9565
9600
  )
@@ -11331,8 +11366,85 @@ var EventListItemNotFoundState = ({
11331
11366
  );
11332
11367
  };
11333
11368
  var OUTCOMES_SCROLL_LOAD_THRESHOLD_PX = 16;
11369
+ var OUTCOMES_SCROLL_STATE_EPSILON_PX = 1;
11370
+ var OUTCOMES_SCROLL_MASK_HEIGHT_PX = 24;
11334
11371
  var MARKET_ID_QUERY_PARAM = "marketId";
11335
11372
  var OUTCOME_ID_QUERY_PARAM = "outcomeId";
11373
+ var OUTCOME_ROW_SELECTOR = ".agg-outcome-row";
11374
+ var DEFAULT_OUTCOMES_SCROLL_STATE = {
11375
+ hasOverflow: false,
11376
+ isAtTop: true,
11377
+ isAtBottom: true,
11378
+ remainingMarkets: 0
11379
+ };
11380
+ var areOutcomesScrollStatesEqual = (left, right) => {
11381
+ return left.hasOverflow === right.hasOverflow && left.isAtTop === right.isAtTop && left.isAtBottom === right.isAtBottom && left.remainingMarkets === right.remainingMarkets;
11382
+ };
11383
+ var useOutcomesScrollState = ({
11384
+ totalMarketCount,
11385
+ onReachScrollThreshold
11386
+ }) => {
11387
+ const containerRef = (0, import_react18.useRef)(null);
11388
+ const frameRef = (0, import_react18.useRef)(null);
11389
+ const scrollStateRef = (0, import_react18.useRef)(DEFAULT_OUTCOMES_SCROLL_STATE);
11390
+ const [scrollState, setScrollState] = (0, import_react18.useState)(
11391
+ DEFAULT_OUTCOMES_SCROLL_STATE
11392
+ );
11393
+ const measureScrollState = (0, import_react18.useCallback)(() => {
11394
+ frameRef.current = null;
11395
+ const element = containerRef.current;
11396
+ if (!element) return;
11397
+ const { clientHeight, scrollHeight, scrollTop } = element;
11398
+ const hasOverflow = scrollHeight > clientHeight + OUTCOMES_SCROLL_STATE_EPSILON_PX;
11399
+ const isAtTop = scrollTop <= OUTCOMES_SCROLL_STATE_EPSILON_PX;
11400
+ const isAtBottom = !hasOverflow || scrollTop + clientHeight >= scrollHeight - OUTCOMES_SCROLL_STATE_EPSILON_PX;
11401
+ const loadedRows = Array.from(element.querySelectorAll(OUTCOME_ROW_SELECTOR));
11402
+ const visibleMarketCount = loadedRows.reduce((count, row) => {
11403
+ return count + (row.offsetTop < clientHeight - OUTCOMES_SCROLL_STATE_EPSILON_PX ? 1 : 0);
11404
+ }, 0);
11405
+ const remainingMarkets = hasOverflow ? Math.max(0, totalMarketCount - visibleMarketCount) : 0;
11406
+ const nextScrollState = {
11407
+ hasOverflow,
11408
+ isAtTop,
11409
+ isAtBottom,
11410
+ remainingMarkets
11411
+ };
11412
+ if (!areOutcomesScrollStatesEqual(scrollStateRef.current, nextScrollState)) {
11413
+ scrollStateRef.current = nextScrollState;
11414
+ setScrollState(nextScrollState);
11415
+ }
11416
+ const distanceToBottom = scrollHeight - scrollTop - clientHeight;
11417
+ if (distanceToBottom <= OUTCOMES_SCROLL_LOAD_THRESHOLD_PX) {
11418
+ onReachScrollThreshold == null ? void 0 : onReachScrollThreshold();
11419
+ }
11420
+ }, [onReachScrollThreshold, totalMarketCount]);
11421
+ const updateScrollState = (0, import_react18.useCallback)(() => {
11422
+ if (frameRef.current != null) return;
11423
+ frameRef.current = window.requestAnimationFrame(measureScrollState);
11424
+ }, [measureScrollState]);
11425
+ (0, import_react18.useEffect)(() => {
11426
+ const element = containerRef.current;
11427
+ if (!element) return;
11428
+ element.addEventListener("scroll", updateScrollState, { passive: true });
11429
+ let resizeObserver = null;
11430
+ if (typeof ResizeObserver !== "undefined") {
11431
+ resizeObserver = new ResizeObserver(() => {
11432
+ updateScrollState();
11433
+ });
11434
+ resizeObserver.observe(element);
11435
+ }
11436
+ updateScrollState();
11437
+ return () => {
11438
+ element.removeEventListener("scroll", updateScrollState);
11439
+ resizeObserver == null ? void 0 : resizeObserver.disconnect();
11440
+ if (frameRef.current != null) {
11441
+ window.cancelAnimationFrame(frameRef.current);
11442
+ frameRef.current = null;
11443
+ }
11444
+ };
11445
+ }, [updateScrollState]);
11446
+ return { containerRef, scrollState, updateScrollState };
11447
+ };
11336
11448
  var buildOutcomeMidpointsByOutcomeId = (midpointRows) => {
11337
11449
  const outcomeMidpointsByOutcomeId = /* @__PURE__ */ new Map();
11338
11450
  const addOutcomeMidpoints = (value) => {
@@ -11499,6 +11611,31 @@ var EventListItemContent = ({
11499
11611
  const matchedCountLabel = labels.eventItem.matchedCount(
11500
11612
  Math.max(resolvedVenueCount, visibleFooterVenues.length)
11501
11613
  );
11614
+ const handleOutcomesScrollThreshold = (0, import_react18.useCallback)(() => {
11615
+ if (!shouldEnableLazyMarketLoading) return;
11616
+ if (!isLazyMarketsQueryEnabled) {
11617
+ setIsLazyMarketsQueryEnabled(true);
11618
+ return;
11619
+ }
11620
+ if (!hasNextLazyMarketsPage) return;
11621
+ if (isLoadingLazyMarkets || isFetchingNextLazyMarketsPage) return;
11622
+ void fetchNextLazyMarketsPage();
11623
+ }, [
11624
+ fetchNextLazyMarketsPage,
11625
+ hasNextLazyMarketsPage,
11626
+ isFetchingNextLazyMarketsPage,
11627
+ isLazyMarketsQueryEnabled,
11628
+ isLoadingLazyMarkets,
11629
+ shouldEnableLazyMarketLoading
11630
+ ]);
11631
+ const {
11632
+ containerRef: outcomesContainerRef,
11633
+ scrollState: outcomesScrollState,
11634
+ updateScrollState
11635
+ } = useOutcomesScrollState({
11636
+ totalMarketCount: resolvedMarketCount,
11637
+ onReachScrollThreshold: handleOutcomesScrollThreshold
11638
+ });
11502
11639
  const shouldUseNativeLinkNavigation3 = (eventToHandle) => {
11503
11640
  return eventToHandle.metaKey || eventToHandle.ctrlKey || eventToHandle.shiftKey || eventToHandle.altKey || eventToHandle.button === 1;
11504
11641
  };
@@ -11550,29 +11687,9 @@ var EventListItemContent = ({
11550
11687
  onEventClick == null ? void 0 : onEventClick(event);
11551
11688
  }
11552
11689
  };
11553
- const handleOutcomesScroll = (0, import_react18.useCallback)(
11554
- (eventToHandle) => {
11555
- if (!shouldEnableLazyMarketLoading) return;
11556
- const element = eventToHandle.currentTarget;
11557
- const distanceToBottom = element.scrollHeight - element.scrollTop - element.clientHeight;
11558
- if (distanceToBottom > OUTCOMES_SCROLL_LOAD_THRESHOLD_PX) return;
11559
- if (!isLazyMarketsQueryEnabled) {
11560
- setIsLazyMarketsQueryEnabled(true);
11561
- return;
11562
- }
11563
- if (!hasNextLazyMarketsPage) return;
11564
- if (isLoadingLazyMarkets || isFetchingNextLazyMarketsPage) return;
11565
- void fetchNextLazyMarketsPage();
11566
- },
11567
- [
11568
- fetchNextLazyMarketsPage,
11569
- hasNextLazyMarketsPage,
11570
- isFetchingNextLazyMarketsPage,
11571
- isLazyMarketsQueryEnabled,
11572
- isLoadingLazyMarkets,
11573
- shouldEnableLazyMarketLoading
11574
- ]
11575
- );
11690
+ (0, import_react18.useEffect)(() => {
11691
+ updateScrollState();
11692
+ }, [comparison.rows.length, shouldRenderLoadingOutcomeRow, updateScrollState]);
11576
11693
  const renderArbitrage = (value) => {
11577
11694
  if (value == null) return null;
11578
11695
  if (Math.abs(value) < config.market.arbitrageThreshold) return null;
@@ -11757,69 +11874,94 @@ var EventListItemContent = ({
11757
11874
  ) }) : null
11758
11875
  ] }) })
11759
11876
  ] }),
11760
- /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(
11761
- "div",
11762
- {
11763
- className: cn(
11764
- "agg-outcomes flex max-h-[76px] flex-col gap-4 overflow-y-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
11765
- classNames == null ? void 0 : classNames.outcomes
11766
- ),
11767
- onScroll: handleOutcomesScroll,
11768
- children: [
11769
- comparison.rows.map((row) => {
11770
- var _a2;
11771
- const arbitragePercent = (_a2 = arbitrageByOutcomeId == null ? void 0 : arbitrageByOutcomeId[row.outcome.id]) != null ? _a2 : arbitrageByOutcomeId == null ? void 0 : arbitrageByOutcomeId[row.market.id];
11772
- const arbReturn = arbReturnByVenueMarketId.get(row.market.id);
11773
- const priceGapPercent = arbReturn == null ? gapsByVenueMarketId.get(row.market.id) : arbReturn;
11774
- const priceGapSource = arbReturn == null ? "percent" : "fraction";
11775
- return /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(
11776
- "div",
11777
- {
11778
- className: cn(
11779
- "agg-outcome-row",
11780
- "flex h-10 w-full flex-row items-center justify-between gap-3",
11781
- classNames == null ? void 0 : classNames.outcomeRow
11782
- ),
11783
- children: [
11784
- /* @__PURE__ */ (0, import_jsx_runtime136.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_runtime136.jsx)(
11785
- Typography,
11786
- {
11787
- variant: "body",
11788
- className: "agg-outcome-label min-w-0 truncate text-agg-xs leading-agg-5 md:text-agg-base md:leading-agg-6",
11789
- children: row.label
11790
- }
11791
- ) }),
11792
- /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)("div", { className: "agg-outcome-meta flex shrink-0 flex-row items-center justify-end gap-2", children: [
11793
- renderArbitrage(arbitragePercent),
11794
- renderPriceGapPill(priceGapPercent, priceGapSource),
11795
- /* @__PURE__ */ (0, import_jsx_runtime136.jsx)("div", { className: "agg-outcome-price-strip relative flex shrink-0 items-center justify-end", children: isAwaitingMidpoints ? renderPriceStripSkeleton(row.prices.length) : row.prices.map(
11796
- (price, priceIndex) => renderComparisonPriceBadge(row, price, priceIndex)
11797
- ) })
11798
- ] })
11799
- ]
11800
- },
11801
- row.id
11802
- );
11803
- }),
11804
- shouldRenderLoadingOutcomeRow ? /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)("div", { className: "agg-outcome-row-loading flex w-full items-center justify-between gap-3", children: [
11805
- /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
11806
- "div",
11807
- {
11808
- "aria-hidden": "true",
11809
- className: "bg-agg-separator animate-pulse h-5 rounded-agg-sm w-[200px]"
11810
- }
11811
- ),
11812
- /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
11813
- "div",
11814
- {
11815
- "aria-hidden": "true",
11816
- className: "bg-agg-separator animate-pulse h-9 w-[100px] rounded-agg-full"
11817
- }
11818
- )
11819
- ] }) : null
11820
- ]
11821
- }
11822
- ),
11877
+ /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)("div", { className: "relative w-full", children: [
11878
+ /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(
11879
+ "div",
11880
+ {
11881
+ ref: outcomesContainerRef,
11882
+ className: cn(
11883
+ "agg-outcomes flex max-h-[76px] flex-col gap-4 overflow-y-auto rounded-agg-md [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
11884
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-2 focus-visible:ring-offset-agg-secondary",
11885
+ classNames == null ? void 0 : classNames.outcomes
11886
+ ),
11887
+ "aria-label": labels.marketDetails.marketOutcomesAria,
11888
+ tabIndex: 0,
11889
+ children: [
11890
+ comparison.rows.map((row) => {
11891
+ var _a2;
11892
+ const arbitragePercent = (_a2 = arbitrageByOutcomeId == null ? void 0 : arbitrageByOutcomeId[row.outcome.id]) != null ? _a2 : arbitrageByOutcomeId == null ? void 0 : arbitrageByOutcomeId[row.market.id];
11893
+ const arbReturn = arbReturnByVenueMarketId.get(row.market.id);
11894
+ const priceGapPercent = arbReturn == null ? gapsByVenueMarketId.get(row.market.id) : arbReturn;
11895
+ const priceGapSource = arbReturn == null ? "percent" : "fraction";
11896
+ return /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(
11897
+ "div",
11898
+ {
11899
+ className: cn(
11900
+ "agg-outcome-row",
11901
+ "flex h-10 w-full flex-row items-center justify-between gap-3",
11902
+ classNames == null ? void 0 : classNames.outcomeRow
11903
+ ),
11904
+ children: [
11905
+ /* @__PURE__ */ (0, import_jsx_runtime136.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_runtime136.jsx)(
11906
+ Typography,
11907
+ {
11908
+ variant: "body",
11909
+ className: "agg-outcome-label min-w-0 truncate text-agg-xs leading-agg-5 md:text-agg-base md:leading-agg-6",
11910
+ children: row.label
11911
+ }
11912
+ ) }),
11913
+ /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)("div", { className: "agg-outcome-meta flex shrink-0 flex-row items-center justify-end gap-2", children: [
11914
+ renderArbitrage(arbitragePercent),
11915
+ renderPriceGapPill(priceGapPercent, priceGapSource),
11916
+ /* @__PURE__ */ (0, import_jsx_runtime136.jsx)("div", { className: "agg-outcome-price-strip relative flex shrink-0 items-center justify-end", children: isAwaitingMidpoints ? renderPriceStripSkeleton(row.prices.length) : row.prices.map(
11917
+ (price, priceIndex) => renderComparisonPriceBadge(row, price, priceIndex)
11918
+ ) })
11919
+ ] })
11920
+ ]
11921
+ },
11922
+ row.id
11923
+ );
11924
+ }),
11925
+ shouldRenderLoadingOutcomeRow ? /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)("div", { className: "agg-outcome-row-loading flex w-full items-center justify-between gap-3", children: [
11926
+ /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
11927
+ "div",
11928
+ {
11929
+ "aria-hidden": "true",
11930
+ className: "bg-agg-separator animate-pulse h-5 rounded-agg-sm w-[200px]"
11931
+ }
11932
+ ),
11933
+ /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
11934
+ "div",
11935
+ {
11936
+ "aria-hidden": "true",
11937
+ className: "bg-agg-separator animate-pulse h-9 w-[100px] rounded-agg-full"
11938
+ }
11939
+ )
11940
+ ] }) : null
11941
+ ]
11942
+ }
11943
+ ),
11944
+ /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
11945
+ "div",
11946
+ {
11947
+ className: cn(
11948
+ "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",
11949
+ outcomesScrollState.hasOverflow && !outcomesScrollState.isAtTop ? "opacity-100" : "opacity-0"
11950
+ ),
11951
+ style: { height: OUTCOMES_SCROLL_MASK_HEIGHT_PX }
11952
+ }
11953
+ ),
11954
+ /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
11955
+ "div",
11956
+ {
11957
+ className: cn(
11958
+ "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",
11959
+ outcomesScrollState.hasOverflow && !outcomesScrollState.isAtBottom ? "opacity-100" : "opacity-0"
11960
+ ),
11961
+ style: { height: OUTCOMES_SCROLL_MASK_HEIGHT_PX }
11962
+ }
11963
+ )
11964
+ ] }),
11823
11965
  /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(
11824
11966
  "div",
11825
11967
  {
@@ -11837,6 +11979,14 @@ var EventListItemContent = ({
11837
11979
  "agg-event-meta flex min-w-0 flex-1 items-center gap-2 text-agg-sm leading-agg-5 truncate"
11838
11980
  ),
11839
11981
  children: [
11982
+ outcomesScrollState.remainingMarkets > 0 ? /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
11983
+ Typography,
11984
+ {
11985
+ variant: "body",
11986
+ className: "agg-event-remaining-markets shrink-0 text-agg-sm leading-agg-5 text-agg-muted-foreground",
11987
+ children: labels.eventItem.remainingMarkets(outcomesScrollState.remainingMarkets)
11988
+ }
11989
+ ) : null,
11840
11990
  shouldShowMatchedVenueSummary ? /* @__PURE__ */ (0, import_jsx_runtime136.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,
11841
11991
  singleFooterVenue ? /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)("span", { className: "agg-event-single-venue flex min-w-0 items-center gap-1 overflow-hidden", children: [
11842
11992
  /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
@@ -13894,13 +14044,6 @@ var parseSettlementBlocks = (input) => {
13894
14044
  }
13895
14045
  return blocks;
13896
14046
  };
13897
- var getFirstSettlementParagraph = (input) => {
13898
- if (!input) return "";
13899
- const blocks = parseSettlementBlocks(input);
13900
- const firstParagraph = blocks.find((block) => block.kind === "paragraph");
13901
- if (!firstParagraph || firstParagraph.kind !== "paragraph") return "";
13902
- return firstParagraph.lines.join(" ").trim();
13903
- };
13904
14047
  var normalizeSettlementForCompare = (input) => {
13905
14048
  return stripHtmlFragments(input).replace(/\s+/g, " ").trim().toLowerCase();
13906
14049
  };
@@ -14069,8 +14212,204 @@ SettlementTextRenderer.displayName = "SettlementTextRenderer";
14069
14212
  // src/trading/settlement/index.tsx
14070
14213
  var import_jsx_runtime140 = require("react/jsx-runtime");
14071
14214
  var SETTLEMENT_SECTION_ID = "agg-settlement-section";
14072
- var getSettlementHeaderClassName = () => {
14073
- return "flex items-center justify-between gap-4";
14215
+ var getSettlementDifferenceId = (sectionId, canonicalKey) => {
14216
+ return `${sectionId}-difference-${canonicalKey}`;
14217
+ };
14218
+ var dateOnlyRegex = /^(\d{4})-(\d{2})-(\d{2})$/;
14219
+ var isoTimestampWithTimezoneRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(?::\d{2}(?:\.\d{1,9})?)?(?:Z|[+-]\d{2}:?\d{2})$/i;
14220
+ var normalizeDifferenceText = (value) => {
14221
+ return value.trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
14222
+ };
14223
+ var resolveCanonicalDifferenceKey = (difference) => {
14224
+ const normalizedType = normalizeDifferenceText(difference.type);
14225
+ const combined = normalizeDifferenceText(`${difference.type} ${difference.title}`);
14226
+ if (combined.includes("start_date") || combined.includes("open_date")) return "start_date";
14227
+ if (combined.includes("end_date") || combined.includes("close_date") || combined.includes("closing_date") || combined.includes("expiration_date") || combined.includes("expiry_date")) {
14228
+ return "end_date";
14229
+ }
14230
+ 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")) {
14231
+ return "resolution_timing";
14232
+ }
14233
+ return normalizedType || "other";
14234
+ };
14235
+ var parseSettlementDateMs = (value) => {
14236
+ const trimmed = value.trim();
14237
+ const dateOnlyMatch = dateOnlyRegex.exec(trimmed);
14238
+ if (dateOnlyMatch) {
14239
+ const [, year, month, day] = dateOnlyMatch;
14240
+ return Date.UTC(Number(year), Number(month) - 1, Number(day));
14241
+ }
14242
+ if (!isoTimestampWithTimezoneRegex.test(trimmed)) return null;
14243
+ const ms = Date.parse(trimmed);
14244
+ return Number.isNaN(ms) ? null : ms;
14245
+ };
14246
+ var isDateLikeDifference = (canonicalKey) => {
14247
+ return canonicalKey === "resolution_timing" || canonicalKey === "start_date" || canonicalKey === "end_date";
14248
+ };
14249
+ var hasEqualNormalizedDateValues = (difference, canonicalKey) => {
14250
+ if (!isDateLikeDifference(canonicalKey)) return false;
14251
+ const values = Object.values(difference.perVenue);
14252
+ if (values.length < 2) return false;
14253
+ const timestamps = values.map(parseSettlementDateMs);
14254
+ if (timestamps.some((timestamp) => timestamp === null)) return false;
14255
+ return new Set(timestamps).size === 1;
14256
+ };
14257
+ var resolveDifferenceSeverity = (difference, canonicalKey) => {
14258
+ var _a;
14259
+ const combined = normalizeDifferenceText(
14260
+ `${difference.type} ${difference.title} ${(_a = difference.summary) != null ? _a : ""}`
14261
+ );
14262
+ if (isDateLikeDifference(canonicalKey)) return "critical";
14263
+ if (canonicalKey === "scope" || canonicalKey === "threshold" || canonicalKey === "edge_cases") {
14264
+ return "critical";
14265
+ }
14266
+ if (combined.includes("conflict") || combined.includes("void") || combined.includes("cancel") || combined.includes("postpone") || combined.includes("recount") || combined.includes("overtime") || combined.includes("extra_time")) {
14267
+ return "critical";
14268
+ }
14269
+ return "informational";
14270
+ };
14271
+ var mergePerVenueValues = (current, next) => {
14272
+ return Object.entries(next).reduce(
14273
+ (merged, [venue, value]) => {
14274
+ if (merged[venue] === void 0) merged[venue] = value;
14275
+ return merged;
14276
+ },
14277
+ __spreadValues({}, current)
14278
+ );
14279
+ };
14280
+ var prepareSettlementDifferences = (differences) => {
14281
+ const byCanonicalKey = /* @__PURE__ */ new Map();
14282
+ for (const [originalIndex, rawDifference] of (differences != null ? differences : []).entries()) {
14283
+ const title2 = rawDifference.title.trim();
14284
+ const perVenue = Object.fromEntries(
14285
+ Object.entries(rawDifference.perVenue).map(([venue, value]) => [venue.trim(), value.trim()]).filter(([venue, value]) => venue.length > 0 && value.length > 0)
14286
+ );
14287
+ if (!title2 || Object.keys(perVenue).length === 0) continue;
14288
+ const difference = __spreadProps(__spreadValues({}, rawDifference), { title: title2, perVenue });
14289
+ const canonicalKey = resolveCanonicalDifferenceKey(difference);
14290
+ if (hasEqualNormalizedDateValues(difference, canonicalKey)) continue;
14291
+ const existing = byCanonicalKey.get(canonicalKey);
14292
+ if (existing) {
14293
+ byCanonicalKey.set(canonicalKey, __spreadProps(__spreadValues({}, existing), {
14294
+ perVenue: mergePerVenueValues(existing.perVenue, difference.perVenue)
14295
+ }));
14296
+ continue;
14297
+ }
14298
+ byCanonicalKey.set(canonicalKey, __spreadProps(__spreadValues({}, difference), {
14299
+ canonicalKey,
14300
+ severity: resolveDifferenceSeverity(difference, canonicalKey),
14301
+ originalIndex
14302
+ }));
14303
+ }
14304
+ return Array.from(byCanonicalKey.values()).sort((left, right) => {
14305
+ const severityDelta = Number(right.severity === "critical") - Number(left.severity === "critical");
14306
+ if (severityDelta !== 0) return severityDelta;
14307
+ return left.originalIndex - right.originalIndex;
14308
+ });
14309
+ };
14310
+ var formatVenueFallbackLabel = (venue) => {
14311
+ return venue.split(/[-_\s]+/).filter(Boolean).map((part) => `${part.slice(0, 1).toUpperCase()}${part.slice(1)}`).join(" ");
14312
+ };
14313
+ var resolveSettlementVenueLabel = (venue, labels) => {
14314
+ var _a;
14315
+ return (_a = labels.venues[venue]) != null ? _a : formatVenueFallbackLabel(venue);
14316
+ };
14317
+ var resolveDifferenceVenueKeys = (difference, settlementVenues) => {
14318
+ const explicitVenues = Object.keys(difference.perVenue);
14319
+ if (!isDateLikeDifference(difference.canonicalKey)) return explicitVenues;
14320
+ const allVenues = [...settlementVenues != null ? settlementVenues : [], ...explicitVenues];
14321
+ return Array.from(new Set(allVenues.filter((venue) => venue.trim().length > 0)));
14322
+ };
14323
+ var resolveDifferenceIconClassName = (canonicalKey) => {
14324
+ if (canonicalKey.includes("source") || canonicalKey.includes("url")) return "fi-rr-world";
14325
+ if (canonicalKey === "resolution_timing" || canonicalKey.includes("timing")) {
14326
+ return "fi-rr-clock";
14327
+ }
14328
+ if (canonicalKey === "start_date" || canonicalKey.includes("start"))
14329
+ return "fi-rr-calendar-clock";
14330
+ if (canonicalKey === "end_date" || canonicalKey.includes("end")) return "fi-rr-calendar-clock";
14331
+ if (canonicalKey.includes("cancel") || canonicalKey.includes("void") || canonicalKey.includes("postpone")) {
14332
+ return "fi-rr-ban";
14333
+ }
14334
+ if (canonicalKey === "edge_cases" || canonicalKey.includes("edge")) {
14335
+ return "fi-rr-triangle-warning";
14336
+ }
14337
+ if (canonicalKey === "scope") return "fi-rr-layers";
14338
+ if (canonicalKey === "threshold") return "fi-rr-tachometer-alt-fastest";
14339
+ if (canonicalKey.includes("wording")) return "fi-rr-document";
14340
+ return "fi-rr-info";
14341
+ };
14342
+ var buildSettlementVenueRules = ({
14343
+ marketBlock,
14344
+ primaryRulesBlock,
14345
+ settlementVenues,
14346
+ settlementVenueRules
14347
+ }) => {
14348
+ var _a, _b;
14349
+ if (settlementVenueRules) {
14350
+ const rulesByVenue = /* @__PURE__ */ new Map();
14351
+ for (const rule of settlementVenueRules) {
14352
+ const venue2 = rule.venue.trim();
14353
+ const content2 = rule.content.trim();
14354
+ if (!venue2 || !content2) continue;
14355
+ const venueRules = (_a = rulesByVenue.get(venue2)) != null ? _a : [];
14356
+ if (!venueRules.includes(content2)) venueRules.push(content2);
14357
+ rulesByVenue.set(venue2, venueRules);
14358
+ }
14359
+ return Array.from(rulesByVenue, ([venue2, contents]) => ({
14360
+ venue: venue2,
14361
+ content: contents.join("\n\n")
14362
+ }));
14363
+ }
14364
+ 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");
14365
+ const venue = (_b = settlementVenues == null ? void 0 : settlementVenues.find((candidate) => candidate.trim().length > 0)) == null ? void 0 : _b.trim();
14366
+ return content && venue ? [{ venue, content }] : [];
14367
+ };
14368
+ var isDuplicatedByVenueRules = (content, venueRules) => {
14369
+ const normalizedContent = normalizeSettlementForCompare(content);
14370
+ if (!normalizedContent) return false;
14371
+ return venueRules.some((rule) => {
14372
+ const normalizedRule = normalizeSettlementForCompare(rule.content);
14373
+ return normalizedRule.includes(normalizedContent);
14374
+ });
14375
+ };
14376
+ var SettlementVenueRules = ({
14377
+ rules,
14378
+ labels
14379
+ }) => {
14380
+ return /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)("div", { className: "agg-settlement-venue-rules flex w-full flex-col items-start gap-4", children: [
14381
+ /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: labels.trading.settlementFullRulesTitle }),
14382
+ /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("div", { className: "flex w-full flex-col items-start gap-4", children: rules.map((rule) => {
14383
+ const venueLabel = resolveSettlementVenueLabel(rule.venue, labels);
14384
+ return /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)("details", { className: "group/agg-settlement-rule w-full", children: [
14385
+ /* @__PURE__ */ (0, import_jsx_runtime140.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: [
14386
+ /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
14387
+ VenueLogo,
14388
+ {
14389
+ venue: rule.venue,
14390
+ size: "small",
14391
+ className: "size-4",
14392
+ ariaLabel: venueLabel
14393
+ }
14394
+ ),
14395
+ /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("span", { className: "text-agg-foreground group-hover/agg-settlement-rule:text-agg-muted-foreground transition-colors", children: venueLabel }),
14396
+ /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
14397
+ "i",
14398
+ {
14399
+ className: cn(
14400
+ "fi fi-rr-angle-small-down text-[14px]!",
14401
+ "group-open/agg-settlement-rule:rotate-180",
14402
+ "size-3.5! shrink-0 text-agg-foreground group-hover/agg-settlement-rule:text-agg-muted-foreground transition-[colors,transform]"
14403
+ ),
14404
+ style: { fontSize: 14 },
14405
+ "aria-hidden": "true"
14406
+ }
14407
+ )
14408
+ ] }),
14409
+ /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("div", { className: "mt-3 pl-6", children: /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(SettlementTextRenderer, { content: rule.content }) })
14410
+ ] }, rule.venue);
14411
+ }) })
14412
+ ] });
14074
14413
  };
14075
14414
  var Settlement = ({
14076
14415
  className,
@@ -14080,9 +14419,12 @@ var Settlement = ({
14080
14419
  eventDescription,
14081
14420
  marketDescription,
14082
14421
  primaryRules,
14422
+ settlementDiff,
14423
+ settlementVenues,
14424
+ settlementVenueRules,
14083
14425
  isLoading = false
14084
14426
  }) => {
14085
- var _a, _b, _c;
14427
+ var _a, _b, _c, _d, _e;
14086
14428
  const labels = (0, import_hooks46.useLabels)();
14087
14429
  const blocks = (0, import_react22.useMemo)(
14088
14430
  () => dedupeSettlementSources({
@@ -14092,9 +14434,41 @@ var Settlement = ({
14092
14434
  }),
14093
14435
  [eventDescription, marketDescription, primaryRules]
14094
14436
  );
14437
+ const settlementDifferences = (0, import_react22.useMemo)(
14438
+ () => prepareSettlementDifferences(settlementDiff == null ? void 0 : settlementDiff.differences),
14439
+ [settlementDiff == null ? void 0 : settlementDiff.differences]
14440
+ );
14095
14441
  const eventBlock = (_a = blocks.find((block) => block.key === "eventDescription")) != null ? _a : null;
14096
14442
  const marketBlock = (_b = blocks.find((block) => block.key === "marketDescription")) != null ? _b : null;
14097
14443
  const primaryRulesBlock = (_c = blocks.find((block) => block.key === "primaryRules")) != null ? _c : null;
14444
+ const venueRuleBlocks = (0, import_react22.useMemo)(
14445
+ () => buildSettlementVenueRules({
14446
+ marketBlock,
14447
+ primaryRulesBlock,
14448
+ settlementVenues,
14449
+ settlementVenueRules
14450
+ }),
14451
+ [marketBlock, primaryRulesBlock, settlementVenues, settlementVenueRules]
14452
+ );
14453
+ const hasSettlementDifferences = settlementDifferences.length > 0;
14454
+ const hasVenueSettlementRules = venueRuleBlocks.length > 0;
14455
+ const standaloneEventBlock = eventBlock && !isDuplicatedByVenueRules(eventBlock.content, venueRuleBlocks) ? eventBlock : null;
14456
+ const standaloneMarketBlock = hasVenueSettlementRules ? null : marketBlock;
14457
+ const standalonePrimaryRulesBlock = hasVenueSettlementRules ? null : primaryRulesBlock;
14458
+ const hasStandaloneSettlementText = hasVenueSettlementRules ? standaloneEventBlock !== null : blocks.length > 0;
14459
+ const hasSettlementContent = hasSettlementDifferences || hasVenueSettlementRules || hasStandaloneSettlementText;
14460
+ const defaultOpenDifferenceKey = (_e = (_d = settlementDifferences[0]) == null ? void 0 : _d.canonicalKey) != null ? _e : null;
14461
+ const [openDifferenceKeys, setOpenDifferenceKeys] = (0, import_react22.useState)(
14462
+ () => defaultOpenDifferenceKey ? [defaultOpenDifferenceKey] : []
14463
+ );
14464
+ (0, import_react22.useEffect)(() => {
14465
+ setOpenDifferenceKeys(defaultOpenDifferenceKey ? [defaultOpenDifferenceKey] : []);
14466
+ }, [defaultOpenDifferenceKey]);
14467
+ const handleToggleDifference = (canonicalKey) => {
14468
+ setOpenDifferenceKeys(
14469
+ (currentKeys) => currentKeys.includes(canonicalKey) ? currentKeys.filter((currentKey) => currentKey !== canonicalKey) : [...currentKeys, canonicalKey]
14470
+ );
14471
+ };
14098
14472
  if (isLoading) {
14099
14473
  return /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
14100
14474
  Skeleton,
@@ -14105,6 +14479,7 @@ var Settlement = ({
14105
14479
  }
14106
14480
  );
14107
14481
  }
14482
+ if (!hasSettlementContent) return null;
14108
14483
  const resolvedSectionLabel = sectionLabel === defaultSettlementSectionLabel ? labels.trading.settlementSection : sectionLabel;
14109
14484
  return /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)(
14110
14485
  Card,
@@ -14112,38 +14487,117 @@ var Settlement = ({
14112
14487
  id,
14113
14488
  className: cn(
14114
14489
  "group/agg-settlement-card",
14115
- "flex flex-col w-full gap-5 rounded-agg-xl border border-agg-separator bg-agg-secondary p-5 shadow-none hover:shadow-none",
14490
+ "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",
14116
14491
  className
14117
14492
  ),
14118
14493
  children: [
14119
- /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)("div", { className: cn("agg-settlement-header", getSettlementHeaderClassName()), children: [
14120
- /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("p", { className: "text-agg-xs font-agg-bold leading-agg-4 uppercase text-agg-muted-foreground", children: resolvedSectionLabel }),
14121
- question ? /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("p", { className: "agg-settlement-question text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: question }) : null
14494
+ /* @__PURE__ */ (0, import_jsx_runtime140.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: [
14495
+ /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("p", { className: "shrink-0 text-agg-xs font-agg-bold leading-agg-4 uppercase", children: resolvedSectionLabel }),
14496
+ question ? /* @__PURE__ */ (0, import_jsx_runtime140.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
14122
14497
  ] }),
14123
- blocks.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("p", { className: "agg-settlement-empty text-agg-sm leading-agg-5 text-agg-muted-foreground", children: labels.trading.settlementEmpty }) : /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)("div", { className: "agg-settlement-sections flex flex-col gap-4", children: [
14124
- eventBlock || marketBlock ? /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)(
14125
- "div",
14126
- {
14127
- className: "agg-settlement-section agg-settlement-section-description",
14128
- "data-source": "description",
14129
- children: [
14130
- eventBlock ? /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("div", { "data-source": "eventDescription", children: /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(SettlementTextRenderer, { content: eventBlock.content }) }) : null,
14131
- eventBlock && marketBlock ? /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("hr", { className: "agg-settlement-divider my-4 border-0 border-t border-agg-separator" }) : null,
14132
- marketBlock ? /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("div", { "data-source": "marketDescription", children: /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(SettlementTextRenderer, { content: marketBlock.content }) }) : null
14133
- ]
14134
- }
14135
- ) : null,
14136
- primaryRulesBlock ? /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)(
14137
- "div",
14138
- {
14139
- className: "agg-settlement-section agg-settlement-section-primaryRules",
14140
- "data-source": "primaryRules",
14141
- children: [
14142
- /* @__PURE__ */ (0, import_jsx_runtime140.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 }),
14143
- /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(SettlementTextRenderer, { content: primaryRulesBlock.content })
14144
- ]
14145
- }
14146
- ) : null
14498
+ /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)("div", { className: "agg-settlement-sections flex w-full flex-col items-start gap-5", children: [
14499
+ hasStandaloneSettlementText ? /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)("div", { className: "w-full", children: [
14500
+ standaloneEventBlock || standaloneMarketBlock ? /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)(
14501
+ "div",
14502
+ {
14503
+ className: "agg-settlement-section agg-settlement-section-description",
14504
+ "data-source": "description",
14505
+ children: [
14506
+ standaloneEventBlock ? /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("div", { "data-source": "eventDescription", children: /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(SettlementTextRenderer, { content: standaloneEventBlock.content }) }) : null,
14507
+ standaloneEventBlock && standaloneMarketBlock ? /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("hr", { className: "agg-settlement-divider my-4 border-0 border-t border-agg-separator" }) : null,
14508
+ standaloneMarketBlock ? /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("div", { "data-source": "marketDescription", children: /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(SettlementTextRenderer, { content: standaloneMarketBlock.content }) }) : null
14509
+ ]
14510
+ }
14511
+ ) : null,
14512
+ standalonePrimaryRulesBlock ? /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)(
14513
+ "div",
14514
+ {
14515
+ className: "agg-settlement-section agg-settlement-section-primaryRules",
14516
+ "data-source": "primaryRules",
14517
+ children: [
14518
+ /* @__PURE__ */ (0, import_jsx_runtime140.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 }),
14519
+ /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(SettlementTextRenderer, { content: standalonePrimaryRulesBlock.content })
14520
+ ]
14521
+ }
14522
+ ) : null
14523
+ ] }) : null,
14524
+ hasSettlementDifferences ? /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)("div", { className: "agg-settlement-differences flex w-full flex-col items-start gap-5", children: [
14525
+ /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)("div", { className: "flex items-center gap-2", children: [
14526
+ /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: labels.trading.settlementDifferencesTitle }),
14527
+ /* @__PURE__ */ (0, import_jsx_runtime140.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 })
14528
+ ] }),
14529
+ /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("div", { className: "flex w-full flex-col items-start gap-5", children: settlementDifferences.map((difference) => {
14530
+ const venueKeys = resolveDifferenceVenueKeys(difference, settlementVenues);
14531
+ const isExpanded = openDifferenceKeys.includes(difference.canonicalKey) && venueKeys.length > 0;
14532
+ return /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)(
14533
+ "div",
14534
+ {
14535
+ id: getSettlementDifferenceId(id, difference.canonicalKey),
14536
+ className: "agg-settlement-difference flex w-full flex-col items-start gap-2 rounded-agg-lg",
14537
+ children: [
14538
+ /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)(
14539
+ "button",
14540
+ {
14541
+ type: "button",
14542
+ className: "flex w-full cursor-pointer items-center gap-2 text-left group/agg-settlement-difference",
14543
+ "aria-expanded": isExpanded,
14544
+ onClick: () => handleToggleDifference(difference.canonicalKey),
14545
+ children: [
14546
+ /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
14547
+ "i",
14548
+ {
14549
+ className: cn(
14550
+ "fi",
14551
+ resolveDifferenceIconClassName(difference.canonicalKey),
14552
+ "inline-flex size-4! shrink-0 items-center justify-center text-[16px] leading-none text-agg-muted-foreground"
14553
+ ),
14554
+ "aria-hidden": "true"
14555
+ }
14556
+ ),
14557
+ /* @__PURE__ */ (0, import_jsx_runtime140.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 }),
14558
+ /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
14559
+ "i",
14560
+ {
14561
+ className: cn(
14562
+ "fi fi-rr-angle-small-down text-[14px]!",
14563
+ isExpanded && "rotate-180",
14564
+ "size-3.5! shrink-0 text-agg-foreground group-hover/agg-settlement-difference:text-agg-muted-foreground transition-[colors,transform]"
14565
+ ),
14566
+ style: { fontSize: 14 },
14567
+ "aria-hidden": "true"
14568
+ }
14569
+ )
14570
+ ]
14571
+ }
14572
+ ),
14573
+ isExpanded ? /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("dl", { className: "flex w-full flex-col items-start gap-1 px-6", children: venueKeys.map((venue) => {
14574
+ var _a2;
14575
+ const venueValue = (_a2 = difference.perVenue[venue]) != null ? _a2 : labels.trading.settlementValueUnavailable;
14576
+ const venueLabel = resolveSettlementVenueLabel(venue, labels);
14577
+ return /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)("div", { className: "flex w-full items-start gap-2", children: [
14578
+ /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
14579
+ VenueLogo,
14580
+ {
14581
+ venue,
14582
+ size: "small",
14583
+ className: "mt-0.5 size-4",
14584
+ ariaLabel: venueLabel
14585
+ }
14586
+ ),
14587
+ /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("dt", { className: "w-[88px] shrink-0 text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground", children: venueLabel }),
14588
+ /* @__PURE__ */ (0, import_jsx_runtime140.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 })
14589
+ ] }, venue);
14590
+ }) }) : null
14591
+ ]
14592
+ },
14593
+ difference.canonicalKey
14594
+ );
14595
+ }) })
14596
+ ] }) : null,
14597
+ hasVenueSettlementRules ? /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)(import_jsx_runtime140.Fragment, { children: [
14598
+ hasSettlementDifferences || hasStandaloneSettlementText ? /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("div", { className: "h-px w-full bg-agg-separator" }) : null,
14599
+ /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(SettlementVenueRules, { rules: venueRuleBlocks, labels })
14600
+ ] }) : null
14147
14601
  ] })
14148
14602
  ]
14149
14603
  }
@@ -14154,13 +14608,16 @@ Settlement.displayName = "Settlement";
14154
14608
  // src/events/item-details/settlement-summary.tsx
14155
14609
  var import_jsx_runtime141 = require("react/jsx-runtime");
14156
14610
  var SettlementSummary = ({
14157
- content,
14611
+ settlementDiff,
14158
14612
  settlementSectionId = SETTLEMENT_SECTION_ID,
14159
14613
  className
14160
14614
  }) => {
14161
14615
  const labels = (0, import_hooks47.useLabels)();
14162
- const firstParagraph = (0, import_react23.useMemo)(() => getFirstSettlementParagraph(content), [content]);
14163
- if (!firstParagraph) return null;
14616
+ const settlementDifferences = (0, import_react23.useMemo)(
14617
+ () => prepareSettlementDifferences(settlementDiff == null ? void 0 : settlementDiff.differences),
14618
+ [settlementDiff == null ? void 0 : settlementDiff.differences]
14619
+ );
14620
+ if (settlementDifferences.length === 0) return null;
14164
14621
  const handleReadFullDetails = (event) => {
14165
14622
  event.preventDefault();
14166
14623
  event.stopPropagation();
@@ -14169,43 +14626,78 @@ var SettlementSummary = ({
14169
14626
  if (!target) return;
14170
14627
  target.scrollIntoView({ behavior: "smooth", block: "start" });
14171
14628
  };
14172
- return /* @__PURE__ */ (0, import_jsx_runtime141.jsxs)("div", { className: cn("agg-settlement-summary flex w-full flex-col gap-2", className), children: [
14173
- /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(
14174
- Typography,
14175
- {
14176
- variant: "caption-caps",
14177
- className: "agg-settlement-summary-label text-agg-muted-foreground",
14178
- children: labels.settlementSummary.title
14179
- }
14180
- ),
14181
- /* @__PURE__ */ (0, import_jsx_runtime141.jsxs)("div", { className: "agg-settlement-summary-row flex w-full items-center gap-3", children: [
14182
- /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(
14183
- "p",
14184
- {
14185
- className: cn(
14186
- "agg-settlement-summary-text",
14187
- "min-w-0 flex-1 truncate text-agg-sm leading-agg-5 text-agg-foreground"
14188
- ),
14189
- children: firstParagraph
14190
- }
14629
+ const actionButton = /* @__PURE__ */ (0, import_jsx_runtime141.jsxs)(
14630
+ "button",
14631
+ {
14632
+ type: "button",
14633
+ className: cn(
14634
+ "agg-settlement-summary-toggle",
14635
+ "inline-flex shrink-0 cursor-pointer items-center gap-1 whitespace-nowrap text-agg-sm font-agg-bold leading-agg-5 text-agg-primary",
14636
+ "hover:opacity-80",
14637
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-0 focus-visible:ring-offset-agg-secondary"
14191
14638
  ),
14192
- /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(
14193
- "button",
14194
- {
14195
- type: "button",
14196
- className: cn(
14197
- "agg-settlement-summary-toggle",
14198
- "shrink-0 cursor-pointer whitespace-nowrap text-agg-sm font-agg-bold leading-agg-5 text-agg-primary",
14199
- "hover:opacity-80",
14200
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-0 focus-visible:ring-offset-agg-secondary"
14201
- ),
14202
- "aria-controls": settlementSectionId,
14203
- onClick: handleReadFullDetails,
14204
- children: labels.settlementSummary.readFullDetails
14205
- }
14206
- )
14207
- ] })
14208
- ] });
14639
+ "aria-controls": settlementSectionId,
14640
+ onClick: handleReadFullDetails,
14641
+ children: [
14642
+ /* @__PURE__ */ (0, import_jsx_runtime141.jsx)("span", { children: labels.settlementSummary.readFullDetails }),
14643
+ /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(
14644
+ "i",
14645
+ {
14646
+ className: "fi fi-rr-arrow-small-down size-3.5!",
14647
+ "aria-hidden": "true",
14648
+ style: { fontSize: 14 }
14649
+ }
14650
+ )
14651
+ ]
14652
+ }
14653
+ );
14654
+ const visibleDifferences = settlementDifferences.slice(0, 2);
14655
+ const hiddenDifferenceCount = settlementDifferences.length - visibleDifferences.length;
14656
+ return /* @__PURE__ */ (0, import_jsx_runtime141.jsxs)(
14657
+ "div",
14658
+ {
14659
+ className: cn(
14660
+ "agg-settlement-summary flex w-full flex-wrap items-start justify-between gap-x-4 gap-y-2",
14661
+ className
14662
+ ),
14663
+ children: [
14664
+ /* @__PURE__ */ (0, import_jsx_runtime141.jsxs)("div", { className: "flex min-w-[240px] flex-1 flex-wrap items-center gap-x-5 gap-y-3", children: [
14665
+ /* @__PURE__ */ (0, import_jsx_runtime141.jsxs)("div", { className: "agg-settlement-summary-heading flex shrink-0 items-center gap-2", children: [
14666
+ /* @__PURE__ */ (0, import_jsx_runtime141.jsx)("p", { className: "text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground", children: labels.settlementSummary.title }),
14667
+ /* @__PURE__ */ (0, import_jsx_runtime141.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 })
14668
+ ] }),
14669
+ /* @__PURE__ */ (0, import_jsx_runtime141.jsxs)("div", { className: "agg-settlement-summary-pills flex min-w-[240px] flex-1 flex-wrap items-center gap-2", children: [
14670
+ visibleDifferences.map((difference) => /* @__PURE__ */ (0, import_jsx_runtime141.jsxs)(
14671
+ "span",
14672
+ {
14673
+ 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]",
14674
+ children: [
14675
+ /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(
14676
+ "i",
14677
+ {
14678
+ className: cn(
14679
+ "fi",
14680
+ resolveDifferenceIconClassName(difference.canonicalKey),
14681
+ "inline-flex size-3 shrink-0 items-center justify-center text-[12px] leading-none text-agg-muted-foreground"
14682
+ ),
14683
+ "aria-hidden": "true"
14684
+ }
14685
+ ),
14686
+ /* @__PURE__ */ (0, import_jsx_runtime141.jsx)("span", { className: "min-w-0 truncate", children: difference.title })
14687
+ ]
14688
+ },
14689
+ difference.canonicalKey
14690
+ )),
14691
+ hiddenDifferenceCount > 0 ? /* @__PURE__ */ (0, import_jsx_runtime141.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: [
14692
+ "+",
14693
+ hiddenDifferenceCount
14694
+ ] }) : null
14695
+ ] })
14696
+ ] }),
14697
+ actionButton
14698
+ ]
14699
+ }
14700
+ );
14209
14701
  };
14210
14702
  SettlementSummary.displayName = "SettlementSummary";
14211
14703
 
@@ -14940,7 +15432,7 @@ var EventListItemDetailsContent = ({
14940
15432
  }
14941
15433
  )
14942
15434
  ] }),
14943
- event.description ? /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(SettlementSummary, { content: event.description }) : null
15435
+ event.description || event.settlementDiff ? /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(SettlementSummary, { content: event.description, settlementDiff: event.settlementDiff }) : null
14944
15436
  ]
14945
15437
  }
14946
15438
  );
@@ -16846,7 +17338,7 @@ var MarketDetailsContent = ({
16846
17338
  value: selectedTab === "other" ? "order-book" : selectedTab,
16847
17339
  onChange: (nextValue) => setSelectedTab(nextValue),
16848
17340
  variant: "underline",
16849
- className: "agg-market-tabs w-full px-5"
17341
+ className: "agg-market-tabs flex! w-full px-5"
16850
17342
  }
16851
17343
  ) }),
16852
17344
  /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("div", { className: "h-px w-full bg-agg-separator" })
@@ -17216,7 +17708,7 @@ MarketDetailsList.displayName = "MarketDetailsList";
17216
17708
 
17217
17709
  // src/events/list/index.tsx
17218
17710
  var import_hooks53 = require("@agg-build/hooks");
17219
- var import_sdk15 = require("@agg-build/sdk");
17711
+ var import_sdk16 = require("@agg-build/sdk");
17220
17712
  var Dialog2 = __toESM(require("@radix-ui/react-dialog"));
17221
17713
  var import_react31 = require("react");
17222
17714
 
@@ -17339,6 +17831,7 @@ CategorySidebar.displayName = "CategorySidebar";
17339
17831
 
17340
17832
  // src/events/list/event-list-tabs.tsx
17341
17833
  var import_hooks52 = require("@agg-build/hooks");
17834
+ var import_sdk15 = require("@agg-build/sdk");
17342
17835
  var import_react30 = require("react");
17343
17836
 
17344
17837
  // src/events/list/event-list.constants.ts
@@ -17363,12 +17856,6 @@ var getDefaultEventListTabs = (labels) => {
17363
17856
  venueLogo: import_sdk14.Venue.polymarket,
17364
17857
  venues: [import_sdk14.Venue.polymarket]
17365
17858
  },
17366
- {
17367
- value: import_sdk14.Venue.kalshi,
17368
- label: labels.venues.kalshi,
17369
- venueLogo: import_sdk14.Venue.kalshi,
17370
- venues: [import_sdk14.Venue.kalshi]
17371
- },
17372
17859
  {
17373
17860
  value: import_sdk14.Venue.limitless,
17374
17861
  label: labels.venues.limitless,
@@ -17432,6 +17919,7 @@ var useEventListTabs = (tabs) => {
17432
17919
  const baseTabs = tabs != null ? tabs : getDefaultEventListTabs(labels);
17433
17920
  return baseTabs.flatMap((tab) => {
17434
17921
  if (!tab.venueLogo) return [tab];
17922
+ if (!(0, import_sdk15.isVenueActive)(tab.venueLogo)) return [];
17435
17923
  const availabilityState = (0, import_hooks52.getVenueAvailabilityState)({
17436
17924
  venueId: tab.venueLogo,
17437
17925
  disabledVenues,
@@ -17624,7 +18112,7 @@ var EventList = ({
17624
18112
  const isDiscoveryFiltersEnabled = enableVenueEventDiscoveryFilters && !search;
17625
18113
  const resolvedTabs = useEventListTabs();
17626
18114
  const visibleVenues = (0, import_react31.useMemo)(
17627
- () => disabledVenues.length === 0 ? void 0 : (0, import_hooks53.getVisibleVenueIdsByConfig)(import_sdk15.VENUES, disabledVenues),
18115
+ () => disabledVenues.length === 0 ? void 0 : (0, import_hooks53.getVisibleVenueIdsByConfig)(import_sdk16.VENUES, disabledVenues),
17628
18116
  [disabledVenues]
17629
18117
  );
17630
18118
  const [activeTabValue, setActiveTabValue] = (0, import_react31.useState)(
@@ -18082,7 +18570,7 @@ EventList.displayName = "EventList";
18082
18570
 
18083
18571
  // src/pages/home/index.tsx
18084
18572
  var import_hooks65 = require("@agg-build/hooks");
18085
- var import_sdk18 = require("@agg-build/sdk");
18573
+ var import_sdk19 = require("@agg-build/sdk");
18086
18574
  var import_react45 = require("react");
18087
18575
 
18088
18576
  // src/pages/event-market/index.tsx
@@ -18090,10 +18578,10 @@ var import_hooks64 = require("@agg-build/hooks");
18090
18578
  var import_react42 = require("react");
18091
18579
 
18092
18580
  // src/trading/types.ts
18093
- var import_sdk16 = require("@agg-build/sdk");
18094
- var isVenue = (0, import_sdk16.enumGuard)(import_sdk16.Venue);
18095
- var parseVenue = (v) => (0, import_sdk16.safeParse)(v, isVenue);
18096
- var parseAmount = (v) => (0, import_sdk16.safeParse)(v, import_sdk16.isFiniteNonNeg);
18581
+ var import_sdk17 = require("@agg-build/sdk");
18582
+ var isVenue = (0, import_sdk17.enumGuard)(import_sdk17.Venue);
18583
+ var parseVenue = (v) => (0, import_sdk17.safeParse)(v, isVenue);
18584
+ var parseAmount = (v) => (0, import_sdk17.safeParse)(v, import_sdk17.isFiniteNonNeg);
18097
18585
 
18098
18586
  // src/trading/settlement/settlement-details.tsx
18099
18587
  var import_hooks54 = require("@agg-build/hooks");
@@ -18101,26 +18589,63 @@ var import_jsx_runtime151 = require("react/jsx-runtime");
18101
18589
  var hasContent = (value) => {
18102
18590
  return typeof value === "string" && value.trim().length > 0;
18103
18591
  };
18592
+ var buildVenueSettlementRules = (venueMarkets) => {
18593
+ var _a;
18594
+ const contentByVenue = /* @__PURE__ */ new Map();
18595
+ for (const venueMarket of venueMarkets) {
18596
+ const content = [venueMarket.description, venueMarket.rulesPrimary, venueMarket.rulesSecondary].filter(hasContent).map((value) => value.trim());
18597
+ if (content.length === 0) continue;
18598
+ const venueContent = (_a = contentByVenue.get(venueMarket.venue)) != null ? _a : [];
18599
+ for (const value of content) {
18600
+ if (!venueContent.includes(value)) venueContent.push(value);
18601
+ }
18602
+ contentByVenue.set(venueMarket.venue, venueContent);
18603
+ }
18604
+ return Array.from(contentByVenue, ([venue, content]) => ({
18605
+ venue,
18606
+ content: content.join("\n\n")
18607
+ }));
18608
+ };
18104
18609
  var SettlementDetails = ({ className }) => {
18105
18610
  var _a, _b, _c, _d, _e, _f;
18106
18611
  const tradingContext = (0, import_hooks54.useEventTradingContext)();
18107
18612
  const selectedEvent = (_a = tradingContext == null ? void 0 : tradingContext.selectedEvent) != null ? _a : null;
18108
18613
  const selectedMarket = (_b = tradingContext == null ? void 0 : tradingContext.selectedMarket) != null ? _b : null;
18109
18614
  if (!selectedEvent) return null;
18110
- if (!selectedMarket) return null;
18615
+ const activeMarket = selectedMarket != null ? selectedMarket : (0, import_hooks54.resolveDefaultTradingMarket)(selectedEvent);
18616
+ if (!activeMarket) return null;
18617
+ const allVenueMarkets = normalizeVenueMarketCluster(selectedEvent.venueMarkets);
18618
+ const activeMarketCluster = normalizeVenueMarketCluster(
18619
+ selectedEvent.venueMarkets,
18620
+ activeMarket.id
18621
+ );
18622
+ const activeMarketIds = new Set(activeMarketCluster.map((market) => market.id));
18623
+ const orderedActiveMarketCluster = allVenueMarkets.filter(
18624
+ (market) => activeMarketIds.has(market.id)
18625
+ );
18111
18626
  const eventDescription = (_c = selectedEvent.description) != null ? _c : null;
18112
- const marketDescription = (_d = selectedMarket.description) != null ? _d : null;
18113
- const primaryRules = (_e = selectedMarket.rulesPrimary) != null ? _e : null;
18114
- if (!hasContent(eventDescription) && !hasContent(marketDescription) && !hasContent(primaryRules)) {
18627
+ const marketDescription = (_d = activeMarket.description) != null ? _d : null;
18628
+ const primaryRules = (_e = activeMarket.rulesPrimary) != null ? _e : null;
18629
+ const settlementDiff = (_f = selectedEvent.settlementDiff) != null ? _f : null;
18630
+ const settlementVenues = Array.from(
18631
+ new Set(orderedActiveMarketCluster.map((market) => market.venue))
18632
+ );
18633
+ const settlementVenueRules = buildVenueSettlementRules(orderedActiveMarketCluster);
18634
+ const hasSettlementDifferences = prepareSettlementDifferences(settlementDiff == null ? void 0 : settlementDiff.differences).length > 0;
18635
+ const hasVenueSettlementRules = settlementVenueRules.length > 0;
18636
+ if (!hasContent(eventDescription) && !hasVenueSettlementRules && !hasSettlementDifferences) {
18115
18637
  return null;
18116
18638
  }
18117
18639
  return /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("div", { className: "agg-settlement-list flex flex-col gap-6", children: /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("div", { className: "agg-settlement-list-item", children: /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
18118
18640
  Settlement,
18119
18641
  {
18120
- question: (_f = selectedMarket.question) != null ? _f : selectedEvent.title,
18642
+ question: selectedEvent.title,
18121
18643
  eventDescription,
18122
18644
  marketDescription,
18123
18645
  primaryRules,
18646
+ settlementDiff,
18647
+ settlementVenues,
18648
+ settlementVenueRules,
18124
18649
  className
18125
18650
  }
18126
18651
  ) }) });
@@ -18571,7 +19096,7 @@ var enableExecutionDebugInBrowser = (initial) => {
18571
19096
  };
18572
19097
 
18573
19098
  // src/trading/place-order/index.place-order.execution-steps.ts
18574
- var import_sdk17 = require("@agg-build/sdk");
19099
+ var import_sdk18 = require("@agg-build/sdk");
18575
19100
  var WAIT_STEP_TYPES = /* @__PURE__ */ new Set(["_wait", "wait"]);
18576
19101
  var CHECKING_BALANCE_STEP_TYPES = /* @__PURE__ */ new Set([
18577
19102
  "check-balance",
@@ -18582,14 +19107,14 @@ var CHECKING_BALANCE_STEP_TYPES = /* @__PURE__ */ new Set([
18582
19107
  var VENUE_BUY_SELL_REGEX = /^(?:buy|sell)-([a-z]+)$/;
18583
19108
  var VENUE_FINALIZE_REGEX = /^([a-z]+)-finalize$/;
18584
19109
  var VENUE_NAME_MAP = {
18585
- kalshi: import_sdk17.Venue.kalshi,
18586
- polymarket: import_sdk17.Venue.polymarket,
18587
- limitless: import_sdk17.Venue.limitless,
18588
- opinion: import_sdk17.Venue.opinion,
18589
- predict: import_sdk17.Venue.predict,
18590
- probable: import_sdk17.Venue.probable,
18591
- myriad: import_sdk17.Venue.myriad,
18592
- hyperliquid: import_sdk17.Venue.hyperliquid
19110
+ kalshi: import_sdk18.Venue.kalshi,
19111
+ polymarket: import_sdk18.Venue.polymarket,
19112
+ limitless: import_sdk18.Venue.limitless,
19113
+ opinion: import_sdk18.Venue.opinion,
19114
+ predict: import_sdk18.Venue.predict,
19115
+ probable: import_sdk18.Venue.probable,
19116
+ myriad: import_sdk18.Venue.myriad,
19117
+ hyperliquid: import_sdk18.Venue.hyperliquid
18593
19118
  };
18594
19119
  var parseVenueName = (raw) => VENUE_NAME_MAP[raw];
18595
19120
  var NON_VENUE_FINALIZE_PREFIXES = /* @__PURE__ */ new Set(["bridge"]);
@@ -18770,6 +19295,10 @@ var extractGeoBlockedVenues = (warnings) => {
18770
19295
  warnings.filter((w) => w.venue && isGeoBlockWarningReason(w.reason)).map((w) => w.venue)
18771
19296
  );
18772
19297
  };
19298
+ var hasLowLiquidityWarning = (warnings) => {
19299
+ if (!(warnings == null ? void 0 : warnings.length)) return false;
19300
+ return warnings.some((warning) => (warning == null ? void 0 : warning.reason) === "low_liquidity");
19301
+ };
18773
19302
  var getPlaceOrderContainerClassName = () => {
18774
19303
  return PLACE_ORDER_CONTAINER_CLASS_NAME;
18775
19304
  };
@@ -21736,6 +22265,7 @@ var PlaceOrder = ({
21736
22265
  return fills.length > 0 && fills.every((f) => geoBlockedVenuesFromWarnings.has(f.venue));
21737
22266
  }, [selectedRouteCard, geoBlockedVenuesFromWarnings]);
21738
22267
  const shouldShowGeoBlockBanner = isTradingBlocked || selectedRouteGeoBlocked || isPrimaryVenueGeoBlocked;
22268
+ const shouldShowLowLiquidityWarning = !isQuoteInputEditing && !isQuoteLoading && (activeQuoteData == null ? void 0 : activeQuoteData.venueMarketOutcomeId) === scopedSelectedOutcomeId && hasLowLiquidityWarning(activeQuoteData.warnings);
21739
22269
  const actionLabel = `${internalTab === "buy" ? tradingLabels.buy : tradingLabels.sell} ${selectedOutcomeLabel}`.trim();
21740
22270
  const isActionDisabled = isPrimaryActionDisabled || !orderEligibility.canPlaceOrder || isActionLoading || !hasEnteredAmount || !scopedSelectedMarket || isInsufficientBalance || isQuoteInsufficientBalance || isBelowMinimum || isQuoteLoading || !selectedRouteCard || !selectedRouteCard.quoteData.quoteId || selectedRouteGeoBlocked || !isAuthenticated || quoteStatus !== void 0;
21741
22271
  const shouldShowSmartRouting = orderEligibility.canPlaceOrder && hasEnteredAmount && !isBelowMinimum && (orderedRouteCards.length > 0 || smartRoute.isFetching || smartRoute.isLoading);
@@ -22542,6 +23072,25 @@ var PlaceOrder = ({
22542
23072
  children: actionLabel
22543
23073
  }
22544
23074
  ),
23075
+ shouldShowLowLiquidityWarning ? /* @__PURE__ */ (0, import_jsx_runtime155.jsxs)(
23076
+ "div",
23077
+ {
23078
+ className: "agg-order-low-liquidity-warning flex w-full items-center gap-2 rounded-agg-lg bg-agg-warning/10 px-3 py-2",
23079
+ role: "status",
23080
+ children: [
23081
+ /* @__PURE__ */ (0, import_jsx_runtime155.jsx)(
23082
+ Icon,
23083
+ {
23084
+ name: "warning-filled",
23085
+ size: "small",
23086
+ className: "h-4! w-4! shrink-0 text-agg-warning",
23087
+ "aria-hidden": "true"
23088
+ }
23089
+ ),
23090
+ /* @__PURE__ */ (0, import_jsx_runtime155.jsx)("p", { className: "min-w-0 flex-1 wrap-break-word text-agg-sm leading-agg-5 text-agg-foreground", children: tradingLabels.lowLiquidityWarning })
23091
+ ]
23092
+ }
23093
+ ) : null,
22545
23094
  !shouldShowGeoBlockBanner && internalTab === "buy" && showFeesBreakdown ? /* @__PURE__ */ (0, import_jsx_runtime155.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: [
22546
23095
  /* @__PURE__ */ (0, import_jsx_runtime155.jsx)(
22547
23096
  Icon,
@@ -23161,7 +23710,14 @@ var EventMarketPageLoadingState = ({
23161
23710
  /* @__PURE__ */ (0, import_jsx_runtime156.jsx)(MarketDetails, { isLoading: true, isOpened: true, classNames: { root: "w-full" } }),
23162
23711
  /* @__PURE__ */ (0, import_jsx_runtime156.jsx)(MarketDetails, { isLoading: true, isOpened: false, classNames: { root: "w-full" } }),
23163
23712
  /* @__PURE__ */ (0, import_jsx_runtime156.jsx)(MarketDetails, { isLoading: true, isOpened: false, classNames: { root: "w-full" } })
23164
- ] })
23713
+ ] }),
23714
+ /* @__PURE__ */ (0, import_jsx_runtime156.jsx)(
23715
+ Skeleton,
23716
+ {
23717
+ view: skeletonViews.settlement,
23718
+ className: cn("agg-settlement-list-item", classNames == null ? void 0 : classNames.settlement)
23719
+ }
23720
+ )
23165
23721
  ]
23166
23722
  }
23167
23723
  ),
@@ -25283,7 +25839,7 @@ var HomeSearchResults = ({
25283
25839
  const eventListTabs = useEventListTabs();
25284
25840
  const { headerRef, titleRef, shouldUseSelectOverflow } = useEventListTabsHeaderOverflow(eventListTabs);
25285
25841
  const visibleVenues = (0, import_react45.useMemo)(
25286
- () => disabledVenues.length === 0 ? void 0 : (0, import_hooks65.getVisibleVenueIdsByConfig)(import_sdk18.VENUES, disabledVenues),
25842
+ () => disabledVenues.length === 0 ? void 0 : (0, import_hooks65.getVisibleVenueIdsByConfig)(import_sdk19.VENUES, disabledVenues),
25287
25843
  [disabledVenues]
25288
25844
  );
25289
25845
  const activeVenueTab = (0, import_react45.useMemo)(() => {
@@ -25770,7 +26326,7 @@ HomePage.displayName = "HomePage";
25770
26326
 
25771
26327
  // src/pages/user-profile/index.tsx
25772
26328
  var import_hooks71 = require("@agg-build/hooks");
25773
- var import_sdk20 = require("@agg-build/sdk");
26329
+ var import_sdk21 = require("@agg-build/sdk");
25774
26330
  var import_react47 = require("react");
25775
26331
 
25776
26332
  // src/pages/user-profile/chain-display.ts
@@ -26009,17 +26565,17 @@ AvailableBalanceCard.displayName = "AvailableBalanceCard";
26009
26565
 
26010
26566
  // src/pages/user-profile/components/claim-activity-breakdown-modal.tsx
26011
26567
  var import_hooks67 = require("@agg-build/hooks");
26012
- var import_sdk19 = require("@agg-build/sdk");
26568
+ var import_sdk20 = require("@agg-build/sdk");
26013
26569
  var import_jsx_runtime164 = require("react/jsx-runtime");
26014
26570
  var CLAIM_VENUE_LABELS = {
26015
- [import_sdk19.Venue.kalshi]: "Kalshi",
26016
- [import_sdk19.Venue.polymarket]: "Polymarket",
26017
- [import_sdk19.Venue.limitless]: "Limitless",
26018
- [import_sdk19.Venue.opinion]: "Opinion",
26019
- [import_sdk19.Venue.predict]: "Predict",
26020
- [import_sdk19.Venue.probable]: "Probable",
26021
- [import_sdk19.Venue.myriad]: "Myriad",
26022
- [import_sdk19.Venue.hyperliquid]: "Hyperliquid"
26571
+ [import_sdk20.Venue.kalshi]: "Kalshi",
26572
+ [import_sdk20.Venue.polymarket]: "Polymarket",
26573
+ [import_sdk20.Venue.limitless]: "Limitless",
26574
+ [import_sdk20.Venue.opinion]: "Opinion",
26575
+ [import_sdk20.Venue.predict]: "Predict",
26576
+ [import_sdk20.Venue.probable]: "Probable",
26577
+ [import_sdk20.Venue.myriad]: "Myriad",
26578
+ [import_sdk20.Venue.hyperliquid]: "Hyperliquid"
26023
26579
  };
26024
26580
  var ClaimActivityBreakdownModal = ({
26025
26581
  activity,
@@ -26926,10 +27482,6 @@ EmptyState.displayName = "EmptyState";
26926
27482
  // src/pages/user-profile/components/position-row.tsx
26927
27483
  var import_hooks68 = require("@agg-build/hooks");
26928
27484
  var import_jsx_runtime167 = require("react/jsx-runtime");
26929
- var floorToTwoDecimals = (value) => {
26930
- if (!Number.isFinite(value) || value <= 0) return 0;
26931
- return Math.trunc(value * 100) / 100;
26932
- };
26933
27485
  var shouldUseNativeLinkNavigation2 = (event) => {
26934
27486
  return event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button === 1;
26935
27487
  };
@@ -26942,32 +27494,21 @@ var OutcomePill = ({ label: label2 }) => /* @__PURE__ */ (0, import_jsx_runtime1
26942
27494
  var ResolutionPill = ({ label: label2 }) => /* @__PURE__ */ (0, import_jsx_runtime167.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_runtime167.jsx)("span", { className: "truncate whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: label2 }) });
26943
27495
  var VenueShares = ({
26944
27496
  model,
26945
- totalSharesLabel,
26946
27497
  className,
26947
27498
  keyPrefix
26948
27499
  }) => {
26949
- if (!totalSharesLabel && model.venueShareBreakdown.length === 0) return null;
26950
- return /* @__PURE__ */ (0, import_jsx_runtime167.jsxs)("div", { className: cn(className, "gap-2"), children: [
26951
- model.venueShareBreakdown.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime167.jsx)("div", { className: "flex items-center gap-1", children: model.venueShareBreakdown.map((row, index) => /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(
26952
- Tooltip,
26953
- {
26954
- content: /* @__PURE__ */ (0, import_jsx_runtime167.jsx)("span", { children: row.sharesLabel }),
26955
- "aria-label": `${row.venue} shares`,
26956
- side: "top",
26957
- children: /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(
26958
- "span",
26959
- {
26960
- tabIndex: 0,
26961
- 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",
26962
- "aria-label": `${row.venue} shares`,
26963
- children: /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(VenueLogo, { venue: row.venue, size: "small", className: "size-4 shrink-0" })
26964
- }
26965
- )
26966
- },
26967
- `${keyPrefix}-${row.venue}-${String(index)}`
26968
- )) }) : null,
26969
- totalSharesLabel ? /* @__PURE__ */ (0, import_jsx_runtime167.jsx)("span", { className: "whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: totalSharesLabel }) : null
26970
- ] });
27500
+ if (model.venueShareBreakdown.length === 0) return null;
27501
+ return /* @__PURE__ */ (0, import_jsx_runtime167.jsx)("div", { className: cn(className, "gap-x-3 gap-y-2"), children: model.venueShareBreakdown.map((row, index) => /* @__PURE__ */ (0, import_jsx_runtime167.jsxs)(
27502
+ "div",
27503
+ {
27504
+ className: "flex min-w-0 max-w-full items-center gap-1",
27505
+ children: [
27506
+ /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(VenueLogo, { venue: row.venue, size: "small", className: "size-4 shrink-0" }),
27507
+ /* @__PURE__ */ (0, import_jsx_runtime167.jsx)("span", { className: "truncate whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: row.sharesLabel })
27508
+ ]
27509
+ },
27510
+ `${keyPrefix}-${row.venue}-${row.sharesLabel}-${String(index)}`
27511
+ )) });
26971
27512
  };
26972
27513
  var StatusBadge = ({
26973
27514
  status,
@@ -27084,7 +27625,6 @@ var PositionRow = ({
27084
27625
  finalPrefix: labels.finalPrefix
27085
27626
  });
27086
27627
  const isClosed = (variant != null ? variant : model.bucket) === "closed";
27087
- const totalSharesLabel = typeof position.totalShares === "number" && Number.isFinite(position.totalShares) ? `${String(floorToTwoDecimals(position.totalShares))} shares` : null;
27088
27628
  const handleClaim = (event) => {
27089
27629
  event.preventDefault();
27090
27630
  event.stopPropagation();
@@ -27145,7 +27685,6 @@ var PositionRow = ({
27145
27685
  VenueShares,
27146
27686
  {
27147
27687
  model,
27148
- totalSharesLabel,
27149
27688
  keyPrefix: "desktop",
27150
27689
  className: "agg-position-venues flex flex-1 flex-wrap content-center items-center gap-x-3 gap-y-2"
27151
27690
  }
@@ -27160,7 +27699,6 @@ var PositionRow = ({
27160
27699
  VenueShares,
27161
27700
  {
27162
27701
  model,
27163
- totalSharesLabel,
27164
27702
  keyPrefix: "mobile",
27165
27703
  className: "agg-position-venues flex min-w-0 flex-1 flex-wrap content-center items-center gap-x-3 gap-y-2 md:hidden"
27166
27704
  }
@@ -28299,10 +28837,10 @@ var toRedeemTransactions = (item) => {
28299
28837
  });
28300
28838
  };
28301
28839
  var POSITION_ROW_VENUE_ORDER = [
28302
- import_sdk20.Venue.polymarket,
28303
- import_sdk20.Venue.kalshi,
28304
- import_sdk20.Venue.opinion,
28305
- import_sdk20.Venue.limitless
28840
+ import_sdk21.Venue.polymarket,
28841
+ import_sdk21.Venue.kalshi,
28842
+ import_sdk21.Venue.opinion,
28843
+ import_sdk21.Venue.limitless
28306
28844
  ];
28307
28845
  function venueBreakdownSortKey(venue) {
28308
28846
  const idx = POSITION_ROW_VENUE_ORDER.indexOf(venue);
@@ -28316,7 +28854,19 @@ function buildVenueShareBreakdown(outcome) {
28316
28854
  if (breakdown.length === 0) {
28317
28855
  return [];
28318
28856
  }
28319
- const sorted = [...breakdown].sort(
28857
+ const aggregatedByVenue = breakdown.reduce(
28858
+ (acc, row) => {
28859
+ const existing = acc.get(row.venue);
28860
+ if (existing) {
28861
+ existing.size += row.size;
28862
+ return acc;
28863
+ }
28864
+ acc.set(row.venue, { venue: row.venue, size: row.size });
28865
+ return acc;
28866
+ },
28867
+ /* @__PURE__ */ new Map()
28868
+ );
28869
+ const sorted = [...aggregatedByVenue.values()].sort(
28320
28870
  (a, b) => venueBreakdownSortKey(a.venue) - venueBreakdownSortKey(b.venue)
28321
28871
  );
28322
28872
  return sorted.map((row) => ({
@@ -31398,7 +31948,7 @@ var import_hooks91 = require("@agg-build/hooks");
31398
31948
  var Dialog7 = __toESM(require("@radix-ui/react-dialog"));
31399
31949
 
31400
31950
  // src/onboarding/onboarding-modal.constants.ts
31401
- var import_sdk21 = require("@agg-build/sdk");
31951
+ var import_sdk22 = require("@agg-build/sdk");
31402
31952
  var HOW_IT_WORKS_FEATURE_KEYS = [
31403
31953
  "createAccount",
31404
31954
  "linkAccounts",
@@ -31410,7 +31960,11 @@ var ONBOARDING_STEPS = {
31410
31960
  PROFILE_SETUP: 1,
31411
31961
  CONNECT_ACCOUNTS: 2
31412
31962
  };
31413
- var ONCHAIN_VENUES = [import_sdk21.Venue.polymarket, import_sdk21.Venue.opinion, import_sdk21.Venue.predict];
31963
+ var ONCHAIN_VENUES = [
31964
+ import_sdk22.Venue.polymarket,
31965
+ import_sdk22.Venue.opinion,
31966
+ import_sdk22.Venue.predict
31967
+ ].filter(import_sdk22.isVenueActive);
31414
31968
 
31415
31969
  // src/onboarding/steps/how-it-works.tsx
31416
31970
  var import_react52 = require("react");
@@ -31630,7 +32184,6 @@ var ProfileSetupStep = ({ onContinue }) => {
31630
32184
  ProfileSetupStep.displayName = "ProfileSetupStep";
31631
32185
 
31632
32186
  // src/onboarding/steps/connect-accounts.tsx
31633
- var import_sdk22 = require("@agg-build/sdk");
31634
32187
  var import_hooks88 = require("@agg-build/hooks");
31635
32188
  var import_jsx_runtime190 = require("react/jsx-runtime");
31636
32189
  var OnchainVenueLogos = () => {
@@ -31701,51 +32254,27 @@ var VenueCard = ({
31701
32254
  };
31702
32255
  var ConnectAccountsStep = ({
31703
32256
  onConnectOnchain,
31704
- onConnectKalshi,
31705
32257
  onContinue,
31706
- connectedOnchain = false,
31707
- connectedKalshi = false
32258
+ connectedOnchain = false
31708
32259
  }) => {
31709
32260
  const labels = (0, import_hooks88.useLabels)();
31710
- const canContinue = connectedOnchain || connectedKalshi;
32261
+ const canContinue = connectedOnchain;
31711
32262
  return /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)("div", { className: "flex flex-col gap-6", children: [
31712
32263
  /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("h2", { className: "text-center text-agg-2xl font-agg-bold text-agg-foreground", children: labels.onboarding.connectAccounts.title }),
31713
- /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)("div", { className: "flex flex-col gap-4", children: [
31714
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
31715
- VenueCard,
31716
- {
31717
- logos: /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(OnchainVenueLogos, {}),
31718
- title: labels.onboarding.connectAccounts.onchainTitle,
31719
- mobileTitle: labels.onboarding.connectAccounts.onchainMobileTitle(
31720
- ONCHAIN_VENUES.length - 1
31721
- ),
31722
- description: labels.onboarding.connectAccounts.onchainDescription,
31723
- mobileDescription: labels.onboarding.connectAccounts.onchainMobileDescription,
31724
- onConnect: onConnectOnchain,
31725
- connected: connectedOnchain
31726
- }
31727
- ),
31728
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
31729
- VenueCard,
31730
- {
31731
- logos: /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("div", { className: "sm:flex sm:w-14 sm:items-center sm:justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
31732
- VenueLogo,
31733
- {
31734
- venue: import_sdk22.Venue.kalshi,
31735
- variant: "logo",
31736
- size: "large",
31737
- className: "h-6 w-6 sm:h-9 sm:w-9"
31738
- }
31739
- ) }),
31740
- title: labels.onboarding.connectAccounts.kalshiTitle,
31741
- mobileTitle: labels.onboarding.connectAccounts.kalshiMobileTitle,
31742
- description: labels.onboarding.connectAccounts.kalshiDescription,
31743
- mobileDescription: labels.onboarding.connectAccounts.kalshiMobileDescription,
31744
- onConnect: onConnectKalshi,
31745
- connected: connectedKalshi
31746
- }
31747
- )
31748
- ] }),
32264
+ /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("div", { className: "flex flex-col gap-4", children: /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
32265
+ VenueCard,
32266
+ {
32267
+ logos: /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(OnchainVenueLogos, {}),
32268
+ title: labels.onboarding.connectAccounts.onchainTitle,
32269
+ mobileTitle: labels.onboarding.connectAccounts.onchainMobileTitle(
32270
+ ONCHAIN_VENUES.length - 1
32271
+ ),
32272
+ description: labels.onboarding.connectAccounts.onchainDescription,
32273
+ mobileDescription: labels.onboarding.connectAccounts.onchainMobileDescription,
32274
+ onConnect: onConnectOnchain,
32275
+ connected: connectedOnchain
32276
+ }
32277
+ ) }),
31749
32278
  /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
31750
32279
  Button,
31751
32280
  {
@@ -31761,27 +32290,135 @@ var ConnectAccountsStep = ({
31761
32290
  };
31762
32291
  ConnectAccountsStep.displayName = "ConnectAccountsStep";
31763
32292
 
31764
- // src/onboarding/steps/connect-kalshi-modal.tsx
31765
- var import_sdk23 = require("@agg-build/sdk");
32293
+ // src/onboarding/steps/connect-onchain-modal.tsx
31766
32294
  var import_react54 = require("react");
31767
32295
  var import_hooks89 = require("@agg-build/hooks");
31768
32296
  var Dialog5 = __toESM(require("@radix-ui/react-dialog"));
31769
32297
  var import_jsx_runtime191 = require("react/jsx-runtime");
31770
- var ConnectKalshiModal = ({
32298
+ var ConnectOnchainModal = ({
31771
32299
  open,
31772
32300
  onOpenChange,
31773
- onVerify
32301
+ onConnect
31774
32302
  }) => {
31775
32303
  const labels = (0, import_hooks89.useLabels)();
31776
- const [apiKeyId, setApiKeyId] = (0, import_react54.useState)("");
31777
- const [privateKey, setPrivateKey] = (0, import_react54.useState)("");
31778
- const [verifying, setVerifying] = (0, import_react54.useState)(false);
32304
+ const [connecting, setConnecting] = (0, import_react54.useState)(false);
31779
32305
  const [error, setError] = (0, import_react54.useState)();
31780
- const canVerify = apiKeyId.trim().length > 0 && privateKey.trim().length > 0;
31781
32306
  const handleCancel = (0, import_react54.useCallback)(() => {
31782
32307
  onOpenChange(false);
31783
32308
  }, [onOpenChange]);
31784
- const handleVerify = (0, import_react54.useCallback)(() => __async(null, null, function* () {
32309
+ const handleConnect = (0, import_react54.useCallback)(() => __async(null, null, function* () {
32310
+ if (connecting) return;
32311
+ setConnecting(true);
32312
+ setError(void 0);
32313
+ try {
32314
+ yield onConnect();
32315
+ onOpenChange(false);
32316
+ } catch (err) {
32317
+ setError(
32318
+ err instanceof Error ? err.message : labels.onboarding.connectOnchainModal.fallbackError
32319
+ );
32320
+ } finally {
32321
+ setConnecting(false);
32322
+ }
32323
+ }), [connecting, labels.onboarding.connectOnchainModal.fallbackError, onConnect, onOpenChange]);
32324
+ const handleOpenChange = (0, import_react54.useCallback)(
32325
+ (value) => {
32326
+ if (value) {
32327
+ setError(void 0);
32328
+ setConnecting(false);
32329
+ }
32330
+ onOpenChange(value);
32331
+ },
32332
+ [onOpenChange]
32333
+ );
32334
+ return /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(
32335
+ Modal.Container,
32336
+ {
32337
+ maxWidth: "600px",
32338
+ "aria-label": labels.onboarding.connectOnchainModal.ariaLabel,
32339
+ classNames: { container: "!rounded-agg-lg" },
32340
+ children: [
32341
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(Dialog5.Title, { className: "sr-only", children: labels.onboarding.connectOnchainModal.title }),
32342
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
32343
+ Modal.Header,
32344
+ {
32345
+ hideClose: false,
32346
+ hideBorder: true,
32347
+ classNames: {
32348
+ root: "!min-h-0",
32349
+ container: "!py-[18px] !px-8"
32350
+ }
32351
+ }
32352
+ ),
32353
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(Modal.Body, { classNames: { root: "!px-5 !pt-0 !pb-[60px] sm:!px-8" }, children: /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "flex flex-col gap-8 items-center", children: [
32354
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "flex flex-col gap-4 items-center text-center", children: [
32355
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("h2", { className: "text-agg-2xl font-agg-bold text-agg-foreground", children: labels.onboarding.connectOnchainModal.title }),
32356
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("p", { className: "text-agg-base text-center leading-agg-6 text-agg-foreground whitespace-pre-line", children: labels.onboarding.connectOnchainModal.description })
32357
+ ] }),
32358
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "flex w-full flex-col items-center gap-4 rounded-agg-xl bg-agg-secondary-hover p-6", children: [
32359
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("p", { className: "text-agg-sm font-agg-bold uppercase leading-agg-5 text-agg-muted-foreground", children: labels.onboarding.connectOnchainModal.supportedVenuesLabel }),
32360
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("div", { className: "flex flex-wrap items-center justify-center gap-x-4 gap-y-3", children: ONCHAIN_VENUES.map((venue, index) => /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "flex items-center gap-[6px]", children: [
32361
+ index > 0 && /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("span", { className: "mr-2.5 h-3 w-px bg-agg-separator" }),
32362
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(VenueLogo, { venue, size: "medium" }),
32363
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("span", { className: "text-agg-base text-agg-foreground", children: labels.venues[venue] })
32364
+ ] }, venue)) })
32365
+ ] }),
32366
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "flex flex-col gap-6 items-center", children: [
32367
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "flex flex-col gap-3 items-center", children: [
32368
+ error ? /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "flex items-center gap-2", children: [
32369
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(WarningIcon, { className: "h-3.5 w-3.5 shrink-0 text-agg-error" }),
32370
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-error", children: error })
32371
+ ] }) : null,
32372
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
32373
+ Button,
32374
+ {
32375
+ variant: "primary",
32376
+ size: "large",
32377
+ onClick: handleConnect,
32378
+ isLoading: connecting,
32379
+ children: labels.onboarding.connectOnchainModal.connect
32380
+ }
32381
+ )
32382
+ ] }),
32383
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
32384
+ Button,
32385
+ {
32386
+ variant: "tertiary",
32387
+ size: "medium",
32388
+ className: "!h-auto !px-0 !py-0 text-agg-primary hover:bg-transparent hover:text-agg-primary-hover",
32389
+ onClick: handleCancel,
32390
+ children: labels.onboarding.connectOnchainModal.cancel
32391
+ }
32392
+ )
32393
+ ] })
32394
+ ] }) })
32395
+ ]
32396
+ }
32397
+ ) });
32398
+ };
32399
+ ConnectOnchainModal.displayName = "ConnectOnchainModal";
32400
+
32401
+ // src/onboarding/steps/connect-kalshi-modal.tsx
32402
+ var import_sdk23 = require("@agg-build/sdk");
32403
+ var import_react55 = require("react");
32404
+ var import_hooks90 = require("@agg-build/hooks");
32405
+ var Dialog6 = __toESM(require("@radix-ui/react-dialog"));
32406
+ var import_jsx_runtime192 = require("react/jsx-runtime");
32407
+ var ConnectKalshiModal = ({
32408
+ open,
32409
+ onOpenChange,
32410
+ onVerify
32411
+ }) => {
32412
+ const labels = (0, import_hooks90.useLabels)();
32413
+ const [apiKeyId, setApiKeyId] = (0, import_react55.useState)("");
32414
+ const [privateKey, setPrivateKey] = (0, import_react55.useState)("");
32415
+ const [verifying, setVerifying] = (0, import_react55.useState)(false);
32416
+ const [error, setError] = (0, import_react55.useState)();
32417
+ const canVerify = apiKeyId.trim().length > 0 && privateKey.trim().length > 0;
32418
+ const handleCancel = (0, import_react55.useCallback)(() => {
32419
+ onOpenChange(false);
32420
+ }, [onOpenChange]);
32421
+ const handleVerify = (0, import_react55.useCallback)(() => __async(null, null, function* () {
31785
32422
  if (!canVerify || verifying) return;
31786
32423
  setVerifying(true);
31787
32424
  setError(void 0);
@@ -31810,7 +32447,7 @@ var ConnectKalshiModal = ({
31810
32447
  privateKey,
31811
32448
  verifying
31812
32449
  ]);
31813
- const handleOpenChange = (0, import_react54.useCallback)(
32450
+ const handleOpenChange = (0, import_react55.useCallback)(
31814
32451
  (value) => {
31815
32452
  if (value) {
31816
32453
  setApiKeyId("");
@@ -31822,15 +32459,15 @@ var ConnectKalshiModal = ({
31822
32459
  },
31823
32460
  [onOpenChange]
31824
32461
  );
31825
- return /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(
32462
+ return /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)(
31826
32463
  Modal.Container,
31827
32464
  {
31828
32465
  maxWidth: "600px",
31829
32466
  "aria-label": labels.onboarding.connectKalshiModal.ariaLabel,
31830
32467
  classNames: { container: "!rounded-agg-lg" },
31831
32468
  children: [
31832
- /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(Dialog5.Title, { className: "sr-only", children: labels.onboarding.connectKalshiModal.title }),
31833
- /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
32469
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(Dialog6.Title, { className: "sr-only", children: labels.onboarding.connectKalshiModal.title }),
32470
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(
31834
32471
  Modal.Header,
31835
32472
  {
31836
32473
  hideClose: false,
@@ -31841,8 +32478,8 @@ var ConnectKalshiModal = ({
31841
32478
  }
31842
32479
  }
31843
32480
  ),
31844
- /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(Modal.Body, { classNames: { root: "!px-5 !pt-0 !pb-[60px] sm:!px-8" }, children: /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "flex flex-col gap-8 items-center", children: [
31845
- /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
32481
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(Modal.Body, { classNames: { root: "!px-5 !pt-0 !pb-[60px] sm:!px-8" }, children: /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)("div", { className: "flex flex-col gap-8 items-center", children: [
32482
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(
31846
32483
  VenueLogo,
31847
32484
  {
31848
32485
  venue: import_sdk23.Venue.kalshi,
@@ -31851,54 +32488,54 @@ var ConnectKalshiModal = ({
31851
32488
  className: "h-[60px] w-[60px]"
31852
32489
  }
31853
32490
  ),
31854
- /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "flex flex-col gap-4 items-center text-center", children: [
31855
- /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("h2", { className: "text-agg-2xl font-agg-bold text-agg-foreground", children: labels.onboarding.connectKalshiModal.title }),
31856
- /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: labels.onboarding.connectKalshiModal.description })
32491
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)("div", { className: "flex flex-col gap-4 items-center text-center", children: [
32492
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("h2", { className: "text-agg-2xl font-agg-bold text-agg-foreground", children: labels.onboarding.connectKalshiModal.title }),
32493
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: labels.onboarding.connectKalshiModal.description })
31857
32494
  ] }),
31858
- /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "flex flex-col gap-4 w-full", children: [
31859
- /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "flex flex-col gap-3 rounded-agg-lg bg-agg-secondary-hover p-4", children: [
31860
- /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "flex flex-col gap-1", children: [
31861
- /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("p", { className: "text-agg-xs font-agg-bold uppercase leading-agg-4 text-agg-muted-foreground", children: labels.onboarding.connectKalshiModal.stepOne.label }),
31862
- /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: labels.onboarding.connectKalshiModal.stepOne.title })
32495
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)("div", { className: "flex flex-col gap-4 w-full", children: [
32496
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)("div", { className: "flex flex-col gap-3 rounded-agg-lg bg-agg-secondary-hover p-4", children: [
32497
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)("div", { className: "flex flex-col gap-1", children: [
32498
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("p", { className: "text-agg-xs font-agg-bold uppercase leading-agg-4 text-agg-muted-foreground", children: labels.onboarding.connectKalshiModal.stepOne.label }),
32499
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: labels.onboarding.connectKalshiModal.stepOne.title })
31863
32500
  ] }),
31864
- /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "space-y-0 text-agg-sm leading-agg-5 text-agg-foreground", children: [
31865
- /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("p", { children: labels.onboarding.connectKalshiModal.stepOne.instructions.signIn }),
31866
- /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("p", { children: [
32501
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)("div", { className: "space-y-0 text-agg-sm leading-agg-5 text-agg-foreground", children: [
32502
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("p", { children: labels.onboarding.connectKalshiModal.stepOne.instructions.signIn }),
32503
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)("p", { children: [
31867
32504
  labels.onboarding.connectKalshiModal.stepOne.instructions.goToProfilePrefix,
31868
32505
  " ",
31869
- /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.profileText }),
32506
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.profileText }),
31870
32507
  labels.onboarding.connectKalshiModal.stepOne.instructions.goToProfileSeparator,
31871
32508
  " ",
31872
- /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("span", { className: "text-agg-foreground underline", children: labels.onboarding.connectKalshiModal.stepOne.instructions.profileUrl })
32509
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("span", { className: "text-agg-foreground underline", children: labels.onboarding.connectKalshiModal.stepOne.instructions.profileUrl })
31873
32510
  ] }),
31874
- /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("p", { children: [
32511
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)("p", { children: [
31875
32512
  labels.onboarding.connectKalshiModal.stepOne.instructions.clickCreateKeyPrefix,
31876
32513
  " ",
31877
- /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.createKeyText }),
32514
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.createKeyText }),
31878
32515
  labels.onboarding.connectKalshiModal.stepOne.instructions.clickCreateKeySuffix
31879
32516
  ] }),
31880
- /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("p", { children: [
32517
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)("p", { children: [
31881
32518
  labels.onboarding.connectKalshiModal.stepOne.instructions.selectPermissionsPrefix,
31882
32519
  " ",
31883
- /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.readWriteText }),
32520
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.readWriteText }),
31884
32521
  labels.onboarding.connectKalshiModal.stepOne.instructions.selectPermissionsSuffix
31885
32522
  ] }),
31886
- /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("p", { children: labels.onboarding.connectKalshiModal.stepOne.instructions.createKey })
32523
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("p", { children: labels.onboarding.connectKalshiModal.stepOne.instructions.createKey })
31887
32524
  ] }),
31888
- /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: [
32525
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: [
31889
32526
  labels.onboarding.connectKalshiModal.stepOne.footerLineOne,
31890
- /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("br", {}),
32527
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("br", {}),
31891
32528
  labels.onboarding.connectKalshiModal.stepOne.footerLineTwo
31892
32529
  ] })
31893
32530
  ] }),
31894
- /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "flex flex-col gap-3 rounded-agg-lg bg-agg-secondary-hover p-4", children: [
31895
- /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "flex flex-col gap-1", children: [
31896
- /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("p", { className: "text-agg-xs font-agg-bold uppercase leading-agg-4 text-agg-muted-foreground", children: labels.onboarding.connectKalshiModal.stepTwo.label }),
31897
- /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: labels.onboarding.connectKalshiModal.stepTwo.title })
32531
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)("div", { className: "flex flex-col gap-3 rounded-agg-lg bg-agg-secondary-hover p-4", children: [
32532
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)("div", { className: "flex flex-col gap-1", children: [
32533
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("p", { className: "text-agg-xs font-agg-bold uppercase leading-agg-4 text-agg-muted-foreground", children: labels.onboarding.connectKalshiModal.stepTwo.label }),
32534
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: labels.onboarding.connectKalshiModal.stepTwo.title })
31898
32535
  ] }),
31899
- /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: labels.onboarding.connectKalshiModal.stepTwo.description }),
31900
- /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "flex flex-col gap-2", children: [
31901
- /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
32536
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: labels.onboarding.connectKalshiModal.stepTwo.description }),
32537
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)("div", { className: "flex flex-col gap-2", children: [
32538
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(
31902
32539
  "label",
31903
32540
  {
31904
32541
  htmlFor: "kalshi-api-key-id",
@@ -31906,7 +32543,7 @@ var ConnectKalshiModal = ({
31906
32543
  children: labels.onboarding.connectKalshiModal.stepTwo.apiKeyIdLabel
31907
32544
  }
31908
32545
  ),
31909
- /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
32546
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(
31910
32547
  "input",
31911
32548
  {
31912
32549
  id: "kalshi-api-key-id",
@@ -31926,8 +32563,8 @@ var ConnectKalshiModal = ({
31926
32563
  }
31927
32564
  )
31928
32565
  ] }),
31929
- /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "flex flex-col gap-2", children: [
31930
- /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
32566
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)("div", { className: "flex flex-col gap-2", children: [
32567
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(
31931
32568
  "label",
31932
32569
  {
31933
32570
  htmlFor: "kalshi-private-key",
@@ -31935,7 +32572,7 @@ var ConnectKalshiModal = ({
31935
32572
  children: labels.onboarding.connectKalshiModal.stepTwo.privateKeyLabel
31936
32573
  }
31937
32574
  ),
31938
- /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
32575
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(
31939
32576
  "textarea",
31940
32577
  {
31941
32578
  id: "kalshi-private-key",
@@ -31957,42 +32594,42 @@ var ConnectKalshiModal = ({
31957
32594
  ] })
31958
32595
  ] })
31959
32596
  ] }),
31960
- /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "flex items-center justify-between w-full", children: [
31961
- /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("p", { className: "text-agg-base text-agg-foreground", children: labels.onboarding.connectKalshiModal.help.label }),
31962
- /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "flex items-center gap-3", children: [
31963
- /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(
32597
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)("div", { className: "flex items-center justify-between w-full", children: [
32598
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("p", { className: "text-agg-base text-agg-foreground", children: labels.onboarding.connectKalshiModal.help.label }),
32599
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)("div", { className: "flex items-center gap-3", children: [
32600
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)(
31964
32601
  "a",
31965
32602
  {
31966
32603
  href: "#",
31967
32604
  className: "flex items-center gap-2 text-agg-base font-agg-bold text-agg-primary hover:text-agg-primary-hover",
31968
32605
  children: [
31969
- /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(DocumentIcon, { className: "h-4 w-4" }),
32606
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(DocumentIcon, { className: "h-4 w-4" }),
31970
32607
  labels.onboarding.connectKalshiModal.help.docsLinkLabel
31971
32608
  ]
31972
32609
  }
31973
32610
  ),
31974
- /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("span", { className: "h-3 w-px bg-agg-separator" }),
31975
- /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(
32611
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("span", { className: "h-3 w-px bg-agg-separator" }),
32612
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)(
31976
32613
  "a",
31977
32614
  {
31978
32615
  href: "#",
31979
32616
  className: "flex items-center gap-2 text-agg-base font-agg-bold text-agg-primary hover:text-agg-primary-hover",
31980
32617
  children: [
31981
- /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(PlaySquareIcon, { className: "h-4 w-4" }),
32618
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(PlaySquareIcon, { className: "h-4 w-4" }),
31982
32619
  labels.onboarding.connectKalshiModal.help.tutorialLinkLabel
31983
32620
  ]
31984
32621
  }
31985
32622
  )
31986
32623
  ] })
31987
32624
  ] }),
31988
- /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "flex flex-col gap-5 items-center", children: [
31989
- error ? /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "flex items-center gap-2", children: [
31990
- /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(WarningIcon, { className: "h-3.5 w-3.5 shrink-0 text-agg-error" }),
31991
- /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-error", children: error })
32625
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)("div", { className: "flex flex-col gap-5 items-center", children: [
32626
+ error ? /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)("div", { className: "flex items-center gap-2", children: [
32627
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(WarningIcon, { className: "h-3.5 w-3.5 shrink-0 text-agg-error" }),
32628
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-error", children: error })
31992
32629
  ] }) : null,
31993
- /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "flex items-center gap-3 justify-center", children: [
31994
- /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(Button, { variant: "secondary", size: "large", onClick: handleCancel, children: labels.onboarding.connectKalshiModal.actions.cancel }),
31995
- /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
32630
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)("div", { className: "flex items-center gap-3 justify-center", children: [
32631
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(Button, { variant: "secondary", size: "large", onClick: handleCancel, children: labels.onboarding.connectKalshiModal.actions.cancel }),
32632
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(
31996
32633
  Button,
31997
32634
  {
31998
32635
  variant: "primary",
@@ -32012,114 +32649,6 @@ var ConnectKalshiModal = ({
32012
32649
  };
32013
32650
  ConnectKalshiModal.displayName = "ConnectKalshiModal";
32014
32651
 
32015
- // src/onboarding/steps/connect-onchain-modal.tsx
32016
- var import_react55 = require("react");
32017
- var import_hooks90 = require("@agg-build/hooks");
32018
- var Dialog6 = __toESM(require("@radix-ui/react-dialog"));
32019
- var import_jsx_runtime192 = require("react/jsx-runtime");
32020
- var ConnectOnchainModal = ({
32021
- open,
32022
- onOpenChange,
32023
- onConnect
32024
- }) => {
32025
- const labels = (0, import_hooks90.useLabels)();
32026
- const [connecting, setConnecting] = (0, import_react55.useState)(false);
32027
- const [error, setError] = (0, import_react55.useState)();
32028
- const handleCancel = (0, import_react55.useCallback)(() => {
32029
- onOpenChange(false);
32030
- }, [onOpenChange]);
32031
- const handleConnect = (0, import_react55.useCallback)(() => __async(null, null, function* () {
32032
- if (connecting) return;
32033
- setConnecting(true);
32034
- setError(void 0);
32035
- try {
32036
- yield onConnect();
32037
- onOpenChange(false);
32038
- } catch (err) {
32039
- setError(
32040
- err instanceof Error ? err.message : labels.onboarding.connectOnchainModal.fallbackError
32041
- );
32042
- } finally {
32043
- setConnecting(false);
32044
- }
32045
- }), [connecting, labels.onboarding.connectOnchainModal.fallbackError, onConnect, onOpenChange]);
32046
- const handleOpenChange = (0, import_react55.useCallback)(
32047
- (value) => {
32048
- if (value) {
32049
- setError(void 0);
32050
- setConnecting(false);
32051
- }
32052
- onOpenChange(value);
32053
- },
32054
- [onOpenChange]
32055
- );
32056
- return /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)(
32057
- Modal.Container,
32058
- {
32059
- maxWidth: "600px",
32060
- "aria-label": labels.onboarding.connectOnchainModal.ariaLabel,
32061
- classNames: { container: "!rounded-agg-lg" },
32062
- children: [
32063
- /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(Dialog6.Title, { className: "sr-only", children: labels.onboarding.connectOnchainModal.title }),
32064
- /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(
32065
- Modal.Header,
32066
- {
32067
- hideClose: false,
32068
- hideBorder: true,
32069
- classNames: {
32070
- root: "!min-h-0",
32071
- container: "!py-[18px] !px-8"
32072
- }
32073
- }
32074
- ),
32075
- /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(Modal.Body, { classNames: { root: "!px-5 !pt-0 !pb-[60px] sm:!px-8" }, children: /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)("div", { className: "flex flex-col gap-8 items-center", children: [
32076
- /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)("div", { className: "flex flex-col gap-4 items-center text-center", children: [
32077
- /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("h2", { className: "text-agg-2xl font-agg-bold text-agg-foreground", children: labels.onboarding.connectOnchainModal.title }),
32078
- /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("p", { className: "text-agg-base text-center leading-agg-6 text-agg-foreground whitespace-pre-line", children: labels.onboarding.connectOnchainModal.description })
32079
- ] }),
32080
- /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)("div", { className: "flex w-full flex-col items-center gap-4 rounded-agg-xl bg-agg-secondary-hover p-6", children: [
32081
- /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("p", { className: "text-agg-sm font-agg-bold uppercase leading-agg-5 text-agg-muted-foreground", children: labels.onboarding.connectOnchainModal.supportedVenuesLabel }),
32082
- /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("div", { className: "flex flex-wrap items-center justify-center gap-x-4 gap-y-3", children: ONCHAIN_VENUES.map((venue, index) => /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)("div", { className: "flex items-center gap-[6px]", children: [
32083
- index > 0 && /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("span", { className: "mr-2.5 h-3 w-px bg-agg-separator" }),
32084
- /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(VenueLogo, { venue, size: "medium" }),
32085
- /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("span", { className: "text-agg-base text-agg-foreground", children: labels.venues[venue] })
32086
- ] }, venue)) })
32087
- ] }),
32088
- /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)("div", { className: "flex flex-col gap-6 items-center", children: [
32089
- /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)("div", { className: "flex flex-col gap-3 items-center", children: [
32090
- error ? /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)("div", { className: "flex items-center gap-2", children: [
32091
- /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(WarningIcon, { className: "h-3.5 w-3.5 shrink-0 text-agg-error" }),
32092
- /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-error", children: error })
32093
- ] }) : null,
32094
- /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(
32095
- Button,
32096
- {
32097
- variant: "primary",
32098
- size: "large",
32099
- onClick: handleConnect,
32100
- isLoading: connecting,
32101
- children: labels.onboarding.connectOnchainModal.connect
32102
- }
32103
- )
32104
- ] }),
32105
- /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(
32106
- Button,
32107
- {
32108
- variant: "tertiary",
32109
- size: "medium",
32110
- className: "!h-auto !px-0 !py-0 text-agg-primary hover:bg-transparent hover:text-agg-primary-hover",
32111
- onClick: handleCancel,
32112
- children: labels.onboarding.connectOnchainModal.cancel
32113
- }
32114
- )
32115
- ] })
32116
- ] }) })
32117
- ]
32118
- }
32119
- ) });
32120
- };
32121
- ConnectOnchainModal.displayName = "ConnectOnchainModal";
32122
-
32123
32652
  // src/onboarding/index.tsx
32124
32653
  var import_jsx_runtime193 = require("react/jsx-runtime");
32125
32654
  var OnboardingModal = ({
@@ -32127,11 +32656,9 @@ var OnboardingModal = ({
32127
32656
  onOpenChange,
32128
32657
  onProfileSubmit,
32129
32658
  onConnectOnchain,
32130
- onConnectKalshi,
32131
32659
  onComplete,
32132
32660
  howItWorksIcons,
32133
- connectedOnchain = false,
32134
- connectedKalshi = false
32661
+ connectedOnchain = false
32135
32662
  }) => {
32136
32663
  var _a;
32137
32664
  const labels = (0, import_hooks91.useLabels)();
@@ -32142,14 +32669,11 @@ var OnboardingModal = ({
32142
32669
  [ONBOARDING_STEPS.CONNECT_ACCOUNTS]: labels.onboarding.modal.stepConnectAccounts
32143
32670
  };
32144
32671
  const resolvedTitle = (_a = stepLabels[step]) != null ? _a : labels.onboarding.modal.title;
32145
- const [kalshiModalOpen, setKalshiModalOpen] = (0, import_react56.useState)(false);
32146
- const [kalshiConnected, setKalshiConnected] = (0, import_react56.useState)(false);
32147
32672
  const [onchainModalOpen, setOnchainModalOpen] = (0, import_react56.useState)(false);
32148
32673
  const [onchainConnected, setOnchainConnected] = (0, import_react56.useState)(false);
32149
32674
  (0, import_react56.useEffect)(() => {
32150
32675
  if (open) {
32151
32676
  setStep(ONBOARDING_STEPS.HOW_IT_WORKS);
32152
- setKalshiConnected(false);
32153
32677
  setOnchainConnected(false);
32154
32678
  }
32155
32679
  }, [open]);
@@ -32173,16 +32697,6 @@ var OnboardingModal = ({
32173
32697
  yield onConnectOnchain == null ? void 0 : onConnectOnchain();
32174
32698
  setOnchainConnected(true);
32175
32699
  }), [onConnectOnchain]);
32176
- const handleOpenKalshiModal = (0, import_react56.useCallback)(() => {
32177
- setKalshiModalOpen(true);
32178
- }, []);
32179
- const handleKalshiVerify = (0, import_react56.useCallback)(
32180
- (credentials) => __async(null, null, function* () {
32181
- yield onConnectKalshi == null ? void 0 : onConnectKalshi(credentials);
32182
- setKalshiConnected(true);
32183
- }),
32184
- [onConnectKalshi]
32185
- );
32186
32700
  return /* @__PURE__ */ (0, import_jsx_runtime193.jsxs)(import_jsx_runtime193.Fragment, { children: [
32187
32701
  /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(Modal, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime193.jsxs)(
32188
32702
  Modal.Container,
@@ -32199,10 +32713,8 @@ var OnboardingModal = ({
32199
32713
  ConnectAccountsStep,
32200
32714
  {
32201
32715
  onConnectOnchain: handleOpenOnchainModal,
32202
- onConnectKalshi: handleOpenKalshiModal,
32203
32716
  onContinue: handleConnectContinue,
32204
- connectedOnchain: connectedOnchain || onchainConnected,
32205
- connectedKalshi: connectedKalshi || kalshiConnected
32717
+ connectedOnchain: connectedOnchain || onchainConnected
32206
32718
  }
32207
32719
  )
32208
32720
  ] })
@@ -32216,14 +32728,6 @@ var OnboardingModal = ({
32216
32728
  onOpenChange: setOnchainModalOpen,
32217
32729
  onConnect: handleOnchainConnect
32218
32730
  }
32219
- ),
32220
- /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
32221
- ConnectKalshiModal,
32222
- {
32223
- open: kalshiModalOpen,
32224
- onOpenChange: setKalshiModalOpen,
32225
- onVerify: handleKalshiVerify
32226
- }
32227
32731
  )
32228
32732
  ] });
32229
32733
  };
@@ -32682,7 +33186,7 @@ var ProfileModal = ({
32682
33186
  }) => {
32683
33187
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
32684
33188
  const client = (0, import_hooks94.useAggClient)();
32685
- const { user, startAuth } = (0, import_hooks94.useAggAuthState)();
33189
+ const { user } = (0, import_hooks94.useAggAuthState)();
32686
33190
  const toastCtx = useOptionalToast();
32687
33191
  const [activeTab, setActiveTab] = (0, import_react59.useState)(PROFILE_TAB_KEYS.PROFILE_ACCOUNTS);
32688
33192
  const resolvedInitialUsername = (_a = username != null ? username : user == null ? void 0 : user.username) != null ? _a : "";
@@ -32833,71 +33337,114 @@ var ProfileModal = ({
32833
33337
  if (typeof window === "undefined") return;
32834
33338
  ((_a2 = window.top) != null ? _a2 : window).location.assign(url);
32835
33339
  };
33340
+ const surfaceError = (0, import_react59.useCallback)(
33341
+ (err, title2) => {
33342
+ const message = (err == null ? void 0 : err.message) || "Something went wrong. Please try again.";
33343
+ if (toastCtx) {
33344
+ toastCtx.toast(message, { tone: "error", title: title2 });
33345
+ } else {
33346
+ console.error(`[ProfileModal] ${title2}:`, message);
33347
+ }
33348
+ },
33349
+ [toastCtx]
33350
+ );
32836
33351
  const handleConnectTwitter = (0, import_react59.useCallback)(() => __async(null, null, function* () {
32837
- const result = yield startAuth({
32838
- provider: "twitter",
32839
- redirectUrl: resolveRedirectUrl()
32840
- });
32841
- onConnectTwitter == null ? void 0 : onConnectTwitter();
32842
- if (result.type === "redirect") {
32843
- navigateTopWindow(result.url);
33352
+ try {
33353
+ const result = yield client.linkAccount({
33354
+ provider: "twitter",
33355
+ redirectUrl: resolveRedirectUrl()
33356
+ });
33357
+ onConnectTwitter == null ? void 0 : onConnectTwitter();
33358
+ if (result.type === "redirect") {
33359
+ navigateTopWindow(result.url);
33360
+ }
33361
+ } catch (err) {
33362
+ surfaceError(err, "Could not connect X (Twitter)");
32844
33363
  }
32845
- }), [onConnectTwitter, startAuth]);
33364
+ }), [client, onConnectTwitter, surfaceError]);
32846
33365
  const handleConnectGoogle = (0, import_react59.useCallback)(() => __async(null, null, function* () {
32847
- const result = yield startAuth({
32848
- provider: "google",
32849
- redirectUrl: resolveRedirectUrl()
32850
- });
32851
- onConnectGoogle == null ? void 0 : onConnectGoogle();
32852
- if (result.type === "redirect") {
32853
- navigateTopWindow(result.url);
33366
+ try {
33367
+ const result = yield client.linkAccount({
33368
+ provider: "google",
33369
+ redirectUrl: resolveRedirectUrl()
33370
+ });
33371
+ onConnectGoogle == null ? void 0 : onConnectGoogle();
33372
+ if (result.type === "redirect") {
33373
+ navigateTopWindow(result.url);
33374
+ }
33375
+ } catch (err) {
33376
+ surfaceError(err, "Could not connect Google");
32854
33377
  }
32855
- }), [onConnectGoogle, startAuth]);
33378
+ }), [client, onConnectGoogle, surfaceError]);
32856
33379
  const handleConnectApple = (0, import_react59.useCallback)(() => __async(null, null, function* () {
32857
- const result = yield startAuth({
32858
- provider: "apple",
32859
- redirectUrl: resolveRedirectUrl()
32860
- });
32861
- onConnectApple == null ? void 0 : onConnectApple();
32862
- if (result.type === "redirect") {
32863
- navigateTopWindow(result.url);
33380
+ try {
33381
+ const result = yield client.linkAccount({
33382
+ provider: "apple",
33383
+ redirectUrl: resolveRedirectUrl()
33384
+ });
33385
+ onConnectApple == null ? void 0 : onConnectApple();
33386
+ if (result.type === "redirect") {
33387
+ navigateTopWindow(result.url);
33388
+ }
33389
+ } catch (err) {
33390
+ surfaceError(err, "Could not connect Apple");
32864
33391
  }
32865
- }), [onConnectApple, startAuth]);
33392
+ }), [client, onConnectApple, surfaceError]);
32866
33393
  const handleDisconnectTwitter = (0, import_react59.useCallback)(() => __async(null, null, function* () {
32867
- yield client.disconnectAccount("twitter");
32868
- yield client.getCurrentUser();
32869
- onDisconnectTwitter == null ? void 0 : onDisconnectTwitter();
32870
- }), [client, onDisconnectTwitter]);
33394
+ try {
33395
+ yield client.disconnectAccount("twitter");
33396
+ yield client.getCurrentUser();
33397
+ onDisconnectTwitter == null ? void 0 : onDisconnectTwitter();
33398
+ } catch (err) {
33399
+ surfaceError(err, "Could not disconnect X (Twitter)");
33400
+ }
33401
+ }), [client, onDisconnectTwitter, surfaceError]);
32871
33402
  const handleDisconnectGoogle = (0, import_react59.useCallback)(() => __async(null, null, function* () {
32872
- yield client.disconnectAccount("google");
32873
- yield client.getCurrentUser();
32874
- onDisconnectGoogle == null ? void 0 : onDisconnectGoogle();
32875
- }), [client, onDisconnectGoogle]);
33403
+ try {
33404
+ yield client.disconnectAccount("google");
33405
+ yield client.getCurrentUser();
33406
+ onDisconnectGoogle == null ? void 0 : onDisconnectGoogle();
33407
+ } catch (err) {
33408
+ surfaceError(err, "Could not disconnect Google");
33409
+ }
33410
+ }), [client, onDisconnectGoogle, surfaceError]);
32876
33411
  const handleDisconnectApple = (0, import_react59.useCallback)(() => __async(null, null, function* () {
32877
- yield client.disconnectAccount("apple");
32878
- yield client.getCurrentUser();
32879
- onDisconnectApple == null ? void 0 : onDisconnectApple();
32880
- }), [client, onDisconnectApple]);
33412
+ try {
33413
+ yield client.disconnectAccount("apple");
33414
+ yield client.getCurrentUser();
33415
+ onDisconnectApple == null ? void 0 : onDisconnectApple();
33416
+ } catch (err) {
33417
+ surfaceError(err, "Could not disconnect Apple");
33418
+ }
33419
+ }), [client, onDisconnectApple, surfaceError]);
32881
33420
  const handleConnectEmail = (0, import_react59.useCallback)(() => __async(null, null, function* () {
32882
33421
  var _a2;
32883
33422
  const typedEmail = typeof window !== "undefined" ? (_a2 = window.prompt("Enter your email to receive a magic link")) == null ? void 0 : _a2.trim() : void 0;
32884
33423
  if (!typedEmail) return;
32885
- yield startAuth({
32886
- provider: "email",
32887
- email: typedEmail,
32888
- redirectUrl: resolveRedirectUrl()
32889
- });
32890
- onConnectEmail == null ? void 0 : onConnectEmail();
32891
- }), [onConnectEmail, startAuth]);
33424
+ try {
33425
+ yield client.linkAccount({
33426
+ provider: "email",
33427
+ email: typedEmail,
33428
+ redirectUrl: resolveRedirectUrl()
33429
+ });
33430
+ onConnectEmail == null ? void 0 : onConnectEmail();
33431
+ } catch (err) {
33432
+ surfaceError(err, "Could not connect email");
33433
+ }
33434
+ }), [client, onConnectEmail, surfaceError]);
32892
33435
  const handleDisconnectWallet = (0, import_react59.useCallback)(
32893
33436
  (wallet) => __async(null, null, function* () {
32894
33437
  const normalizedChain = wallet.chain.toLowerCase();
32895
33438
  const provider = normalizedChain === "solana" || normalizedChain === "svm" ? "solana_wallet" : "wallet";
32896
- yield client.disconnectAccount(provider);
32897
- yield client.getCurrentUser();
32898
- onDisconnectWallet == null ? void 0 : onDisconnectWallet(wallet);
33439
+ try {
33440
+ yield client.disconnectAccount(provider);
33441
+ yield client.getCurrentUser();
33442
+ onDisconnectWallet == null ? void 0 : onDisconnectWallet(wallet);
33443
+ } catch (err) {
33444
+ surfaceError(err, "Could not disconnect wallet");
33445
+ }
32899
33446
  }),
32900
- [client, onDisconnectWallet]
33447
+ [client, onDisconnectWallet, surfaceError]
32901
33448
  );
32902
33449
  const providerActionMap = (0, import_react59.useMemo)(
32903
33450
  () => ({
@@ -33311,6 +33858,7 @@ GeoBlockModal.displayName = "GeoBlockModal";
33311
33858
  getMotionClassName,
33312
33859
  getPendingCardSession,
33313
33860
  getScrollBehavior,
33861
+ getSettlementDifferenceId,
33314
33862
  getTradingAveragePriceLabel,
33315
33863
  getTradingBalanceLabel,
33316
33864
  getTradingDateLabel,
@@ -33326,8 +33874,10 @@ GeoBlockModal.displayName = "GeoBlockModal";
33326
33874
  orderbookRowLimitDefault,
33327
33875
  parseAmount,
33328
33876
  parseVenue,
33877
+ prepareSettlementDifferences,
33329
33878
  requestAggDepositModalOpen,
33330
33879
  requestAggWithdrawModalOpen,
33880
+ resolveDifferenceIconClassName,
33331
33881
  resolveEventDetailsSyncKey,
33332
33882
  resolveOrderBookRows,
33333
33883
  resolveResolvedOutcomeLabel,