@agg-build/ui 2.4.3 → 2.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/{chunk-GLVLCXIM.mjs → chunk-CXSIXL7M.mjs} +29 -35
  2. package/dist/{chunk-PHAEFHBM.mjs → chunk-GWRFSQQK.mjs} +70 -17
  3. package/dist/{chunk-PHRYWSNV.mjs → chunk-I4X5UNCT.mjs} +307 -240
  4. package/dist/{chunk-3PSIO77N.mjs → chunk-JVRTJQPZ.mjs} +1 -1
  5. package/dist/{chunk-QDNG5UKJ.mjs → chunk-P5CVJQPW.mjs} +288 -291
  6. package/dist/{chunk-WZ55ERDO.mjs → chunk-PTNFXXOV.mjs} +50 -11
  7. package/dist/{chunk-STL4ZHLP.mjs → chunk-UH3DUTMG.mjs} +140 -115
  8. package/dist/events.js +440 -305
  9. package/dist/events.mjs +3 -3
  10. package/dist/index.js +840 -666
  11. package/dist/index.mjs +7 -7
  12. package/dist/modals.js +333 -297
  13. package/dist/modals.mjs +3 -3
  14. package/dist/pages.js +558 -381
  15. package/dist/pages.mjs +6 -6
  16. package/dist/primitives.js +50 -11
  17. package/dist/primitives.mjs +1 -1
  18. package/dist/styles.css +1 -1
  19. package/dist/tailwind.css +1 -1
  20. package/dist/trading.js +2597 -2384
  21. package/dist/trading.mjs +4 -4
  22. package/dist/types/events/item-details/event-list-item-details.constants.d.mts +1 -1
  23. package/dist/types/events/item-details/event-list-item-details.constants.d.ts +1 -1
  24. package/dist/types/events/item-details/settlement-summary.d.mts +1 -1
  25. package/dist/types/events/item-details/settlement-summary.d.ts +1 -1
  26. package/dist/types/onboarding/index.d.mts +1 -1
  27. package/dist/types/onboarding/index.d.ts +1 -1
  28. package/dist/types/onboarding/steps/connect-accounts.d.mts +1 -1
  29. package/dist/types/onboarding/steps/connect-accounts.d.ts +1 -1
  30. package/dist/types/primitives/icon/icon.constants.d.mts +1 -0
  31. package/dist/types/primitives/icon/icon.constants.d.ts +1 -0
  32. package/dist/types/shared/use-horizontal-scroll-state.d.mts +3 -0
  33. package/dist/types/shared/use-horizontal-scroll-state.d.ts +3 -0
  34. package/dist/types/trading/place-order/index.place-order.utils.d.mts +1 -0
  35. package/dist/types/trading/place-order/index.place-order.utils.d.ts +1 -0
  36. package/dist/types/trading/settlement/index.d.mts +1 -1
  37. package/dist/types/trading/settlement/index.d.ts +1 -1
  38. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1865,6 +1865,12 @@ var iconSizeClasses = {
1865
1865
  medium: "h-6 w-6",
1866
1866
  large: "h-8 w-8"
1867
1867
  };
1868
+ var iconSizePixels = {
1869
+ xs: 12,
1870
+ small: 16,
1871
+ medium: 24,
1872
+ large: 32
1873
+ };
1868
1874
 
1869
1875
  // src/primitives/search/search-empty-icon.tsx
1870
1876
  var import_jsx_runtime40 = require("react/jsx-runtime");
@@ -3466,6 +3472,8 @@ var Icon = (_a) => {
3466
3472
  __spreadValues({
3467
3473
  color,
3468
3474
  className: cn("group/agg-icon", resolvedClassName),
3475
+ width: iconSizePixels[size],
3476
+ height: iconSizePixels[size],
3469
3477
  style: resolvedStyle
3470
3478
  }, props)
3471
3479
  );
@@ -5784,7 +5792,7 @@ EventListSkeletonView.displayName = "EventListSkeletonView";
5784
5792
  var import_hooks13 = require("@agg-build/hooks");
5785
5793
 
5786
5794
  // src/events/item-details/event-list-item-details.constants.ts
5787
- 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";
5788
5796
 
5789
5797
  // src/primitives/skeleton/views/event-list-item-details-skeleton-view.tsx
5790
5798
  var import_jsx_runtime101 = require("react/jsx-runtime");
@@ -9055,14 +9063,23 @@ var import_react14 = require("react");
9055
9063
  var import_react13 = require("react");
9056
9064
  var useHorizontalScrollState = () => {
9057
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);
9058
9069
  const [canScrollLeft, setCanScrollLeft] = (0, import_react13.useState)(false);
9059
9070
  const [canScrollRight, setCanScrollRight] = (0, import_react13.useState)(false);
9060
9071
  const update = (0, import_react13.useCallback)(() => {
9061
9072
  const el = containerRef.current;
9062
9073
  if (!el) return;
9063
- const maxScroll = el.scrollWidth - el.clientWidth;
9064
- setCanScrollLeft(el.scrollLeft > 4);
9065
- 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);
9066
9083
  }, []);
9067
9084
  (0, import_react13.useEffect)(() => {
9068
9085
  const el = containerRef.current;
@@ -9078,7 +9095,15 @@ var useHorizontalScrollState = () => {
9078
9095
  ro.observe(el);
9079
9096
  return () => ro.disconnect();
9080
9097
  }, [update]);
9081
- return { containerRef, canScrollLeft, canScrollRight, update };
9098
+ return {
9099
+ containerRef,
9100
+ hasOverflow,
9101
+ isAtStart,
9102
+ isAtEnd,
9103
+ canScrollLeft,
9104
+ canScrollRight,
9105
+ update
9106
+ };
9082
9107
  };
9083
9108
 
9084
9109
  // src/primitives/tabs/tabs.constants.ts
@@ -9173,6 +9198,9 @@ var Tabs = ({
9173
9198
  });
9174
9199
  const {
9175
9200
  containerRef: tabListRef,
9201
+ hasOverflow,
9202
+ isAtStart,
9203
+ isAtEnd,
9176
9204
  canScrollLeft,
9177
9205
  canScrollRight,
9178
9206
  update: updateScrollState
@@ -9261,7 +9289,7 @@ var Tabs = ({
9261
9289
  "overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
9262
9290
  getMotionClassName(enableAnimations, "scroll-smooth")
9263
9291
  ) : "overflow-x-auto",
9264
- 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]",
9265
9293
  shouldUseOverflowScroll && "select-none",
9266
9294
  shouldUseOverflowScroll && !isBarVariant && "snap-x snap-mandatory",
9267
9295
  shouldUseOverflowScroll && (isDraggingTabs ? "cursor-grabbing" : "cursor-grab")
@@ -9419,7 +9447,10 @@ var Tabs = ({
9419
9447
  left: Math.max(0, nextScrollLeft),
9420
9448
  behavior: getScrollBehavior(enableAnimations)
9421
9449
  });
9422
- }, [enableAnimations, renderedItems, shouldUseOverflowScroll, value]);
9450
+ requestAnimationFrame(() => {
9451
+ updateScrollState();
9452
+ });
9453
+ }, [enableAnimations, renderedItems, shouldUseOverflowScroll, updateScrollState, value]);
9423
9454
  if (shouldUseOverflowSelect) {
9424
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)(
9425
9456
  Select,
@@ -9458,6 +9489,13 @@ var Tabs = ({
9458
9489
  onPointerUp: handleEndTabListDrag,
9459
9490
  onWheel: handleTabListWheel,
9460
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,
9461
9499
  renderedItems.map((item, index) => {
9462
9500
  var _a;
9463
9501
  const isActive = item.value === value;
@@ -9492,6 +9530,7 @@ var Tabs = ({
9492
9530
  isDisabled: !!item.disabled,
9493
9531
  size
9494
9532
  }),
9533
+ !isBarVariant && (size === "s" ? "px-3 md:px-4" : "h-14 px-3 md:h-15 md:px-4"),
9495
9534
  shouldUseOverflowScroll && !isBarVariant && "snap-start",
9496
9535
  classNames == null ? void 0 : classNames.tabTrigger
9497
9536
  ),
@@ -9541,9 +9580,9 @@ var Tabs = ({
9541
9580
  "aria-hidden": true,
9542
9581
  className: cn(
9543
9582
  "agg-tab-scroll-start",
9544
- "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",
9545
9584
  getMotionClassName(enableAnimations, "transition-opacity duration-200"),
9546
- canScrollLeft ? "opacity-100" : "opacity-0"
9585
+ hasOverflow && canScrollLeft && !isAtStart ? "opacity-100" : "opacity-0"
9547
9586
  )
9548
9587
  }
9549
9588
  ),
@@ -9553,9 +9592,9 @@ var Tabs = ({
9553
9592
  "aria-hidden": true,
9554
9593
  className: cn(
9555
9594
  "agg-tab-scroll-end",
9556
- "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",
9557
9596
  getMotionClassName(enableAnimations, "transition-opacity duration-200"),
9558
- canScrollRight ? "opacity-100" : "opacity-0"
9597
+ hasOverflow && canScrollRight && !isAtEnd ? "opacity-100" : "opacity-0"
9559
9598
  )
9560
9599
  }
9561
9600
  )
@@ -11327,8 +11366,85 @@ var EventListItemNotFoundState = ({
11327
11366
  );
11328
11367
  };
11329
11368
  var OUTCOMES_SCROLL_LOAD_THRESHOLD_PX = 16;
11369
+ var OUTCOMES_SCROLL_STATE_EPSILON_PX = 1;
11370
+ var OUTCOMES_SCROLL_MASK_HEIGHT_PX = 24;
11330
11371
  var MARKET_ID_QUERY_PARAM = "marketId";
11331
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
+ };
11332
11448
  var buildOutcomeMidpointsByOutcomeId = (midpointRows) => {
11333
11449
  const outcomeMidpointsByOutcomeId = /* @__PURE__ */ new Map();
11334
11450
  const addOutcomeMidpoints = (value) => {
@@ -11495,6 +11611,31 @@ var EventListItemContent = ({
11495
11611
  const matchedCountLabel = labels.eventItem.matchedCount(
11496
11612
  Math.max(resolvedVenueCount, visibleFooterVenues.length)
11497
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
+ });
11498
11639
  const shouldUseNativeLinkNavigation3 = (eventToHandle) => {
11499
11640
  return eventToHandle.metaKey || eventToHandle.ctrlKey || eventToHandle.shiftKey || eventToHandle.altKey || eventToHandle.button === 1;
11500
11641
  };
@@ -11546,29 +11687,9 @@ var EventListItemContent = ({
11546
11687
  onEventClick == null ? void 0 : onEventClick(event);
11547
11688
  }
11548
11689
  };
11549
- const handleOutcomesScroll = (0, import_react18.useCallback)(
11550
- (eventToHandle) => {
11551
- if (!shouldEnableLazyMarketLoading) return;
11552
- const element = eventToHandle.currentTarget;
11553
- const distanceToBottom = element.scrollHeight - element.scrollTop - element.clientHeight;
11554
- if (distanceToBottom > OUTCOMES_SCROLL_LOAD_THRESHOLD_PX) return;
11555
- if (!isLazyMarketsQueryEnabled) {
11556
- setIsLazyMarketsQueryEnabled(true);
11557
- return;
11558
- }
11559
- if (!hasNextLazyMarketsPage) return;
11560
- if (isLoadingLazyMarkets || isFetchingNextLazyMarketsPage) return;
11561
- void fetchNextLazyMarketsPage();
11562
- },
11563
- [
11564
- fetchNextLazyMarketsPage,
11565
- hasNextLazyMarketsPage,
11566
- isFetchingNextLazyMarketsPage,
11567
- isLazyMarketsQueryEnabled,
11568
- isLoadingLazyMarkets,
11569
- shouldEnableLazyMarketLoading
11570
- ]
11571
- );
11690
+ (0, import_react18.useEffect)(() => {
11691
+ updateScrollState();
11692
+ }, [comparison.rows.length, shouldRenderLoadingOutcomeRow, updateScrollState]);
11572
11693
  const renderArbitrage = (value) => {
11573
11694
  if (value == null) return null;
11574
11695
  if (Math.abs(value) < config.market.arbitrageThreshold) return null;
@@ -11753,69 +11874,94 @@ var EventListItemContent = ({
11753
11874
  ) }) : null
11754
11875
  ] }) })
11755
11876
  ] }),
11756
- /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(
11757
- "div",
11758
- {
11759
- className: cn(
11760
- "agg-outcomes flex max-h-[76px] flex-col gap-4 overflow-y-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
11761
- classNames == null ? void 0 : classNames.outcomes
11762
- ),
11763
- onScroll: handleOutcomesScroll,
11764
- children: [
11765
- comparison.rows.map((row) => {
11766
- var _a2;
11767
- const arbitragePercent = (_a2 = arbitrageByOutcomeId == null ? void 0 : arbitrageByOutcomeId[row.outcome.id]) != null ? _a2 : arbitrageByOutcomeId == null ? void 0 : arbitrageByOutcomeId[row.market.id];
11768
- const arbReturn = arbReturnByVenueMarketId.get(row.market.id);
11769
- const priceGapPercent = arbReturn == null ? gapsByVenueMarketId.get(row.market.id) : arbReturn;
11770
- const priceGapSource = arbReturn == null ? "percent" : "fraction";
11771
- return /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(
11772
- "div",
11773
- {
11774
- className: cn(
11775
- "agg-outcome-row",
11776
- "flex h-10 w-full flex-row items-center justify-between gap-3",
11777
- classNames == null ? void 0 : classNames.outcomeRow
11778
- ),
11779
- children: [
11780
- /* @__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)(
11781
- Typography,
11782
- {
11783
- variant: "body",
11784
- className: "agg-outcome-label min-w-0 truncate text-agg-xs leading-agg-5 md:text-agg-base md:leading-agg-6",
11785
- children: row.label
11786
- }
11787
- ) }),
11788
- /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)("div", { className: "agg-outcome-meta flex shrink-0 flex-row items-center justify-end gap-2", children: [
11789
- renderArbitrage(arbitragePercent),
11790
- renderPriceGapPill(priceGapPercent, priceGapSource),
11791
- /* @__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(
11792
- (price, priceIndex) => renderComparisonPriceBadge(row, price, priceIndex)
11793
- ) })
11794
- ] })
11795
- ]
11796
- },
11797
- row.id
11798
- );
11799
- }),
11800
- shouldRenderLoadingOutcomeRow ? /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)("div", { className: "agg-outcome-row-loading flex w-full items-center justify-between gap-3", children: [
11801
- /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
11802
- "div",
11803
- {
11804
- "aria-hidden": "true",
11805
- className: "bg-agg-separator animate-pulse h-5 rounded-agg-sm w-[200px]"
11806
- }
11807
- ),
11808
- /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
11809
- "div",
11810
- {
11811
- "aria-hidden": "true",
11812
- className: "bg-agg-separator animate-pulse h-9 w-[100px] rounded-agg-full"
11813
- }
11814
- )
11815
- ] }) : null
11816
- ]
11817
- }
11818
- ),
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
+ ] }),
11819
11965
  /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(
11820
11966
  "div",
11821
11967
  {
@@ -11833,6 +11979,14 @@ var EventListItemContent = ({
11833
11979
  "agg-event-meta flex min-w-0 flex-1 items-center gap-2 text-agg-sm leading-agg-5 truncate"
11834
11980
  ),
11835
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,
11836
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,
11837
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: [
11838
11992
  /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
@@ -13890,13 +14044,6 @@ var parseSettlementBlocks = (input) => {
13890
14044
  }
13891
14045
  return blocks;
13892
14046
  };
13893
- var getFirstSettlementParagraph = (input) => {
13894
- if (!input) return "";
13895
- const blocks = parseSettlementBlocks(input);
13896
- const firstParagraph = blocks.find((block) => block.kind === "paragraph");
13897
- if (!firstParagraph || firstParagraph.kind !== "paragraph") return "";
13898
- return firstParagraph.lines.join(" ").trim();
13899
- };
13900
14047
  var normalizeSettlementForCompare = (input) => {
13901
14048
  return stripHtmlFragments(input).replace(/\s+/g, " ").trim().toLowerCase();
13902
14049
  };
@@ -14132,7 +14279,13 @@ var mergePerVenueValues = (current, next) => {
14132
14279
  };
14133
14280
  var prepareSettlementDifferences = (differences) => {
14134
14281
  const byCanonicalKey = /* @__PURE__ */ new Map();
14135
- for (const [originalIndex, difference] of (differences != null ? differences : []).entries()) {
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 });
14136
14289
  const canonicalKey = resolveCanonicalDifferenceKey(difference);
14137
14290
  if (hasEqualNormalizedDateValues(difference, canonicalKey)) continue;
14138
14291
  const existing = byCanonicalKey.get(canonicalKey);
@@ -14187,17 +14340,76 @@ var resolveDifferenceIconClassName = (canonicalKey) => {
14187
14340
  return "fi-rr-info";
14188
14341
  };
14189
14342
  var buildSettlementVenueRules = ({
14190
- eventBlock,
14191
14343
  marketBlock,
14192
14344
  primaryRulesBlock,
14345
+ settlementVenues,
14193
14346
  settlementVenueRules
14194
14347
  }) => {
14195
- if (settlementVenueRules) return settlementVenueRules;
14196
- const content = [marketBlock == null ? void 0 : marketBlock.content, primaryRulesBlock == null ? void 0 : primaryRulesBlock.content, eventBlock == null ? void 0 : eventBlock.content].filter((value) => typeof value === "string" && value.trim().length > 0).join("\n\n");
14197
- return content ? [{ venue: "polymarket", content }] : [];
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
+ });
14198
14375
  };
14199
- var getSettlementHeaderClassName = () => {
14200
- return "flex items-center justify-between gap-4";
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
+ ] });
14201
14413
  };
14202
14414
  var Settlement = ({
14203
14415
  className,
@@ -14231,13 +14443,20 @@ var Settlement = ({
14231
14443
  const primaryRulesBlock = (_c = blocks.find((block) => block.key === "primaryRules")) != null ? _c : null;
14232
14444
  const venueRuleBlocks = (0, import_react22.useMemo)(
14233
14445
  () => buildSettlementVenueRules({
14234
- eventBlock,
14235
14446
  marketBlock,
14236
14447
  primaryRulesBlock,
14448
+ settlementVenues,
14237
14449
  settlementVenueRules
14238
14450
  }),
14239
- [eventBlock, marketBlock, primaryRulesBlock, settlementVenueRules]
14240
- );
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;
14241
14460
  const defaultOpenDifferenceKey = (_e = (_d = settlementDifferences[0]) == null ? void 0 : _d.canonicalKey) != null ? _e : null;
14242
14461
  const [openDifferenceKeys, setOpenDifferenceKeys] = (0, import_react22.useState)(
14243
14462
  () => defaultOpenDifferenceKey ? [defaultOpenDifferenceKey] : []
@@ -14260,25 +14479,51 @@ var Settlement = ({
14260
14479
  }
14261
14480
  );
14262
14481
  }
14482
+ if (!hasSettlementContent) return null;
14263
14483
  const resolvedSectionLabel = sectionLabel === defaultSettlementSectionLabel ? labels.trading.settlementSection : sectionLabel;
14264
- if (settlementDifferences.length > 0) {
14265
- return /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)(
14266
- Card,
14267
- {
14268
- id,
14269
- className: cn(
14270
- "group/agg-settlement-card",
14271
- "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",
14272
- className
14273
- ),
14274
- children: [
14275
- /* @__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: [
14276
- /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("p", { className: "shrink-0 text-agg-xs font-agg-bold leading-agg-4 uppercase", children: resolvedSectionLabel }),
14277
- 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
14278
- ] }),
14279
- /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)("div", { className: "agg-settlement-differences flex w-full flex-col items-start gap-5", children: [
14484
+ return /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)(
14485
+ Card,
14486
+ {
14487
+ id,
14488
+ className: cn(
14489
+ "group/agg-settlement-card",
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",
14491
+ className
14492
+ ),
14493
+ children: [
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
14497
+ ] }),
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: [
14280
14525
  /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)("div", { className: "flex items-center gap-2", children: [
14281
- /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: "Key differences" }),
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 }),
14282
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 })
14283
14528
  ] }),
14284
14529
  /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("div", { className: "flex w-full flex-col items-start gap-5", children: settlementDifferences.map((difference) => {
@@ -14294,7 +14539,7 @@ var Settlement = ({
14294
14539
  "button",
14295
14540
  {
14296
14541
  type: "button",
14297
- className: "flex w-full cursor-pointer items-start gap-2 text-left",
14542
+ className: "flex w-full cursor-pointer items-center gap-2 text-left group/agg-settlement-difference",
14298
14543
  "aria-expanded": isExpanded,
14299
14544
  onClick: () => handleToggleDifference(difference.canonicalKey),
14300
14545
  children: [
@@ -14309,12 +14554,16 @@ var Settlement = ({
14309
14554
  "aria-hidden": "true"
14310
14555
  }
14311
14556
  ),
14312
- /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("p", { className: "min-w-0 text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground break-words [overflow-wrap:anywhere]", children: difference.title }),
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 }),
14313
14558
  /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
14314
- Icon,
14559
+ "i",
14315
14560
  {
14316
- name: isExpanded ? "chevron-up" : "chevron-down",
14317
- className: "size-4! mt-0.5 shrink-0 text-agg-foreground",
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 },
14318
14567
  "aria-hidden": "true"
14319
14568
  }
14320
14569
  )
@@ -14343,80 +14592,12 @@ var Settlement = ({
14343
14592
  },
14344
14593
  difference.canonicalKey
14345
14594
  );
14346
- }) }),
14347
- venueRuleBlocks.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)(import_jsx_runtime140.Fragment, { children: [
14348
- /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("div", { className: "h-px w-full bg-agg-separator" }),
14349
- /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: "Full rules by venue" }),
14350
- /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("div", { className: "flex w-full flex-col items-start gap-4", children: venueRuleBlocks.map((rule) => {
14351
- const venueLabel = resolveSettlementVenueLabel(rule.venue, labels);
14352
- return /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)("details", { className: "group/agg-settlement-rule w-full", children: [
14353
- /* @__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 marker:hidden", children: [
14354
- /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
14355
- VenueLogo,
14356
- {
14357
- venue: rule.venue,
14358
- size: "small",
14359
- className: "size-4",
14360
- ariaLabel: venueLabel
14361
- }
14362
- ),
14363
- /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("span", { children: venueLabel }),
14364
- /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
14365
- Icon,
14366
- {
14367
- name: "chevron-down",
14368
- className: "size-4! shrink-0 text-agg-foreground transition-transform group-open/agg-settlement-rule:rotate-180",
14369
- "aria-hidden": "true"
14370
- }
14371
- )
14372
- ] }),
14373
- /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("div", { className: "mt-3 pl-6", children: /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(SettlementTextRenderer, { content: rule.content }) })
14374
- ] }, rule.venue);
14375
- }) })
14376
- ] }) : null
14377
- ] })
14378
- ]
14379
- }
14380
- );
14381
- }
14382
- return /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)(
14383
- Card,
14384
- {
14385
- id,
14386
- className: cn(
14387
- "group/agg-settlement-card",
14388
- "flex flex-col w-full gap-5 rounded-agg-xl border border-agg-separator bg-agg-secondary p-5 shadow-none hover:shadow-none",
14389
- className
14390
- ),
14391
- children: [
14392
- /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)("div", { className: cn("agg-settlement-header", getSettlementHeaderClassName()), children: [
14393
- /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("p", { className: "text-agg-xs font-agg-bold leading-agg-4 uppercase text-agg-muted-foreground", children: resolvedSectionLabel }),
14394
- 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
14395
- ] }),
14396
- blocks.length === 0 && settlementDifferences.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: [
14397
- eventBlock || marketBlock ? /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)(
14398
- "div",
14399
- {
14400
- className: "agg-settlement-section agg-settlement-section-description",
14401
- "data-source": "description",
14402
- children: [
14403
- eventBlock ? /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("div", { "data-source": "eventDescription", children: /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(SettlementTextRenderer, { content: eventBlock.content }) }) : null,
14404
- eventBlock && marketBlock ? /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("hr", { className: "agg-settlement-divider my-4 border-0 border-t border-agg-separator" }) : null,
14405
- marketBlock ? /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("div", { "data-source": "marketDescription", children: /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(SettlementTextRenderer, { content: marketBlock.content }) }) : null
14406
- ]
14407
- }
14408
- ) : null,
14409
- primaryRulesBlock ? /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)(
14410
- "div",
14411
- {
14412
- className: "agg-settlement-section agg-settlement-section-primaryRules",
14413
- "data-source": "primaryRules",
14414
- children: [
14415
- /* @__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 }),
14416
- /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(SettlementTextRenderer, { content: primaryRulesBlock.content })
14417
- ]
14418
- }
14419
- ) : null
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
14420
14601
  ] })
14421
14602
  ]
14422
14603
  }
@@ -14427,18 +14608,16 @@ Settlement.displayName = "Settlement";
14427
14608
  // src/events/item-details/settlement-summary.tsx
14428
14609
  var import_jsx_runtime141 = require("react/jsx-runtime");
14429
14610
  var SettlementSummary = ({
14430
- content,
14431
14611
  settlementDiff,
14432
14612
  settlementSectionId = SETTLEMENT_SECTION_ID,
14433
14613
  className
14434
14614
  }) => {
14435
14615
  const labels = (0, import_hooks47.useLabels)();
14436
- const firstParagraph = (0, import_react23.useMemo)(() => getFirstSettlementParagraph(content), [content]);
14437
14616
  const settlementDifferences = (0, import_react23.useMemo)(
14438
14617
  () => prepareSettlementDifferences(settlementDiff == null ? void 0 : settlementDiff.differences),
14439
14618
  [settlementDiff == null ? void 0 : settlementDiff.differences]
14440
14619
  );
14441
- if (!firstParagraph && settlementDifferences.length === 0) return null;
14620
+ if (settlementDifferences.length === 0) return null;
14442
14621
  const handleReadFullDetails = (event) => {
14443
14622
  event.preventDefault();
14444
14623
  event.stopPropagation();
@@ -14447,20 +14626,6 @@ var SettlementSummary = ({
14447
14626
  if (!target) return;
14448
14627
  target.scrollIntoView({ behavior: "smooth", block: "start" });
14449
14628
  };
14450
- const handleDifferencePillClick = (event, canonicalKey) => {
14451
- event.preventDefault();
14452
- event.stopPropagation();
14453
- if (typeof document === "undefined") return;
14454
- const target = document.getElementById(
14455
- getSettlementDifferenceId(settlementSectionId, canonicalKey)
14456
- );
14457
- if (!target) return;
14458
- const trigger = target.querySelector("button[aria-expanded]");
14459
- if ((trigger == null ? void 0 : trigger.getAttribute("aria-expanded")) === "false") {
14460
- trigger.click();
14461
- }
14462
- target.scrollIntoView({ behavior: "smooth", block: "start" });
14463
- };
14464
14629
  const actionButton = /* @__PURE__ */ (0, import_jsx_runtime141.jsxs)(
14465
14630
  "button",
14466
14631
  {
@@ -14475,85 +14640,59 @@ var SettlementSummary = ({
14475
14640
  onClick: handleReadFullDetails,
14476
14641
  children: [
14477
14642
  /* @__PURE__ */ (0, import_jsx_runtime141.jsx)("span", { children: labels.settlementSummary.readFullDetails }),
14478
- /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(Icon, { name: "chevron-down", className: "size-[14px]", "aria-hidden": "true" })
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
+ )
14479
14651
  ]
14480
14652
  }
14481
14653
  );
14482
- if (settlementDifferences.length > 0) {
14483
- const visibleDifferences = settlementDifferences.slice(0, 2);
14484
- const hiddenDifferenceCount = settlementDifferences.length - visibleDifferences.length;
14485
- return /* @__PURE__ */ (0, import_jsx_runtime141.jsxs)(
14486
- "div",
14487
- {
14488
- className: cn(
14489
- "agg-settlement-summary flex w-full flex-wrap items-start justify-between gap-x-4 gap-y-2",
14490
- className
14491
- ),
14492
- children: [
14493
- /* @__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: [
14494
- /* @__PURE__ */ (0, import_jsx_runtime141.jsxs)("div", { className: "agg-settlement-summary-heading flex shrink-0 items-center gap-2", children: [
14495
- /* @__PURE__ */ (0, import_jsx_runtime141.jsx)("p", { className: "text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground", children: labels.settlementSummary.title }),
14496
- /* @__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 })
14497
- ] }),
14498
- /* @__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: [
14499
- visibleDifferences.map((difference) => /* @__PURE__ */ (0, import_jsx_runtime141.jsxs)(
14500
- "button",
14501
- {
14502
- type: "button",
14503
- className: cn(
14504
- "flex h-6 max-w-full shrink-0 cursor-pointer items-center gap-2 rounded-agg-full bg-agg-secondary-hover px-3 py-1 text-agg-xs font-agg-normal leading-agg-4 text-agg-foreground sm:max-w-[220px]",
14505
- "hover:opacity-80",
14506
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-0 focus-visible:ring-offset-agg-secondary"
14507
- ),
14508
- onClick: (event) => handleDifferencePillClick(event, difference.canonicalKey),
14509
- children: [
14510
- /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(
14511
- "i",
14512
- {
14513
- className: cn(
14514
- "fi",
14515
- resolveDifferenceIconClassName(difference.canonicalKey),
14516
- "inline-flex size-3 shrink-0 items-center justify-center text-[12px] leading-none text-agg-muted-foreground"
14517
- ),
14518
- "aria-hidden": "true"
14519
- }
14520
- ),
14521
- /* @__PURE__ */ (0, import_jsx_runtime141.jsx)("span", { className: "min-w-0 truncate", children: difference.title })
14522
- ]
14523
- },
14524
- difference.canonicalKey
14525
- )),
14526
- 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: [
14527
- "+",
14528
- hiddenDifferenceCount
14529
- ] }) : null
14530
- ] })
14531
- ] }),
14532
- actionButton
14533
- ]
14534
- }
14535
- );
14536
- }
14654
+ const visibleDifferences = settlementDifferences.slice(0, 2);
14655
+ const hiddenDifferenceCount = settlementDifferences.length - visibleDifferences.length;
14537
14656
  return /* @__PURE__ */ (0, import_jsx_runtime141.jsxs)(
14538
14657
  "div",
14539
14658
  {
14540
14659
  className: cn(
14541
- "agg-settlement-summary flex w-full items-center justify-between gap-4",
14660
+ "agg-settlement-summary flex w-full flex-wrap items-start justify-between gap-x-4 gap-y-2",
14542
14661
  className
14543
14662
  ),
14544
14663
  children: [
14545
- /* @__PURE__ */ (0, import_jsx_runtime141.jsxs)("div", { className: "agg-settlement-summary-row flex min-w-0 flex-1 items-center gap-5", children: [
14546
- /* @__PURE__ */ (0, import_jsx_runtime141.jsx)("div", { className: "agg-settlement-summary-heading flex shrink-0 items-center gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime141.jsx)("p", { className: "text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground", children: labels.settlementSummary.title }) }),
14547
- /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(
14548
- "p",
14549
- {
14550
- className: cn(
14551
- "agg-settlement-summary-text",
14552
- "min-w-0 flex-1 truncate text-agg-sm leading-agg-5 text-agg-foreground"
14553
- ),
14554
- children: firstParagraph
14555
- }
14556
- )
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
+ ] })
14557
14696
  ] }),
14558
14697
  actionButton
14559
14698
  ]
@@ -17199,7 +17338,7 @@ var MarketDetailsContent = ({
17199
17338
  value: selectedTab === "other" ? "order-book" : selectedTab,
17200
17339
  onChange: (nextValue) => setSelectedTab(nextValue),
17201
17340
  variant: "underline",
17202
- className: "agg-market-tabs w-full px-5"
17341
+ className: "agg-market-tabs flex! w-full px-5"
17203
17342
  }
17204
17343
  ) }),
17205
17344
  /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("div", { className: "h-px w-full bg-agg-separator" })
@@ -17569,7 +17708,7 @@ MarketDetailsList.displayName = "MarketDetailsList";
17569
17708
 
17570
17709
  // src/events/list/index.tsx
17571
17710
  var import_hooks53 = require("@agg-build/hooks");
17572
- var import_sdk15 = require("@agg-build/sdk");
17711
+ var import_sdk16 = require("@agg-build/sdk");
17573
17712
  var Dialog2 = __toESM(require("@radix-ui/react-dialog"));
17574
17713
  var import_react31 = require("react");
17575
17714
 
@@ -17692,6 +17831,7 @@ CategorySidebar.displayName = "CategorySidebar";
17692
17831
 
17693
17832
  // src/events/list/event-list-tabs.tsx
17694
17833
  var import_hooks52 = require("@agg-build/hooks");
17834
+ var import_sdk15 = require("@agg-build/sdk");
17695
17835
  var import_react30 = require("react");
17696
17836
 
17697
17837
  // src/events/list/event-list.constants.ts
@@ -17716,12 +17856,6 @@ var getDefaultEventListTabs = (labels) => {
17716
17856
  venueLogo: import_sdk14.Venue.polymarket,
17717
17857
  venues: [import_sdk14.Venue.polymarket]
17718
17858
  },
17719
- {
17720
- value: import_sdk14.Venue.kalshi,
17721
- label: labels.venues.kalshi,
17722
- venueLogo: import_sdk14.Venue.kalshi,
17723
- venues: [import_sdk14.Venue.kalshi]
17724
- },
17725
17859
  {
17726
17860
  value: import_sdk14.Venue.limitless,
17727
17861
  label: labels.venues.limitless,
@@ -17785,6 +17919,7 @@ var useEventListTabs = (tabs) => {
17785
17919
  const baseTabs = tabs != null ? tabs : getDefaultEventListTabs(labels);
17786
17920
  return baseTabs.flatMap((tab) => {
17787
17921
  if (!tab.venueLogo) return [tab];
17922
+ if (!(0, import_sdk15.isVenueActive)(tab.venueLogo)) return [];
17788
17923
  const availabilityState = (0, import_hooks52.getVenueAvailabilityState)({
17789
17924
  venueId: tab.venueLogo,
17790
17925
  disabledVenues,
@@ -17977,7 +18112,7 @@ var EventList = ({
17977
18112
  const isDiscoveryFiltersEnabled = enableVenueEventDiscoveryFilters && !search;
17978
18113
  const resolvedTabs = useEventListTabs();
17979
18114
  const visibleVenues = (0, import_react31.useMemo)(
17980
- () => 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),
17981
18116
  [disabledVenues]
17982
18117
  );
17983
18118
  const [activeTabValue, setActiveTabValue] = (0, import_react31.useState)(
@@ -18435,7 +18570,7 @@ EventList.displayName = "EventList";
18435
18570
 
18436
18571
  // src/pages/home/index.tsx
18437
18572
  var import_hooks65 = require("@agg-build/hooks");
18438
- var import_sdk18 = require("@agg-build/sdk");
18573
+ var import_sdk19 = require("@agg-build/sdk");
18439
18574
  var import_react45 = require("react");
18440
18575
 
18441
18576
  // src/pages/event-market/index.tsx
@@ -18443,10 +18578,10 @@ var import_hooks64 = require("@agg-build/hooks");
18443
18578
  var import_react42 = require("react");
18444
18579
 
18445
18580
  // src/trading/types.ts
18446
- var import_sdk16 = require("@agg-build/sdk");
18447
- var isVenue = (0, import_sdk16.enumGuard)(import_sdk16.Venue);
18448
- var parseVenue = (v) => (0, import_sdk16.safeParse)(v, isVenue);
18449
- 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);
18450
18585
 
18451
18586
  // src/trading/settlement/settlement-details.tsx
18452
18587
  var import_hooks54 = require("@agg-build/hooks");
@@ -18454,33 +18589,57 @@ var import_jsx_runtime151 = require("react/jsx-runtime");
18454
18589
  var hasContent = (value) => {
18455
18590
  return typeof value === "string" && value.trim().length > 0;
18456
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
+ };
18457
18609
  var SettlementDetails = ({ className }) => {
18458
- var _a, _b, _c, _d, _e, _f, _g, _h;
18610
+ var _a, _b, _c, _d, _e, _f;
18459
18611
  const tradingContext = (0, import_hooks54.useEventTradingContext)();
18460
18612
  const selectedEvent = (_a = tradingContext == null ? void 0 : tradingContext.selectedEvent) != null ? _a : null;
18461
18613
  const selectedMarket = (_b = tradingContext == null ? void 0 : tradingContext.selectedMarket) != null ? _b : null;
18462
18614
  if (!selectedEvent) return null;
18463
- 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
+ );
18464
18626
  const eventDescription = (_c = selectedEvent.description) != null ? _c : null;
18465
- const marketDescription = (_d = selectedMarket.description) != null ? _d : null;
18466
- const primaryRules = (_e = selectedMarket.rulesPrimary) != null ? _e : null;
18627
+ const marketDescription = (_d = activeMarket.description) != null ? _d : null;
18628
+ const primaryRules = (_e = activeMarket.rulesPrimary) != null ? _e : null;
18467
18629
  const settlementDiff = (_f = selectedEvent.settlementDiff) != null ? _f : null;
18468
18630
  const settlementVenues = Array.from(
18469
- new Set(selectedEvent.venueMarkets.map((market) => market.venue))
18470
- );
18471
- const selectedMarketRuleContent = [
18472
- selectedMarket.description,
18473
- selectedMarket.rulesPrimary,
18474
- selectedMarket.rulesSecondary
18475
- ].filter(hasContent).join("\n\n");
18476
- const settlementVenueRules = selectedMarketRuleContent ? [{ venue: selectedMarket.venue, content: selectedMarketRuleContent }] : [];
18477
- if (!hasContent(eventDescription) && !hasContent(marketDescription) && !hasContent(primaryRules) && ((_g = settlementDiff == null ? void 0 : settlementDiff.differences.length) != null ? _g : 0) === 0) {
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) {
18478
18637
  return null;
18479
18638
  }
18480
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)(
18481
18640
  Settlement,
18482
18641
  {
18483
- question: (_h = selectedMarket.question) != null ? _h : selectedEvent.title,
18642
+ question: selectedEvent.title,
18484
18643
  eventDescription,
18485
18644
  marketDescription,
18486
18645
  primaryRules,
@@ -18937,7 +19096,7 @@ var enableExecutionDebugInBrowser = (initial) => {
18937
19096
  };
18938
19097
 
18939
19098
  // src/trading/place-order/index.place-order.execution-steps.ts
18940
- var import_sdk17 = require("@agg-build/sdk");
19099
+ var import_sdk18 = require("@agg-build/sdk");
18941
19100
  var WAIT_STEP_TYPES = /* @__PURE__ */ new Set(["_wait", "wait"]);
18942
19101
  var CHECKING_BALANCE_STEP_TYPES = /* @__PURE__ */ new Set([
18943
19102
  "check-balance",
@@ -18948,14 +19107,14 @@ var CHECKING_BALANCE_STEP_TYPES = /* @__PURE__ */ new Set([
18948
19107
  var VENUE_BUY_SELL_REGEX = /^(?:buy|sell)-([a-z]+)$/;
18949
19108
  var VENUE_FINALIZE_REGEX = /^([a-z]+)-finalize$/;
18950
19109
  var VENUE_NAME_MAP = {
18951
- kalshi: import_sdk17.Venue.kalshi,
18952
- polymarket: import_sdk17.Venue.polymarket,
18953
- limitless: import_sdk17.Venue.limitless,
18954
- opinion: import_sdk17.Venue.opinion,
18955
- predict: import_sdk17.Venue.predict,
18956
- probable: import_sdk17.Venue.probable,
18957
- myriad: import_sdk17.Venue.myriad,
18958
- 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
18959
19118
  };
18960
19119
  var parseVenueName = (raw) => VENUE_NAME_MAP[raw];
18961
19120
  var NON_VENUE_FINALIZE_PREFIXES = /* @__PURE__ */ new Set(["bridge"]);
@@ -19136,6 +19295,10 @@ var extractGeoBlockedVenues = (warnings) => {
19136
19295
  warnings.filter((w) => w.venue && isGeoBlockWarningReason(w.reason)).map((w) => w.venue)
19137
19296
  );
19138
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
+ };
19139
19302
  var getPlaceOrderContainerClassName = () => {
19140
19303
  return PLACE_ORDER_CONTAINER_CLASS_NAME;
19141
19304
  };
@@ -22102,6 +22265,7 @@ var PlaceOrder = ({
22102
22265
  return fills.length > 0 && fills.every((f) => geoBlockedVenuesFromWarnings.has(f.venue));
22103
22266
  }, [selectedRouteCard, geoBlockedVenuesFromWarnings]);
22104
22267
  const shouldShowGeoBlockBanner = isTradingBlocked || selectedRouteGeoBlocked || isPrimaryVenueGeoBlocked;
22268
+ const shouldShowLowLiquidityWarning = !isQuoteInputEditing && !isQuoteLoading && (activeQuoteData == null ? void 0 : activeQuoteData.venueMarketOutcomeId) === scopedSelectedOutcomeId && hasLowLiquidityWarning(activeQuoteData.warnings);
22105
22269
  const actionLabel = `${internalTab === "buy" ? tradingLabels.buy : tradingLabels.sell} ${selectedOutcomeLabel}`.trim();
22106
22270
  const isActionDisabled = isPrimaryActionDisabled || !orderEligibility.canPlaceOrder || isActionLoading || !hasEnteredAmount || !scopedSelectedMarket || isInsufficientBalance || isQuoteInsufficientBalance || isBelowMinimum || isQuoteLoading || !selectedRouteCard || !selectedRouteCard.quoteData.quoteId || selectedRouteGeoBlocked || !isAuthenticated || quoteStatus !== void 0;
22107
22271
  const shouldShowSmartRouting = orderEligibility.canPlaceOrder && hasEnteredAmount && !isBelowMinimum && (orderedRouteCards.length > 0 || smartRoute.isFetching || smartRoute.isLoading);
@@ -22908,6 +23072,25 @@ var PlaceOrder = ({
22908
23072
  children: actionLabel
22909
23073
  }
22910
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,
22911
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: [
22912
23095
  /* @__PURE__ */ (0, import_jsx_runtime155.jsx)(
22913
23096
  Icon,
@@ -25656,7 +25839,7 @@ var HomeSearchResults = ({
25656
25839
  const eventListTabs = useEventListTabs();
25657
25840
  const { headerRef, titleRef, shouldUseSelectOverflow } = useEventListTabsHeaderOverflow(eventListTabs);
25658
25841
  const visibleVenues = (0, import_react45.useMemo)(
25659
- () => 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),
25660
25843
  [disabledVenues]
25661
25844
  );
25662
25845
  const activeVenueTab = (0, import_react45.useMemo)(() => {
@@ -26143,7 +26326,7 @@ HomePage.displayName = "HomePage";
26143
26326
 
26144
26327
  // src/pages/user-profile/index.tsx
26145
26328
  var import_hooks71 = require("@agg-build/hooks");
26146
- var import_sdk20 = require("@agg-build/sdk");
26329
+ var import_sdk21 = require("@agg-build/sdk");
26147
26330
  var import_react47 = require("react");
26148
26331
 
26149
26332
  // src/pages/user-profile/chain-display.ts
@@ -26382,17 +26565,17 @@ AvailableBalanceCard.displayName = "AvailableBalanceCard";
26382
26565
 
26383
26566
  // src/pages/user-profile/components/claim-activity-breakdown-modal.tsx
26384
26567
  var import_hooks67 = require("@agg-build/hooks");
26385
- var import_sdk19 = require("@agg-build/sdk");
26568
+ var import_sdk20 = require("@agg-build/sdk");
26386
26569
  var import_jsx_runtime164 = require("react/jsx-runtime");
26387
26570
  var CLAIM_VENUE_LABELS = {
26388
- [import_sdk19.Venue.kalshi]: "Kalshi",
26389
- [import_sdk19.Venue.polymarket]: "Polymarket",
26390
- [import_sdk19.Venue.limitless]: "Limitless",
26391
- [import_sdk19.Venue.opinion]: "Opinion",
26392
- [import_sdk19.Venue.predict]: "Predict",
26393
- [import_sdk19.Venue.probable]: "Probable",
26394
- [import_sdk19.Venue.myriad]: "Myriad",
26395
- [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"
26396
26579
  };
26397
26580
  var ClaimActivityBreakdownModal = ({
26398
26581
  activity,
@@ -27299,10 +27482,6 @@ EmptyState.displayName = "EmptyState";
27299
27482
  // src/pages/user-profile/components/position-row.tsx
27300
27483
  var import_hooks68 = require("@agg-build/hooks");
27301
27484
  var import_jsx_runtime167 = require("react/jsx-runtime");
27302
- var floorToTwoDecimals = (value) => {
27303
- if (!Number.isFinite(value) || value <= 0) return 0;
27304
- return Math.trunc(value * 100) / 100;
27305
- };
27306
27485
  var shouldUseNativeLinkNavigation2 = (event) => {
27307
27486
  return event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button === 1;
27308
27487
  };
@@ -27315,32 +27494,21 @@ var OutcomePill = ({ label: label2 }) => /* @__PURE__ */ (0, import_jsx_runtime1
27315
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 }) });
27316
27495
  var VenueShares = ({
27317
27496
  model,
27318
- totalSharesLabel,
27319
27497
  className,
27320
27498
  keyPrefix
27321
27499
  }) => {
27322
- if (!totalSharesLabel && model.venueShareBreakdown.length === 0) return null;
27323
- return /* @__PURE__ */ (0, import_jsx_runtime167.jsxs)("div", { className: cn(className, "gap-2"), children: [
27324
- 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)(
27325
- Tooltip,
27326
- {
27327
- content: /* @__PURE__ */ (0, import_jsx_runtime167.jsx)("span", { children: row.sharesLabel }),
27328
- "aria-label": `${row.venue} shares`,
27329
- side: "top",
27330
- children: /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(
27331
- "span",
27332
- {
27333
- tabIndex: 0,
27334
- 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",
27335
- "aria-label": `${row.venue} shares`,
27336
- children: /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(VenueLogo, { venue: row.venue, size: "small", className: "size-4 shrink-0" })
27337
- }
27338
- )
27339
- },
27340
- `${keyPrefix}-${row.venue}-${String(index)}`
27341
- )) }) : null,
27342
- 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
27343
- ] });
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
+ )) });
27344
27512
  };
27345
27513
  var StatusBadge = ({
27346
27514
  status,
@@ -27457,7 +27625,6 @@ var PositionRow = ({
27457
27625
  finalPrefix: labels.finalPrefix
27458
27626
  });
27459
27627
  const isClosed = (variant != null ? variant : model.bucket) === "closed";
27460
- const totalSharesLabel = typeof position.totalShares === "number" && Number.isFinite(position.totalShares) ? `${String(floorToTwoDecimals(position.totalShares))} shares` : null;
27461
27628
  const handleClaim = (event) => {
27462
27629
  event.preventDefault();
27463
27630
  event.stopPropagation();
@@ -27518,7 +27685,6 @@ var PositionRow = ({
27518
27685
  VenueShares,
27519
27686
  {
27520
27687
  model,
27521
- totalSharesLabel,
27522
27688
  keyPrefix: "desktop",
27523
27689
  className: "agg-position-venues flex flex-1 flex-wrap content-center items-center gap-x-3 gap-y-2"
27524
27690
  }
@@ -27533,7 +27699,6 @@ var PositionRow = ({
27533
27699
  VenueShares,
27534
27700
  {
27535
27701
  model,
27536
- totalSharesLabel,
27537
27702
  keyPrefix: "mobile",
27538
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"
27539
27704
  }
@@ -28672,10 +28837,10 @@ var toRedeemTransactions = (item) => {
28672
28837
  });
28673
28838
  };
28674
28839
  var POSITION_ROW_VENUE_ORDER = [
28675
- import_sdk20.Venue.polymarket,
28676
- import_sdk20.Venue.kalshi,
28677
- import_sdk20.Venue.opinion,
28678
- import_sdk20.Venue.limitless
28840
+ import_sdk21.Venue.polymarket,
28841
+ import_sdk21.Venue.kalshi,
28842
+ import_sdk21.Venue.opinion,
28843
+ import_sdk21.Venue.limitless
28679
28844
  ];
28680
28845
  function venueBreakdownSortKey(venue) {
28681
28846
  const idx = POSITION_ROW_VENUE_ORDER.indexOf(venue);
@@ -28689,7 +28854,19 @@ function buildVenueShareBreakdown(outcome) {
28689
28854
  if (breakdown.length === 0) {
28690
28855
  return [];
28691
28856
  }
28692
- 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(
28693
28870
  (a, b) => venueBreakdownSortKey(a.venue) - venueBreakdownSortKey(b.venue)
28694
28871
  );
28695
28872
  return sorted.map((row) => ({
@@ -31771,7 +31948,7 @@ var import_hooks91 = require("@agg-build/hooks");
31771
31948
  var Dialog7 = __toESM(require("@radix-ui/react-dialog"));
31772
31949
 
31773
31950
  // src/onboarding/onboarding-modal.constants.ts
31774
- var import_sdk21 = require("@agg-build/sdk");
31951
+ var import_sdk22 = require("@agg-build/sdk");
31775
31952
  var HOW_IT_WORKS_FEATURE_KEYS = [
31776
31953
  "createAccount",
31777
31954
  "linkAccounts",
@@ -31783,7 +31960,11 @@ var ONBOARDING_STEPS = {
31783
31960
  PROFILE_SETUP: 1,
31784
31961
  CONNECT_ACCOUNTS: 2
31785
31962
  };
31786
- 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);
31787
31968
 
31788
31969
  // src/onboarding/steps/how-it-works.tsx
31789
31970
  var import_react52 = require("react");
@@ -32003,7 +32184,6 @@ var ProfileSetupStep = ({ onContinue }) => {
32003
32184
  ProfileSetupStep.displayName = "ProfileSetupStep";
32004
32185
 
32005
32186
  // src/onboarding/steps/connect-accounts.tsx
32006
- var import_sdk22 = require("@agg-build/sdk");
32007
32187
  var import_hooks88 = require("@agg-build/hooks");
32008
32188
  var import_jsx_runtime190 = require("react/jsx-runtime");
32009
32189
  var OnchainVenueLogos = () => {
@@ -32074,51 +32254,27 @@ var VenueCard = ({
32074
32254
  };
32075
32255
  var ConnectAccountsStep = ({
32076
32256
  onConnectOnchain,
32077
- onConnectKalshi,
32078
32257
  onContinue,
32079
- connectedOnchain = false,
32080
- connectedKalshi = false
32258
+ connectedOnchain = false
32081
32259
  }) => {
32082
32260
  const labels = (0, import_hooks88.useLabels)();
32083
- const canContinue = connectedOnchain || connectedKalshi;
32261
+ const canContinue = connectedOnchain;
32084
32262
  return /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)("div", { className: "flex flex-col gap-6", children: [
32085
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 }),
32086
- /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)("div", { className: "flex flex-col gap-4", children: [
32087
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
32088
- VenueCard,
32089
- {
32090
- logos: /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(OnchainVenueLogos, {}),
32091
- title: labels.onboarding.connectAccounts.onchainTitle,
32092
- mobileTitle: labels.onboarding.connectAccounts.onchainMobileTitle(
32093
- ONCHAIN_VENUES.length - 1
32094
- ),
32095
- description: labels.onboarding.connectAccounts.onchainDescription,
32096
- mobileDescription: labels.onboarding.connectAccounts.onchainMobileDescription,
32097
- onConnect: onConnectOnchain,
32098
- connected: connectedOnchain
32099
- }
32100
- ),
32101
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
32102
- VenueCard,
32103
- {
32104
- 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)(
32105
- VenueLogo,
32106
- {
32107
- venue: import_sdk22.Venue.kalshi,
32108
- variant: "logo",
32109
- size: "large",
32110
- className: "h-6 w-6 sm:h-9 sm:w-9"
32111
- }
32112
- ) }),
32113
- title: labels.onboarding.connectAccounts.kalshiTitle,
32114
- mobileTitle: labels.onboarding.connectAccounts.kalshiMobileTitle,
32115
- description: labels.onboarding.connectAccounts.kalshiDescription,
32116
- mobileDescription: labels.onboarding.connectAccounts.kalshiMobileDescription,
32117
- onConnect: onConnectKalshi,
32118
- connected: connectedKalshi
32119
- }
32120
- )
32121
- ] }),
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
+ ) }),
32122
32278
  /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
32123
32279
  Button,
32124
32280
  {
@@ -32134,27 +32290,135 @@ var ConnectAccountsStep = ({
32134
32290
  };
32135
32291
  ConnectAccountsStep.displayName = "ConnectAccountsStep";
32136
32292
 
32137
- // src/onboarding/steps/connect-kalshi-modal.tsx
32138
- var import_sdk23 = require("@agg-build/sdk");
32293
+ // src/onboarding/steps/connect-onchain-modal.tsx
32139
32294
  var import_react54 = require("react");
32140
32295
  var import_hooks89 = require("@agg-build/hooks");
32141
32296
  var Dialog5 = __toESM(require("@radix-ui/react-dialog"));
32142
32297
  var import_jsx_runtime191 = require("react/jsx-runtime");
32143
- var ConnectKalshiModal = ({
32298
+ var ConnectOnchainModal = ({
32144
32299
  open,
32145
32300
  onOpenChange,
32146
- onVerify
32301
+ onConnect
32147
32302
  }) => {
32148
32303
  const labels = (0, import_hooks89.useLabels)();
32149
- const [apiKeyId, setApiKeyId] = (0, import_react54.useState)("");
32150
- const [privateKey, setPrivateKey] = (0, import_react54.useState)("");
32151
- const [verifying, setVerifying] = (0, import_react54.useState)(false);
32304
+ const [connecting, setConnecting] = (0, import_react54.useState)(false);
32152
32305
  const [error, setError] = (0, import_react54.useState)();
32153
- const canVerify = apiKeyId.trim().length > 0 && privateKey.trim().length > 0;
32154
32306
  const handleCancel = (0, import_react54.useCallback)(() => {
32155
32307
  onOpenChange(false);
32156
32308
  }, [onOpenChange]);
32157
- 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* () {
32158
32422
  if (!canVerify || verifying) return;
32159
32423
  setVerifying(true);
32160
32424
  setError(void 0);
@@ -32183,7 +32447,7 @@ var ConnectKalshiModal = ({
32183
32447
  privateKey,
32184
32448
  verifying
32185
32449
  ]);
32186
- const handleOpenChange = (0, import_react54.useCallback)(
32450
+ const handleOpenChange = (0, import_react55.useCallback)(
32187
32451
  (value) => {
32188
32452
  if (value) {
32189
32453
  setApiKeyId("");
@@ -32195,15 +32459,15 @@ var ConnectKalshiModal = ({
32195
32459
  },
32196
32460
  [onOpenChange]
32197
32461
  );
32198
- 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)(
32199
32463
  Modal.Container,
32200
32464
  {
32201
32465
  maxWidth: "600px",
32202
32466
  "aria-label": labels.onboarding.connectKalshiModal.ariaLabel,
32203
32467
  classNames: { container: "!rounded-agg-lg" },
32204
32468
  children: [
32205
- /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(Dialog5.Title, { className: "sr-only", children: labels.onboarding.connectKalshiModal.title }),
32206
- /* @__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)(
32207
32471
  Modal.Header,
32208
32472
  {
32209
32473
  hideClose: false,
@@ -32214,8 +32478,8 @@ var ConnectKalshiModal = ({
32214
32478
  }
32215
32479
  }
32216
32480
  ),
32217
- /* @__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: [
32218
- /* @__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)(
32219
32483
  VenueLogo,
32220
32484
  {
32221
32485
  venue: import_sdk23.Venue.kalshi,
@@ -32224,54 +32488,54 @@ var ConnectKalshiModal = ({
32224
32488
  className: "h-[60px] w-[60px]"
32225
32489
  }
32226
32490
  ),
32227
- /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "flex flex-col gap-4 items-center text-center", children: [
32228
- /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("h2", { className: "text-agg-2xl font-agg-bold text-agg-foreground", children: labels.onboarding.connectKalshiModal.title }),
32229
- /* @__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 })
32230
32494
  ] }),
32231
- /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "flex flex-col gap-4 w-full", children: [
32232
- /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "flex flex-col gap-3 rounded-agg-lg bg-agg-secondary-hover p-4", children: [
32233
- /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "flex flex-col gap-1", children: [
32234
- /* @__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 }),
32235
- /* @__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 })
32236
32500
  ] }),
32237
- /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "space-y-0 text-agg-sm leading-agg-5 text-agg-foreground", children: [
32238
- /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("p", { children: labels.onboarding.connectKalshiModal.stepOne.instructions.signIn }),
32239
- /* @__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: [
32240
32504
  labels.onboarding.connectKalshiModal.stepOne.instructions.goToProfilePrefix,
32241
32505
  " ",
32242
- /* @__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 }),
32243
32507
  labels.onboarding.connectKalshiModal.stepOne.instructions.goToProfileSeparator,
32244
32508
  " ",
32245
- /* @__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 })
32246
32510
  ] }),
32247
- /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("p", { children: [
32511
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)("p", { children: [
32248
32512
  labels.onboarding.connectKalshiModal.stepOne.instructions.clickCreateKeyPrefix,
32249
32513
  " ",
32250
- /* @__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 }),
32251
32515
  labels.onboarding.connectKalshiModal.stepOne.instructions.clickCreateKeySuffix
32252
32516
  ] }),
32253
- /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("p", { children: [
32517
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)("p", { children: [
32254
32518
  labels.onboarding.connectKalshiModal.stepOne.instructions.selectPermissionsPrefix,
32255
32519
  " ",
32256
- /* @__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 }),
32257
32521
  labels.onboarding.connectKalshiModal.stepOne.instructions.selectPermissionsSuffix
32258
32522
  ] }),
32259
- /* @__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 })
32260
32524
  ] }),
32261
- /* @__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: [
32262
32526
  labels.onboarding.connectKalshiModal.stepOne.footerLineOne,
32263
- /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("br", {}),
32527
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("br", {}),
32264
32528
  labels.onboarding.connectKalshiModal.stepOne.footerLineTwo
32265
32529
  ] })
32266
32530
  ] }),
32267
- /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "flex flex-col gap-3 rounded-agg-lg bg-agg-secondary-hover p-4", children: [
32268
- /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "flex flex-col gap-1", children: [
32269
- /* @__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 }),
32270
- /* @__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 })
32271
32535
  ] }),
32272
- /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: labels.onboarding.connectKalshiModal.stepTwo.description }),
32273
- /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "flex flex-col gap-2", children: [
32274
- /* @__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)(
32275
32539
  "label",
32276
32540
  {
32277
32541
  htmlFor: "kalshi-api-key-id",
@@ -32279,7 +32543,7 @@ var ConnectKalshiModal = ({
32279
32543
  children: labels.onboarding.connectKalshiModal.stepTwo.apiKeyIdLabel
32280
32544
  }
32281
32545
  ),
32282
- /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
32546
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(
32283
32547
  "input",
32284
32548
  {
32285
32549
  id: "kalshi-api-key-id",
@@ -32299,8 +32563,8 @@ var ConnectKalshiModal = ({
32299
32563
  }
32300
32564
  )
32301
32565
  ] }),
32302
- /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "flex flex-col gap-2", children: [
32303
- /* @__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)(
32304
32568
  "label",
32305
32569
  {
32306
32570
  htmlFor: "kalshi-private-key",
@@ -32308,7 +32572,7 @@ var ConnectKalshiModal = ({
32308
32572
  children: labels.onboarding.connectKalshiModal.stepTwo.privateKeyLabel
32309
32573
  }
32310
32574
  ),
32311
- /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
32575
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(
32312
32576
  "textarea",
32313
32577
  {
32314
32578
  id: "kalshi-private-key",
@@ -32330,42 +32594,42 @@ var ConnectKalshiModal = ({
32330
32594
  ] })
32331
32595
  ] })
32332
32596
  ] }),
32333
- /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "flex items-center justify-between w-full", children: [
32334
- /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("p", { className: "text-agg-base text-agg-foreground", children: labels.onboarding.connectKalshiModal.help.label }),
32335
- /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "flex items-center gap-3", children: [
32336
- /* @__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)(
32337
32601
  "a",
32338
32602
  {
32339
32603
  href: "#",
32340
32604
  className: "flex items-center gap-2 text-agg-base font-agg-bold text-agg-primary hover:text-agg-primary-hover",
32341
32605
  children: [
32342
- /* @__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" }),
32343
32607
  labels.onboarding.connectKalshiModal.help.docsLinkLabel
32344
32608
  ]
32345
32609
  }
32346
32610
  ),
32347
- /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("span", { className: "h-3 w-px bg-agg-separator" }),
32348
- /* @__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)(
32349
32613
  "a",
32350
32614
  {
32351
32615
  href: "#",
32352
32616
  className: "flex items-center gap-2 text-agg-base font-agg-bold text-agg-primary hover:text-agg-primary-hover",
32353
32617
  children: [
32354
- /* @__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" }),
32355
32619
  labels.onboarding.connectKalshiModal.help.tutorialLinkLabel
32356
32620
  ]
32357
32621
  }
32358
32622
  )
32359
32623
  ] })
32360
32624
  ] }),
32361
- /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "flex flex-col gap-5 items-center", children: [
32362
- error ? /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "flex items-center gap-2", children: [
32363
- /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(WarningIcon, { className: "h-3.5 w-3.5 shrink-0 text-agg-error" }),
32364
- /* @__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 })
32365
32629
  ] }) : null,
32366
- /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "flex items-center gap-3 justify-center", children: [
32367
- /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(Button, { variant: "secondary", size: "large", onClick: handleCancel, children: labels.onboarding.connectKalshiModal.actions.cancel }),
32368
- /* @__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)(
32369
32633
  Button,
32370
32634
  {
32371
32635
  variant: "primary",
@@ -32385,114 +32649,6 @@ var ConnectKalshiModal = ({
32385
32649
  };
32386
32650
  ConnectKalshiModal.displayName = "ConnectKalshiModal";
32387
32651
 
32388
- // src/onboarding/steps/connect-onchain-modal.tsx
32389
- var import_react55 = require("react");
32390
- var import_hooks90 = require("@agg-build/hooks");
32391
- var Dialog6 = __toESM(require("@radix-ui/react-dialog"));
32392
- var import_jsx_runtime192 = require("react/jsx-runtime");
32393
- var ConnectOnchainModal = ({
32394
- open,
32395
- onOpenChange,
32396
- onConnect
32397
- }) => {
32398
- const labels = (0, import_hooks90.useLabels)();
32399
- const [connecting, setConnecting] = (0, import_react55.useState)(false);
32400
- const [error, setError] = (0, import_react55.useState)();
32401
- const handleCancel = (0, import_react55.useCallback)(() => {
32402
- onOpenChange(false);
32403
- }, [onOpenChange]);
32404
- const handleConnect = (0, import_react55.useCallback)(() => __async(null, null, function* () {
32405
- if (connecting) return;
32406
- setConnecting(true);
32407
- setError(void 0);
32408
- try {
32409
- yield onConnect();
32410
- onOpenChange(false);
32411
- } catch (err) {
32412
- setError(
32413
- err instanceof Error ? err.message : labels.onboarding.connectOnchainModal.fallbackError
32414
- );
32415
- } finally {
32416
- setConnecting(false);
32417
- }
32418
- }), [connecting, labels.onboarding.connectOnchainModal.fallbackError, onConnect, onOpenChange]);
32419
- const handleOpenChange = (0, import_react55.useCallback)(
32420
- (value) => {
32421
- if (value) {
32422
- setError(void 0);
32423
- setConnecting(false);
32424
- }
32425
- onOpenChange(value);
32426
- },
32427
- [onOpenChange]
32428
- );
32429
- return /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)(
32430
- Modal.Container,
32431
- {
32432
- maxWidth: "600px",
32433
- "aria-label": labels.onboarding.connectOnchainModal.ariaLabel,
32434
- classNames: { container: "!rounded-agg-lg" },
32435
- children: [
32436
- /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(Dialog6.Title, { className: "sr-only", children: labels.onboarding.connectOnchainModal.title }),
32437
- /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(
32438
- Modal.Header,
32439
- {
32440
- hideClose: false,
32441
- hideBorder: true,
32442
- classNames: {
32443
- root: "!min-h-0",
32444
- container: "!py-[18px] !px-8"
32445
- }
32446
- }
32447
- ),
32448
- /* @__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: [
32449
- /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)("div", { className: "flex flex-col gap-4 items-center text-center", children: [
32450
- /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("h2", { className: "text-agg-2xl font-agg-bold text-agg-foreground", children: labels.onboarding.connectOnchainModal.title }),
32451
- /* @__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 })
32452
- ] }),
32453
- /* @__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: [
32454
- /* @__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 }),
32455
- /* @__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: [
32456
- index > 0 && /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("span", { className: "mr-2.5 h-3 w-px bg-agg-separator" }),
32457
- /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(VenueLogo, { venue, size: "medium" }),
32458
- /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("span", { className: "text-agg-base text-agg-foreground", children: labels.venues[venue] })
32459
- ] }, venue)) })
32460
- ] }),
32461
- /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)("div", { className: "flex flex-col gap-6 items-center", children: [
32462
- /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)("div", { className: "flex flex-col gap-3 items-center", children: [
32463
- error ? /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)("div", { className: "flex items-center gap-2", children: [
32464
- /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(WarningIcon, { className: "h-3.5 w-3.5 shrink-0 text-agg-error" }),
32465
- /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-error", children: error })
32466
- ] }) : null,
32467
- /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(
32468
- Button,
32469
- {
32470
- variant: "primary",
32471
- size: "large",
32472
- onClick: handleConnect,
32473
- isLoading: connecting,
32474
- children: labels.onboarding.connectOnchainModal.connect
32475
- }
32476
- )
32477
- ] }),
32478
- /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(
32479
- Button,
32480
- {
32481
- variant: "tertiary",
32482
- size: "medium",
32483
- className: "!h-auto !px-0 !py-0 text-agg-primary hover:bg-transparent hover:text-agg-primary-hover",
32484
- onClick: handleCancel,
32485
- children: labels.onboarding.connectOnchainModal.cancel
32486
- }
32487
- )
32488
- ] })
32489
- ] }) })
32490
- ]
32491
- }
32492
- ) });
32493
- };
32494
- ConnectOnchainModal.displayName = "ConnectOnchainModal";
32495
-
32496
32652
  // src/onboarding/index.tsx
32497
32653
  var import_jsx_runtime193 = require("react/jsx-runtime");
32498
32654
  var OnboardingModal = ({
@@ -32500,11 +32656,9 @@ var OnboardingModal = ({
32500
32656
  onOpenChange,
32501
32657
  onProfileSubmit,
32502
32658
  onConnectOnchain,
32503
- onConnectKalshi,
32504
32659
  onComplete,
32505
32660
  howItWorksIcons,
32506
- connectedOnchain = false,
32507
- connectedKalshi = false
32661
+ connectedOnchain = false
32508
32662
  }) => {
32509
32663
  var _a;
32510
32664
  const labels = (0, import_hooks91.useLabels)();
@@ -32515,14 +32669,11 @@ var OnboardingModal = ({
32515
32669
  [ONBOARDING_STEPS.CONNECT_ACCOUNTS]: labels.onboarding.modal.stepConnectAccounts
32516
32670
  };
32517
32671
  const resolvedTitle = (_a = stepLabels[step]) != null ? _a : labels.onboarding.modal.title;
32518
- const [kalshiModalOpen, setKalshiModalOpen] = (0, import_react56.useState)(false);
32519
- const [kalshiConnected, setKalshiConnected] = (0, import_react56.useState)(false);
32520
32672
  const [onchainModalOpen, setOnchainModalOpen] = (0, import_react56.useState)(false);
32521
32673
  const [onchainConnected, setOnchainConnected] = (0, import_react56.useState)(false);
32522
32674
  (0, import_react56.useEffect)(() => {
32523
32675
  if (open) {
32524
32676
  setStep(ONBOARDING_STEPS.HOW_IT_WORKS);
32525
- setKalshiConnected(false);
32526
32677
  setOnchainConnected(false);
32527
32678
  }
32528
32679
  }, [open]);
@@ -32546,16 +32697,6 @@ var OnboardingModal = ({
32546
32697
  yield onConnectOnchain == null ? void 0 : onConnectOnchain();
32547
32698
  setOnchainConnected(true);
32548
32699
  }), [onConnectOnchain]);
32549
- const handleOpenKalshiModal = (0, import_react56.useCallback)(() => {
32550
- setKalshiModalOpen(true);
32551
- }, []);
32552
- const handleKalshiVerify = (0, import_react56.useCallback)(
32553
- (credentials) => __async(null, null, function* () {
32554
- yield onConnectKalshi == null ? void 0 : onConnectKalshi(credentials);
32555
- setKalshiConnected(true);
32556
- }),
32557
- [onConnectKalshi]
32558
- );
32559
32700
  return /* @__PURE__ */ (0, import_jsx_runtime193.jsxs)(import_jsx_runtime193.Fragment, { children: [
32560
32701
  /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(Modal, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime193.jsxs)(
32561
32702
  Modal.Container,
@@ -32572,10 +32713,8 @@ var OnboardingModal = ({
32572
32713
  ConnectAccountsStep,
32573
32714
  {
32574
32715
  onConnectOnchain: handleOpenOnchainModal,
32575
- onConnectKalshi: handleOpenKalshiModal,
32576
32716
  onContinue: handleConnectContinue,
32577
- connectedOnchain: connectedOnchain || onchainConnected,
32578
- connectedKalshi: connectedKalshi || kalshiConnected
32717
+ connectedOnchain: connectedOnchain || onchainConnected
32579
32718
  }
32580
32719
  )
32581
32720
  ] })
@@ -32589,14 +32728,6 @@ var OnboardingModal = ({
32589
32728
  onOpenChange: setOnchainModalOpen,
32590
32729
  onConnect: handleOnchainConnect
32591
32730
  }
32592
- ),
32593
- /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
32594
- ConnectKalshiModal,
32595
- {
32596
- open: kalshiModalOpen,
32597
- onOpenChange: setKalshiModalOpen,
32598
- onVerify: handleKalshiVerify
32599
- }
32600
32731
  )
32601
32732
  ] });
32602
32733
  };
@@ -33055,7 +33186,7 @@ var ProfileModal = ({
33055
33186
  }) => {
33056
33187
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
33057
33188
  const client = (0, import_hooks94.useAggClient)();
33058
- const { user, startAuth } = (0, import_hooks94.useAggAuthState)();
33189
+ const { user } = (0, import_hooks94.useAggAuthState)();
33059
33190
  const toastCtx = useOptionalToast();
33060
33191
  const [activeTab, setActiveTab] = (0, import_react59.useState)(PROFILE_TAB_KEYS.PROFILE_ACCOUNTS);
33061
33192
  const resolvedInitialUsername = (_a = username != null ? username : user == null ? void 0 : user.username) != null ? _a : "";
@@ -33206,71 +33337,114 @@ var ProfileModal = ({
33206
33337
  if (typeof window === "undefined") return;
33207
33338
  ((_a2 = window.top) != null ? _a2 : window).location.assign(url);
33208
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
+ );
33209
33351
  const handleConnectTwitter = (0, import_react59.useCallback)(() => __async(null, null, function* () {
33210
- const result = yield startAuth({
33211
- provider: "twitter",
33212
- redirectUrl: resolveRedirectUrl()
33213
- });
33214
- onConnectTwitter == null ? void 0 : onConnectTwitter();
33215
- if (result.type === "redirect") {
33216
- 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)");
33217
33363
  }
33218
- }), [onConnectTwitter, startAuth]);
33364
+ }), [client, onConnectTwitter, surfaceError]);
33219
33365
  const handleConnectGoogle = (0, import_react59.useCallback)(() => __async(null, null, function* () {
33220
- const result = yield startAuth({
33221
- provider: "google",
33222
- redirectUrl: resolveRedirectUrl()
33223
- });
33224
- onConnectGoogle == null ? void 0 : onConnectGoogle();
33225
- if (result.type === "redirect") {
33226
- 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");
33227
33377
  }
33228
- }), [onConnectGoogle, startAuth]);
33378
+ }), [client, onConnectGoogle, surfaceError]);
33229
33379
  const handleConnectApple = (0, import_react59.useCallback)(() => __async(null, null, function* () {
33230
- const result = yield startAuth({
33231
- provider: "apple",
33232
- redirectUrl: resolveRedirectUrl()
33233
- });
33234
- onConnectApple == null ? void 0 : onConnectApple();
33235
- if (result.type === "redirect") {
33236
- 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");
33237
33391
  }
33238
- }), [onConnectApple, startAuth]);
33392
+ }), [client, onConnectApple, surfaceError]);
33239
33393
  const handleDisconnectTwitter = (0, import_react59.useCallback)(() => __async(null, null, function* () {
33240
- yield client.disconnectAccount("twitter");
33241
- yield client.getCurrentUser();
33242
- onDisconnectTwitter == null ? void 0 : onDisconnectTwitter();
33243
- }), [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]);
33244
33402
  const handleDisconnectGoogle = (0, import_react59.useCallback)(() => __async(null, null, function* () {
33245
- yield client.disconnectAccount("google");
33246
- yield client.getCurrentUser();
33247
- onDisconnectGoogle == null ? void 0 : onDisconnectGoogle();
33248
- }), [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]);
33249
33411
  const handleDisconnectApple = (0, import_react59.useCallback)(() => __async(null, null, function* () {
33250
- yield client.disconnectAccount("apple");
33251
- yield client.getCurrentUser();
33252
- onDisconnectApple == null ? void 0 : onDisconnectApple();
33253
- }), [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]);
33254
33420
  const handleConnectEmail = (0, import_react59.useCallback)(() => __async(null, null, function* () {
33255
33421
  var _a2;
33256
33422
  const typedEmail = typeof window !== "undefined" ? (_a2 = window.prompt("Enter your email to receive a magic link")) == null ? void 0 : _a2.trim() : void 0;
33257
33423
  if (!typedEmail) return;
33258
- yield startAuth({
33259
- provider: "email",
33260
- email: typedEmail,
33261
- redirectUrl: resolveRedirectUrl()
33262
- });
33263
- onConnectEmail == null ? void 0 : onConnectEmail();
33264
- }), [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]);
33265
33435
  const handleDisconnectWallet = (0, import_react59.useCallback)(
33266
33436
  (wallet) => __async(null, null, function* () {
33267
33437
  const normalizedChain = wallet.chain.toLowerCase();
33268
33438
  const provider = normalizedChain === "solana" || normalizedChain === "svm" ? "solana_wallet" : "wallet";
33269
- yield client.disconnectAccount(provider);
33270
- yield client.getCurrentUser();
33271
- 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
+ }
33272
33446
  }),
33273
- [client, onDisconnectWallet]
33447
+ [client, onDisconnectWallet, surfaceError]
33274
33448
  );
33275
33449
  const providerActionMap = (0, import_react59.useMemo)(
33276
33450
  () => ({