@agg-build/ui 2.7.2 → 2.8.0

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 (42) hide show
  1. package/dist/{chunk-7R2SMMAG.mjs → chunk-2QCNDFNC.mjs} +193 -103
  2. package/dist/{chunk-EDQ64EKO.mjs → chunk-AKLGQ6AB.mjs} +254 -53
  3. package/dist/{chunk-FMYYPNZZ.mjs → chunk-KO6VTRV6.mjs} +101 -27
  4. package/dist/{chunk-AHQA3B7D.mjs → chunk-KX3TQ7WC.mjs} +1 -1
  5. package/dist/{chunk-EKUH3265.mjs → chunk-MKU5Q6PN.mjs} +51 -13
  6. package/dist/{chunk-O27JUYCF.mjs → chunk-R5S2QOYL.mjs} +495 -289
  7. package/dist/{chunk-JQKJDSTW.mjs → chunk-VR5ZRDQT.mjs} +3 -2
  8. package/dist/events.js +198 -91
  9. package/dist/events.mjs +3 -3
  10. package/dist/index.js +1350 -751
  11. package/dist/index.mjs +7 -7
  12. package/dist/modals.js +941 -418
  13. package/dist/modals.mjs +3 -3
  14. package/dist/pages.js +1008 -609
  15. package/dist/pages.mjs +6 -6
  16. package/dist/primitives.js +94 -26
  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 +1403 -902
  21. package/dist/trading.mjs +4 -4
  22. package/dist/types/events/orderbook/orderbook.utils.d.mts +1 -1
  23. package/dist/types/events/orderbook/orderbook.utils.d.ts +1 -1
  24. package/dist/types/pages/user-profile/components/open-order-row.d.mts +1 -0
  25. package/dist/types/pages/user-profile/components/open-order-row.d.ts +1 -0
  26. package/dist/types/pages/user-profile/position-view-model.d.mts +15 -4
  27. package/dist/types/pages/user-profile/position-view-model.d.ts +15 -4
  28. package/dist/types/primitives/select/index.d.mts +1 -1
  29. package/dist/types/primitives/select/index.d.ts +1 -1
  30. package/dist/types/primitives/select/select.types.d.mts +8 -0
  31. package/dist/types/primitives/select/select.types.d.ts +8 -0
  32. package/dist/types/profile/profile-modal.constants.d.mts +2 -1
  33. package/dist/types/profile/profile-modal.constants.d.ts +2 -1
  34. package/dist/types/profile/tabs/balance-management-tab.d.mts +3 -0
  35. package/dist/types/profile/tabs/balance-management-tab.d.ts +3 -0
  36. package/dist/types/trading/place-order/index.place-order.constants.d.mts +2 -1
  37. package/dist/types/trading/place-order/index.place-order.constants.d.ts +2 -1
  38. package/dist/types/trading/place-order/index.place-order.types.d.mts +6 -0
  39. package/dist/types/trading/place-order/index.place-order.types.d.ts +6 -0
  40. package/dist/types/trading/place-order/index.place-order.utils.d.mts +10 -2
  41. package/dist/types/trading/place-order/index.place-order.utils.d.ts +10 -2
  42. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -8776,7 +8776,11 @@ var Select = ({
8776
8776
  triggerClassName,
8777
8777
  contentClassName,
8778
8778
  itemClassName,
8779
- disabled = SELECT_DEFAULT_IS_DISABLED
8779
+ disabled = SELECT_DEFAULT_IS_DISABLED,
8780
+ variant = "default",
8781
+ openOnHover = false,
8782
+ contentAlign = "start",
8783
+ contentSideOffset = 8
8780
8784
  }) => {
8781
8785
  var _a;
8782
8786
  const labels = (0, import_hooks32.useLabels)();
@@ -8787,17 +8791,30 @@ var Select = ({
8787
8791
  const isDisabled = resolveIsSelectDisabled({ disabled, items });
8788
8792
  const selectedItem = resolveSelectedItem(items, value);
8789
8793
  const [isOpen, setIsOpen] = (0, import_react11.useState)(false);
8790
- const [menuRect, setMenuRect] = (0, import_react11.useState)(
8791
- null
8792
- );
8794
+ const [menuRect, setMenuRect] = (0, import_react11.useState)(null);
8793
8795
  const containerRef = (0, import_react11.useRef)(null);
8794
8796
  const portalRef = (0, import_react11.useRef)(null);
8795
- const handleClose = (0, import_react11.useCallback)(() => setIsOpen(false), []);
8797
+ const closeTimerRef = (0, import_react11.useRef)(null);
8798
+ const openedByHoverRef = (0, import_react11.useRef)(false);
8799
+ const handleClose = (0, import_react11.useCallback)(() => {
8800
+ setIsOpen(false);
8801
+ openedByHoverRef.current = false;
8802
+ }, []);
8796
8803
  const updateMenuRect = (0, import_react11.useCallback)(() => {
8797
8804
  const el = containerRef.current;
8798
8805
  if (!el) return;
8799
8806
  const r = el.getBoundingClientRect();
8800
- setMenuRect({ top: r.bottom + 8, left: r.left, width: r.width });
8807
+ setMenuRect({
8808
+ top: r.bottom + contentSideOffset,
8809
+ left: r.left,
8810
+ right: r.right,
8811
+ width: r.width
8812
+ });
8813
+ }, [contentSideOffset]);
8814
+ (0, import_react11.useEffect)(() => {
8815
+ return () => {
8816
+ if (closeTimerRef.current) clearTimeout(closeTimerRef.current);
8817
+ };
8801
8818
  }, []);
8802
8819
  (0, import_react11.useLayoutEffect)(() => {
8803
8820
  if (!isOpen) {
@@ -8835,7 +8852,33 @@ var Select = ({
8835
8852
  document.addEventListener("keydown", handleKeyDown);
8836
8853
  return () => document.removeEventListener("keydown", handleKeyDown);
8837
8854
  }, [isOpen, handleClose]);
8838
- const triggerRadiusClass = triggerClassName != null ? triggerClassName : "rounded-agg-md";
8855
+ const handlePointerEnter = (event) => {
8856
+ if (!openOnHover || isDisabled || event.pointerType === "touch") return;
8857
+ if (closeTimerRef.current) {
8858
+ clearTimeout(closeTimerRef.current);
8859
+ closeTimerRef.current = null;
8860
+ }
8861
+ if (isOpen) return;
8862
+ openedByHoverRef.current = true;
8863
+ setIsOpen(true);
8864
+ };
8865
+ const handlePointerLeave = (event) => {
8866
+ if (!openOnHover || event.pointerType === "touch") return;
8867
+ if (closeTimerRef.current) clearTimeout(closeTimerRef.current);
8868
+ closeTimerRef.current = setTimeout(() => {
8869
+ handleClose();
8870
+ closeTimerRef.current = null;
8871
+ }, 120);
8872
+ };
8873
+ const handleTriggerClick = () => {
8874
+ if (openedByHoverRef.current && isOpen) {
8875
+ openedByHoverRef.current = false;
8876
+ return;
8877
+ }
8878
+ setIsOpen((previousValue) => !previousValue);
8879
+ };
8880
+ const isInline = variant === "inline";
8881
+ const triggerRadiusClass = triggerClassName != null ? triggerClassName : isInline ? "rounded-agg-sm" : "rounded-agg-md";
8839
8882
  const listbox = menuRect ? /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
8840
8883
  "div",
8841
8884
  {
@@ -8846,16 +8889,20 @@ var Select = ({
8846
8889
  style: {
8847
8890
  position: "fixed",
8848
8891
  top: menuRect.top,
8849
- left: menuRect.left,
8892
+ left: contentAlign === "start" ? menuRect.left : void 0,
8893
+ right: contentAlign === "end" ? window.innerWidth - menuRect.right : void 0,
8850
8894
  width: menuRect.width,
8851
8895
  zIndex: SELECT_DROPDOWN_Z
8852
8896
  },
8853
8897
  className: cn(
8854
8898
  AGG_ROOT_CLASS_NAME,
8855
8899
  rootClassName,
8856
- "agg-select-content pointer-events-auto max-h-[min(20rem,calc(100vh-4rem))] overflow-y-auto rounded-[12px] border border-agg-separator bg-agg-secondary p-2 shadow-[0_8px_16px_rgba(0,0,0,0.1)] flex flex-col gap-1",
8900
+ "agg-select-content pointer-events-auto max-h-[min(20rem,calc(100vh-4rem))] overflow-y-auto border border-agg-separator bg-agg-secondary flex flex-col",
8901
+ isInline ? "min-w-[120px] gap-0 rounded-agg-lg py-1 shadow-[0_8px_16px_rgba(0,0,0,0.12)]" : "gap-1 rounded-[12px] p-2 shadow-[0_8px_16px_rgba(0,0,0,0.1)]",
8857
8902
  contentClassName
8858
8903
  ),
8904
+ onPointerEnter: handlePointerEnter,
8905
+ onPointerLeave: handlePointerLeave,
8859
8906
  children: items.map((item) => {
8860
8907
  const isSelected = item.value === value;
8861
8908
  const isHidden = item.hidden === true;
@@ -8869,9 +8916,10 @@ var Select = ({
8869
8916
  disabled: item.disabled,
8870
8917
  className: cn(
8871
8918
  "agg-select-item",
8872
- "relative flex w-full items-center gap-3 rounded-[6px] pl-3 pr-5 py-3 text-left text-agg-sm leading-agg-5 outline-none",
8919
+ "relative flex w-full items-center text-left text-agg-sm leading-agg-5 outline-none",
8920
+ isInline ? "gap-2 px-4 py-2" : "gap-3 rounded-[6px] py-3 pl-3 pr-5",
8873
8921
  "hover:bg-agg-secondary-hover focus-visible:bg-agg-secondary-hover",
8874
- isSelected ? "bg-agg-primary/10 font-agg-normal text-agg-primary" : "font-agg-normal text-agg-foreground",
8922
+ isSelected ? isInline ? "font-agg-bold text-agg-foreground" : "bg-agg-primary/10 font-agg-normal text-agg-primary" : "font-agg-normal text-agg-foreground",
8875
8923
  item.disabled && "cursor-not-allowed opacity-60",
8876
8924
  itemClassName
8877
8925
  ),
@@ -8883,6 +8931,13 @@ var Select = ({
8883
8931
  handleClose();
8884
8932
  },
8885
8933
  children: [
8934
+ isInline && isSelected ? /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
8935
+ "span",
8936
+ {
8937
+ className: "agg-select-item-indicator absolute bottom-2 left-0 top-2 w-1 bg-agg-primary",
8938
+ "aria-hidden": true
8939
+ }
8940
+ ) : null,
8886
8941
  item.icon ? /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
8887
8942
  "span",
8888
8943
  {
@@ -8912,7 +8967,11 @@ var Select = ({
8912
8967
  "div",
8913
8968
  {
8914
8969
  ref: containerRef,
8915
- className: cn("group/agg-select", "relative inline-flex w-full", className),
8970
+ className: cn(
8971
+ "group/agg-select relative inline-flex",
8972
+ isInline ? "w-auto" : "w-full",
8973
+ className
8974
+ ),
8916
8975
  children: [
8917
8976
  /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)(
8918
8977
  "button",
@@ -8924,19 +8983,19 @@ var Select = ({
8924
8983
  disabled: isDisabled,
8925
8984
  className: cn(
8926
8985
  "agg-select-trigger",
8927
- "flex h-10 w-full items-center gap-2 rounded-[8px] border border-agg-separator bg-agg-secondary px-3 py-[9px] pr-10 font-agg-sans text-agg-sm leading-agg-5 text-agg-foreground outline-none",
8928
- "flex items-center gap-2 text-left",
8986
+ "flex cursor-pointer items-center gap-2 font-agg-sans text-agg-foreground outline-none disabled:cursor-not-allowed disabled:opacity-60",
8987
+ isInline ? "h-auto w-auto bg-transparent px-2 py-1 pr-8 text-left text-agg-base leading-agg-6" : "h-10 w-full border border-agg-separator bg-agg-secondary px-3 py-[9px] pr-10 text-left text-agg-sm leading-agg-5",
8929
8988
  triggerRadiusClass,
8930
- getMotionClassName(
8989
+ !isInline && getMotionClassName(
8931
8990
  enableAnimations,
8932
8991
  "transition-[border-color,box-shadow] duration-200 ease-in-out"
8933
8992
  ),
8934
- isOpen && "border-2 border-agg-primary px-[11px] py-2 ring-0",
8935
- "hover:border-agg-primary",
8936
- "focus:border-agg-primary focus:ring-0",
8937
- "disabled:cursor-not-allowed disabled:opacity-60"
8993
+ !isInline && isOpen && "border-2 border-agg-primary px-[11px] py-2 ring-0",
8994
+ !isInline && "hover:border-agg-primary focus:border-agg-primary focus:ring-0"
8938
8995
  ),
8939
- onClick: () => setIsOpen((previousValue) => !previousValue),
8996
+ onClick: handleTriggerClick,
8997
+ onPointerEnter: handlePointerEnter,
8998
+ onPointerLeave: handlePointerLeave,
8940
8999
  children: [
8941
9000
  (selectedItem == null ? void 0 : selectedItem.icon) ? /* @__PURE__ */ (0, import_jsx_runtime129.jsx)("span", { className: "h-4 w-4 shrink-0 [&_svg]:h-full [&_svg]:w-full", children: selectedItem.icon }) : (selectedItem == null ? void 0 : selectedItem.iconUrl) ? /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
8942
9001
  RemoteImage,
@@ -8950,14 +9009,23 @@ var Select = ({
8950
9009
  ]
8951
9010
  }
8952
9011
  ),
8953
- /* @__PURE__ */ (0, import_jsx_runtime129.jsx)("span", { className: "agg-select-chevron pointer-events-none absolute inset-y-0 right-3 inline-flex items-center justify-center text-agg-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
8954
- Icon,
9012
+ /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
9013
+ "span",
8955
9014
  {
8956
- name: isOpen ? "chevron-up" : "chevron-down-thin",
8957
- size: "small",
8958
- color: "currentColor"
9015
+ className: cn(
9016
+ "agg-select-chevron pointer-events-none absolute inset-y-0 inline-flex items-center justify-center",
9017
+ isInline ? "right-2 text-agg-foreground" : "right-3 text-agg-muted-foreground"
9018
+ ),
9019
+ children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
9020
+ Icon,
9021
+ {
9022
+ name: isOpen ? "chevron-up" : "chevron-down-thin",
9023
+ size: "small",
9024
+ color: "currentColor"
9025
+ }
9026
+ )
8959
9027
  }
8960
- ) }),
9028
+ ),
8961
9029
  isOpen && typeof document !== "undefined" && listbox ? (0, import_react_dom.createPortal)(listbox, resolveSelectPortalContainer(containerRef.current)) : null
8962
9030
  ]
8963
9031
  }
@@ -12698,8 +12766,9 @@ var isOrderBookRow = (v) => (0, import_sdk13.hasShape)(v, {
12698
12766
  total: (t) => typeof t === "number" && t >= 0,
12699
12767
  tone: (x) => x === "positive" || x === "negative"
12700
12768
  });
12701
- var formatProbabilityCents = (value) => {
12769
+ var formatProbabilityCents = (value, formatPrice) => {
12702
12770
  if (value == null) return "-";
12771
+ if (formatPrice) return formatPrice(value);
12703
12772
  const cents = (value * 100).toFixed(1).replace(/\.0$/, "");
12704
12773
  return `${cents}\xA2`;
12705
12774
  };
@@ -13134,6 +13203,17 @@ var matchesSelectedOutcomeLabel = (outcome, selectedOutcomeLabel) => {
13134
13203
  return normalizedCandidate === normalizedSelectedLabel || toSemanticOutcomeLabel(candidate) === semanticSelectedLabel;
13135
13204
  });
13136
13205
  };
13206
+ var isTeamFramedMarket = (market) => {
13207
+ var _a;
13208
+ const outcomes = (_a = market.venueMarketOutcomes) != null ? _a : [];
13209
+ if (outcomes.length < 2) return false;
13210
+ return outcomes.every(
13211
+ (outcome) => getOutcomeLabelCandidates(outcome).some((candidate) => {
13212
+ const semanticCandidate = toSemanticOutcomeLabel(candidate);
13213
+ return semanticCandidate !== "" && semanticCandidate !== "yes" && semanticCandidate !== "no";
13214
+ })
13215
+ );
13216
+ };
13137
13217
  var isValidLevel = (level) => {
13138
13218
  return level != null && Number.isFinite(level.price) && Number.isFinite(level.size) && level.price >= 0 && level.price <= 1 && level.size > 0;
13139
13219
  };
@@ -13278,6 +13358,7 @@ var collectEligibleVenueOutcomes = ({
13278
13358
  const seenMarketIds = /* @__PURE__ */ new Set();
13279
13359
  const seenOutcomeIds = /* @__PURE__ */ new Set();
13280
13360
  const result = [];
13361
+ let selectedAnchorMarket = null;
13281
13362
  if (selectedOutcomeId) {
13282
13363
  for (const market of venueMarkets) {
13283
13364
  const outcome = market.venueMarketOutcomes.find((o) => o.id === selectedOutcomeId);
@@ -13331,6 +13412,16 @@ var collectEligibleVenueOutcomes = ({
13331
13412
  });
13332
13413
  return result;
13333
13414
  }
13415
+ selectedAnchorMarket = market;
13416
+ seenMarketIds.add(market.id);
13417
+ seenOutcomeIds.add(outcome.id);
13418
+ result.push({
13419
+ venue: market.venue,
13420
+ market,
13421
+ outcome,
13422
+ outcomeId: outcome.id,
13423
+ semanticLabel
13424
+ });
13334
13425
  break;
13335
13426
  }
13336
13427
  }
@@ -13373,10 +13464,18 @@ var collectEligibleVenueOutcomes = ({
13373
13464
  }
13374
13465
  for (const market of venueMarkets) {
13375
13466
  if (seenMarketIds.has(market.id)) continue;
13467
+ if (selectedAnchorMarket && result.some(
13468
+ (entry) => entry.venue === market.venue && entry.market.question.trim() !== market.question.trim()
13469
+ )) {
13470
+ continue;
13471
+ }
13376
13472
  const matchedOutcome = sortOutcomes(market.venueMarketOutcomes).find(
13377
13473
  (outcome) => matchesSelectedOutcomeLabel(outcome, selectedOutcomeLabel)
13378
13474
  );
13379
13475
  if (!matchedOutcome || seenOutcomeIds.has(matchedOutcome.id)) continue;
13476
+ if (selectedAnchorMarket && isTeamFramedMarket(market) !== isTeamFramedMarket(selectedAnchorMarket)) {
13477
+ continue;
13478
+ }
13380
13479
  const candidateRefs = (_c = matchedOutcome.matchedVenueMarketOutcomes) != null ? _c : [];
13381
13480
  if (candidateRefs.length > 0) {
13382
13481
  const sharesAnchor = candidateRefs.some(
@@ -14970,7 +15069,7 @@ var EventListItemDetailsGraphSection = ({
14970
15069
  }, [chartOutcomeLabel, (_d = tradingContext == null ? void 0 : tradingContext.selectedOutcome) == null ? void 0 : _d.label]);
14971
15070
  const {
14972
15071
  chart: { selectedChartTimeRange },
14973
- formatting: { formatPercent },
15072
+ formatting: { formatPercent, formatPrice },
14974
15073
  general: { theme }
14975
15074
  } = (0, import_hooks48.useSdkUiConfig)();
14976
15075
  const isDarkTheme = theme === "dark";
@@ -15245,8 +15344,8 @@ var EventListItemDetailsGraphSection = ({
15245
15344
  });
15246
15345
  return {
15247
15346
  value: outcome.id,
15248
- label: `${(_d3 = outcome.title) != null ? _d3 : outcome.label} ${formatProbabilityCents(price)}`,
15249
- ariaLabel: `${(_e2 = outcome.title) != null ? _e2 : outcome.label} ${formatProbabilityCents(price)}`
15347
+ label: `${(_d3 = outcome.title) != null ? _d3 : outcome.label} ${formatProbabilityCents(price, formatPrice)}`,
15348
+ ariaLabel: `${(_e2 = outcome.title) != null ? _e2 : outcome.label} ${formatProbabilityCents(price, formatPrice)}`
15250
15349
  };
15251
15350
  })
15252
15351
  }
@@ -15668,7 +15767,7 @@ var EventListItemDetails = (props) => {
15668
15767
  EventListItemDetails.displayName = "EventListItemDetails";
15669
15768
 
15670
15769
  // src/events/market-details/index.tsx
15671
- var import_hooks51 = require("@agg-build/hooks");
15770
+ var import_hooks52 = require("@agg-build/hooks");
15672
15771
  var import_react28 = require("react");
15673
15772
 
15674
15773
  // src/events/orderbook/index.tsx
@@ -15916,6 +16015,7 @@ var OrderbookRow = ({
15916
16015
  entry,
15917
16016
  formatNumber,
15918
16017
  formatCurrency: formatCurrency2,
16018
+ formatPrice,
15919
16019
  enableAnimations,
15920
16020
  showBadge,
15921
16021
  badgeLabel
@@ -15984,7 +16084,7 @@ var OrderbookRow = ({
15984
16084
  "w-9 min-w-9 md:min-w-10 md:w-10 text-agg-sm font-agg-bold leading-agg-5",
15985
16085
  priceClassName
15986
16086
  ),
15987
- children: formatProbabilityCents(entry.row.price)
16087
+ children: formatProbabilityCents(entry.row.price, formatPrice)
15988
16088
  }
15989
16089
  ),
15990
16090
  /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(OrderbookVenueLogos, { venues })
@@ -16006,7 +16106,10 @@ var Orderbook = ({
16006
16106
  className
16007
16107
  }) => {
16008
16108
  var _a, _b, _c, _d, _e;
16009
- const { enableWebsocketsLogs } = (0, import_hooks49.useAggUiConfig)();
16109
+ const {
16110
+ enableWebsocketsLogs,
16111
+ formatting: { formatPrice }
16112
+ } = (0, import_hooks49.useAggUiConfig)();
16010
16113
  const labels = __spreadValues(__spreadValues({}, orderbookDefaultLabels), labelsProp);
16011
16114
  const scrollContainerRef = (0, import_react26.useRef)(null);
16012
16115
  const spreadRowRef = (0, import_react26.useRef)(null);
@@ -16071,6 +16174,7 @@ var Orderbook = ({
16071
16174
  entry,
16072
16175
  formatNumber,
16073
16176
  formatCurrency: formatCurrency2,
16177
+ formatPrice,
16074
16178
  enableAnimations,
16075
16179
  showBadge: index === askEntries.length - 1,
16076
16180
  badgeLabel: labels.asks
@@ -16083,7 +16187,7 @@ var Orderbook = ({
16083
16187
  ref: spreadRowRef,
16084
16188
  className: "agg-orderbook-spread flex items-center border-y border-agg-separator h-9 px-5 py-2 gap-3 md:gap-10",
16085
16189
  role: "separator",
16086
- "aria-label": `${labels.midPrice}: ${formatProbabilityCents((_b = spreadEntry == null ? void 0 : spreadEntry.midPrice) != null ? _b : null)}, ${labels.spread}: ${formatProbabilityCents((_c = spreadEntry == null ? void 0 : spreadEntry.spread) != null ? _c : null)}`,
16190
+ "aria-label": `${labels.midPrice}: ${formatProbabilityCents((_b = spreadEntry == null ? void 0 : spreadEntry.midPrice) != null ? _b : null, formatPrice)}, ${labels.spread}: ${formatProbabilityCents((_c = spreadEntry == null ? void 0 : spreadEntry.spread) != null ? _c : null)}`,
16087
16191
  children: [
16088
16192
  /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)(
16089
16193
  Typography,
@@ -16093,7 +16197,7 @@ var Orderbook = ({
16093
16197
  children: [
16094
16198
  "Last: ",
16095
16199
  labels.lastOutcome ? `${labels.lastOutcome} ` : "",
16096
- formatProbabilityCents((_d = spreadEntry == null ? void 0 : spreadEntry.midPrice) != null ? _d : null)
16200
+ formatProbabilityCents((_d = spreadEntry == null ? void 0 : spreadEntry.midPrice) != null ? _d : null, formatPrice)
16097
16201
  ]
16098
16202
  }
16099
16203
  ),
@@ -16120,6 +16224,7 @@ var Orderbook = ({
16120
16224
  entry,
16121
16225
  formatNumber,
16122
16226
  formatCurrency: formatCurrency2,
16227
+ formatPrice,
16123
16228
  enableAnimations,
16124
16229
  showBadge: index === 0,
16125
16230
  badgeLabel: labels.bids
@@ -16315,6 +16420,7 @@ var resolveOrderEligibilityMessage = (labels, reason) => {
16315
16420
  };
16316
16421
 
16317
16422
  // src/events/market-details/market-details-outcome-button.tsx
16423
+ var import_hooks50 = require("@agg-build/hooks");
16318
16424
  var import_jsx_runtime149 = require("react/jsx-runtime");
16319
16425
  var marketDetailsOutcomeButtonToneClasses = {
16320
16426
  positive: {
@@ -16365,6 +16471,7 @@ var OutcomePriceContent = ({
16365
16471
  value,
16366
16472
  textClassName
16367
16473
  }) => {
16474
+ const { formatPrice } = (0, import_hooks50.useAggUiConfig)().formatting;
16368
16475
  if (isLoading) {
16369
16476
  return /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
16370
16477
  "span",
@@ -16383,7 +16490,7 @@ var OutcomePriceContent = ({
16383
16490
  as: "span",
16384
16491
  variant: isSelected ? "body-strong" : "body",
16385
16492
  className: cn("shrink-0 whitespace-nowrap", textClassName),
16386
- children: formatProbabilityCents(value)
16493
+ children: formatProbabilityCents(value, formatPrice)
16387
16494
  }
16388
16495
  );
16389
16496
  };
@@ -16477,7 +16584,7 @@ var MarketDetailsOutcomeButton = ({
16477
16584
  MarketDetailsOutcomeButton.displayName = "MarketDetailsOutcomeButton";
16478
16585
 
16479
16586
  // src/events/market-details/market-details-graph-panel.tsx
16480
- var import_hooks50 = require("@agg-build/hooks");
16587
+ var import_hooks51 = require("@agg-build/hooks");
16481
16588
  var import_react27 = require("react");
16482
16589
  var import_jsx_runtime150 = require("react/jsx-runtime");
16483
16590
  var MarketDetailsGraphPanel = ({
@@ -16494,13 +16601,13 @@ var MarketDetailsGraphPanel = ({
16494
16601
  classNames
16495
16602
  }) => {
16496
16603
  var _a, _b, _c;
16497
- const config = (0, import_hooks50.useSdkUiConfig)();
16604
+ const config = (0, import_hooks51.useSdkUiConfig)();
16498
16605
  const {
16499
- formatting: { formatPercent, formatCompactCurrency },
16606
+ formatting: { formatPercent, formatCompactCurrency, formatPrice },
16500
16607
  general: { theme }
16501
16608
  } = config;
16502
16609
  const isDarkTheme = theme === "dark";
16503
- const labels = (0, import_hooks50.useLabels)();
16610
+ const labels = (0, import_hooks51.useLabels)();
16504
16611
  const selectedTimeRange = config.chart.selectedChartTimeRange;
16505
16612
  const setSelectedTimeRange = config.chart.setSelectedChartTimeRange;
16506
16613
  const [chartRangeOverride, setChartRangeOverride] = (0, import_react27.useState)(null);
@@ -16520,7 +16627,7 @@ var MarketDetailsGraphPanel = ({
16520
16627
  livePrices
16521
16628
  });
16522
16629
  }, [livePrices, venueMarkets, resolvedChartOutcomeLabel, chartSelectedOutcomeId]);
16523
- const rollingWindow = (0, import_hooks50.useRollingChartWindow)({ range: effectiveChartTimeRange });
16630
+ const rollingWindow = (0, import_hooks51.useRollingChartWindow)({ range: effectiveChartTimeRange });
16524
16631
  const chartPrimaryOutcomeId = (_b = (_a = chartOutcomesByVenue[0]) == null ? void 0 : _a.outcome.id) != null ? _b : null;
16525
16632
  const chartVenueOutcomeIds = (0, import_react27.useMemo)(() => {
16526
16633
  return chartOutcomesByVenue.map((item) => item.outcome.id);
@@ -16530,7 +16637,7 @@ var MarketDetailsGraphPanel = ({
16530
16637
  isLoading: isMarketChartLoading,
16531
16638
  error: marketChartError,
16532
16639
  refetch: refetchMarketChart
16533
- } = (0, import_hooks50.useMarketChart)({
16640
+ } = (0, import_hooks51.useMarketChart)({
16534
16641
  marketId: chartPrimaryOutcomeId,
16535
16642
  venueMarketIds: chartVenueOutcomeIds,
16536
16643
  interval: rollingWindow.interval,
@@ -16710,8 +16817,8 @@ var MarketDetailsGraphPanel = ({
16710
16817
  const price = outcome.probability;
16711
16818
  return {
16712
16819
  value: outcome.id,
16713
- label: `${(_a3 = outcome == null ? void 0 : outcome.title) != null ? _a3 : outcome.label} ${formatProbabilityCents(price)}`,
16714
- ariaLabel: `${(_b3 = outcome == null ? void 0 : outcome.title) != null ? _b3 : outcome.label} ${formatProbabilityCents(price)}`
16820
+ label: `${(_a3 = outcome == null ? void 0 : outcome.title) != null ? _a3 : outcome.label} ${formatProbabilityCents(price, formatPrice)}`,
16821
+ ariaLabel: `${(_b3 = outcome == null ? void 0 : outcome.title) != null ? _b3 : outcome.label} ${formatProbabilityCents(price, formatPrice)}`
16715
16822
  };
16716
16823
  })
16717
16824
  }
@@ -16740,7 +16847,7 @@ var MarketDetailsGraphPanel = ({
16740
16847
  }
16741
16848
  ),
16742
16849
  /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("span", { "aria-hidden": "true", className: "hidden h-4 w-px bg-agg-separator md:block" }),
16743
- import_hooks50.CHART_TIME_RANGES.map((timeRange) => {
16850
+ import_hooks51.CHART_TIME_RANGES.map((timeRange) => {
16744
16851
  const isActive = effectiveChartTimeRange === timeRange;
16745
16852
  const isDisabled = isResolvedMarket && timeRange !== "ALL";
16746
16853
  return /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(
@@ -16783,7 +16890,7 @@ var MarketDetailsUnavailableState = ({
16783
16890
  ariaLabel,
16784
16891
  classNames
16785
16892
  }) => {
16786
- const labels = (0, import_hooks51.useLabels)();
16893
+ const labels = (0, import_hooks52.useLabels)();
16787
16894
  return /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
16788
16895
  Card,
16789
16896
  {
@@ -16807,7 +16914,7 @@ var MarketDetailsNotFoundState = ({
16807
16914
  ariaLabel: _ariaLabel,
16808
16915
  classNames: _classNames
16809
16916
  }) => {
16810
- const labels = (0, import_hooks51.useLabels)();
16917
+ const labels = (0, import_hooks52.useLabels)();
16811
16918
  return /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
16812
16919
  StateMessage,
16813
16920
  {
@@ -16845,33 +16952,33 @@ var MarketDetailsContent = ({
16845
16952
  midpointsResult
16846
16953
  }) => {
16847
16954
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
16848
- const config = (0, import_hooks51.useSdkUiConfig)();
16955
+ const config = (0, import_hooks52.useSdkUiConfig)();
16849
16956
  const {
16850
16957
  features: { enableAnimations },
16851
16958
  formatting: { formatPercent }
16852
16959
  } = config;
16853
- const labels = (0, import_hooks51.useLabels)();
16854
- const tradingContext = (0, import_hooks51.useEventTradingContext)();
16960
+ const labels = (0, import_hooks52.useLabels)();
16961
+ const tradingContext = (0, import_hooks52.useEventTradingContext)();
16855
16962
  const detailsContentId = (0, import_react28.useId)();
16856
16963
  const tradeSide = (_a = tradingContext == null ? void 0 : tradingContext.tradeSide) != null ? _a : "buy";
16857
16964
  const resolvedMarket = (0, import_react28.useMemo)(() => {
16858
16965
  return resolveMarketFromVenueMarkets(venueMarkets, marketId);
16859
16966
  }, [venueMarkets, marketId]);
16860
16967
  const clusterVenueMarkets = resolvedMarket == null ? void 0 : resolvedMarket.venueMarkets;
16861
- const wsLivePrices = (0, import_hooks51.useLiveOutcomePrices)(clusterVenueMarkets);
16862
- const wsBestPrices = (0, import_hooks51.useLiveBestPrices)(clusterVenueMarkets);
16863
- const wsBestCandidates = (0, import_hooks51.useLiveBestPriceCandidates)(clusterVenueMarkets);
16968
+ const wsLivePrices = (0, import_hooks52.useLiveOutcomePrices)(clusterVenueMarkets);
16969
+ const wsBestPrices = (0, import_hooks52.useLiveBestPrices)(clusterVenueMarkets);
16970
+ const wsBestCandidates = (0, import_hooks52.useLiveBestPriceCandidates)(clusterVenueMarkets);
16864
16971
  const scopedResolvedMarket = (0, import_react28.useMemo)(() => {
16865
16972
  var _a2, _b2;
16866
16973
  if (!resolvedMarket) return null;
16867
16974
  return (_b2 = (_a2 = resolvedMarket.venueMarkets.find((venueMarket) => venueMarket.id === resolvedMarket.id)) != null ? _a2 : resolvedMarket.venueMarkets[0]) != null ? _b2 : null;
16868
16975
  }, [resolvedMarket]);
16869
- const isResolvedMarket = (0, import_hooks51.resolveMarketTradingState)(scopedResolvedMarket).kind === "resolved";
16870
- (0, import_hooks51.useEventOrderbookData)(
16976
+ const isResolvedMarket = (0, import_hooks52.resolveMarketTradingState)(scopedResolvedMarket).kind === "resolved";
16977
+ (0, import_hooks52.useEventOrderbookData)(
16871
16978
  isResolvedMarket ? [] : resolvedMarket == null ? void 0 : resolvedMarket.venueMarkets,
16872
16979
  (_b = scopedResolvedMarket == null ? void 0 : scopedResolvedMarket.id) != null ? _b : null
16873
16980
  );
16874
- const fetchedClusterMidpointResult = (0, import_hooks51.useMidpoints)(midpointsResult ? [] : clusterVenueMarkets);
16981
+ const fetchedClusterMidpointResult = (0, import_hooks52.useMidpoints)(midpointsResult ? [] : clusterVenueMarkets);
16875
16982
  const clusterMidpointResult = midpointsResult != null ? midpointsResult : fetchedClusterMidpointResult;
16876
16983
  const clusterMidpoints = (_c = clusterMidpointResult.bestMidpointsByOutcomeId) != null ? _c : clusterMidpointResult.prices;
16877
16984
  const clusterBestMidpointsByOutcomeId = clusterMidpoints;
@@ -16880,7 +16987,7 @@ var MarketDetailsContent = ({
16880
16987
  const clusterBestMidpointVenue = clusterMidpointResult.bestMidpointVenue;
16881
16988
  const clusterBestPricesRest = clusterMidpointResult.bestPrices;
16882
16989
  const clusterBestPrices = (0, import_react28.useMemo)(
16883
- () => (0, import_hooks51.mergeBestPricesPreferringLive)(clusterBestPricesRest, wsBestPrices),
16990
+ () => (0, import_hooks52.mergeBestPricesPreferringLive)(clusterBestPricesRest, wsBestPrices),
16884
16991
  [clusterBestPricesRest, wsBestPrices]
16885
16992
  );
16886
16993
  const clusterBestPriceVenuesByOutcomeId = clusterMidpointResult.bestPriceVenuesByOutcomeId;
@@ -16935,7 +17042,7 @@ var MarketDetailsContent = ({
16935
17042
  return (_a2 = model.market.venueMarkets.find((venueMarket) => venueMarket.id === model.market.id)) != null ? _a2 : model.primaryVenueMarket;
16936
17043
  }, [model]);
16937
17044
  const marketTradingState = (0, import_react28.useMemo)(() => {
16938
- return (0, import_hooks51.resolveMarketTradingState)(scopedMarketForCard);
17045
+ return (0, import_hooks52.resolveMarketTradingState)(scopedMarketForCard);
16939
17046
  }, [scopedMarketForCard]);
16940
17047
  const isOutcomeSelectionLocked = marketTradingState.isTradingDisabled;
16941
17048
  const isUpcomingMarket = marketTradingState.kind === "unopened";
@@ -17096,7 +17203,7 @@ var MarketDetailsContent = ({
17096
17203
  fallbackPrice: midpointsFallback == null ? void 0 : midpointsFallback.get(displayOutcome.id)
17097
17204
  });
17098
17205
  if (referencePrice != null) return referencePrice;
17099
- return (0, import_hooks51.findLivePriceById)(wsLivePrices, displayOutcome.id);
17206
+ return (0, import_hooks52.findLivePriceById)(wsLivePrices, displayOutcome.id);
17100
17207
  }, [
17101
17208
  clusterBestMidpoint,
17102
17209
  clusterBestMidpointsByOutcomeId,
@@ -17122,7 +17229,7 @@ var MarketDetailsContent = ({
17122
17229
  const orderBookEnabled = isOpened && effectiveSelectedTab === "order-book" && !marketTradingState.isTradingDisabled;
17123
17230
  const primaryVenueMarketId = (_g = (_f = selectedOutcomesByVenue[0]) == null ? void 0 : _f.market.id) != null ? _g : null;
17124
17231
  const primaryOutcomeId = (_i = (_h = selectedOutcomesByVenue[0]) == null ? void 0 : _h.outcome.id) != null ? _i : null;
17125
- const marketOrderbookResult = (0, import_hooks51.useMarketOrderbook)({
17232
+ const marketOrderbookResult = (0, import_hooks52.useMarketOrderbook)({
17126
17233
  marketId: primaryVenueMarketId,
17127
17234
  enabled: orderBookEnabled && !!primaryVenueMarketId,
17128
17235
  venueOutcomes: selectedOutcomesByVenue.map((item) => ({
@@ -17303,7 +17410,7 @@ var MarketDetailsContent = ({
17303
17410
  !compactHeader ? /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
17304
17411
  RemoteImage,
17305
17412
  {
17306
- src: (0, import_hooks51.optimizedImageUrl)(model.image, 60),
17413
+ src: (0, import_hooks52.optimizedImageUrl)(model.image, 60),
17307
17414
  alt: "",
17308
17415
  className: "agg-market-image size-12 rounded-agg-lg object-cover md:size-[60px]"
17309
17416
  }
@@ -17554,7 +17661,7 @@ var MarketDetailsContent = ({
17554
17661
  };
17555
17662
  var MarketDetails = (_a) => {
17556
17663
  var _b = _a, { isOpened } = _b, props = __objRest(_b, ["isOpened"]);
17557
- const labels = (0, import_hooks51.useLabels)();
17664
+ const labels = (0, import_hooks52.useLabels)();
17558
17665
  if (props.isLoading) {
17559
17666
  return /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
17560
17667
  Skeleton,
@@ -17609,13 +17716,13 @@ var resolveIsResolvedEvent = (sourceMarkets, eventTradingState) => {
17609
17716
  return eventTradingState.kind === "resolved";
17610
17717
  }
17611
17718
  if (sourceMarkets.length === 0) return false;
17612
- return sourceMarkets.every((market) => (0, import_hooks51.resolveMarketTradingState)(market).kind === "resolved");
17719
+ return sourceMarkets.every((market) => (0, import_hooks52.resolveMarketTradingState)(market).kind === "resolved");
17613
17720
  };
17614
17721
  var resolveResolvedWinnerMarketId = (sourceMarkets, eventTradingState) => {
17615
17722
  var _a, _b, _c, _d, _e;
17616
17723
  const preferredMarket = (_a = eventTradingState == null ? void 0 : eventTradingState.primaryMarket) != null ? _a : null;
17617
17724
  if (preferredMarket && sourceMarkets.some((market) => market.id === preferredMarket.id)) {
17618
- if ((0, import_hooks51.resolveMarketTradingState)(preferredMarket).kind === "resolved") {
17725
+ if ((0, import_hooks52.resolveMarketTradingState)(preferredMarket).kind === "resolved") {
17619
17726
  return preferredMarket.id;
17620
17727
  }
17621
17728
  }
@@ -17635,8 +17742,8 @@ var MarketDetailsList = ({
17635
17742
  midpointsResult
17636
17743
  }) => {
17637
17744
  var _a, _b;
17638
- const labels = (0, import_hooks51.useLabels)();
17639
- const tradingContext = (0, import_hooks51.useEventTradingContext)();
17745
+ const labels = (0, import_hooks52.useLabels)();
17746
+ const tradingContext = (0, import_hooks52.useEventTradingContext)();
17640
17747
  const selectedMarketId = (_a = tradingContext == null ? void 0 : tradingContext.selectedMarketId) != null ? _a : null;
17641
17748
  const [expandedMarketId, setExpandedMarketId] = (0, import_react28.useState)(null);
17642
17749
  const [areResolvedMarketsVisible, setAreResolvedMarketsVisible] = (0, import_react28.useState)(false);
@@ -17645,10 +17752,10 @@ var MarketDetailsList = ({
17645
17752
  markets: rawMarkets,
17646
17753
  isLoading,
17647
17754
  error
17648
- } = (0, import_hooks51.useVenueMarkets)({
17755
+ } = (0, import_hooks52.useVenueMarkets)({
17649
17756
  venueEventId: resolvedEventId,
17650
17757
  enabled: !providedMarkets && !!resolvedEventId,
17651
- status: import_hooks51.MarketStatus.open,
17758
+ status: import_hooks52.MarketStatus.open,
17652
17759
  // Keep in lockstep with useEnrichedVenueEvent: limit is part of the React
17653
17760
  // Query key, so a mismatch would fork the shared cache into two requests.
17654
17761
  // fetchAll drains every page — events can exceed any single-page limit
@@ -17692,7 +17799,7 @@ var MarketDetailsList = ({
17692
17799
  const resolved = [];
17693
17800
  const closed = [];
17694
17801
  sourceMarkets.forEach((market) => {
17695
- const marketStateKind = (0, import_hooks51.resolveMarketTradingState)(market).kind;
17802
+ const marketStateKind = (0, import_hooks52.resolveMarketTradingState)(market).kind;
17696
17803
  if (marketStateKind === "resolved") {
17697
17804
  resolved.push(market);
17698
17805
  return;
@@ -17720,10 +17827,10 @@ var MarketDetailsList = ({
17720
17827
  const hasPrefetchedMarkets = !!providedMarkets || !!((_b = eventTradingState == null ? void 0 : eventTradingState.marketStates) == null ? void 0 : _b.length);
17721
17828
  const midpointEligibleMarkets = (0, import_react28.useMemo)(() => {
17722
17829
  return displayedMarkets.filter(
17723
- (market) => (0, import_hooks51.resolveMarketTradingState)(market).kind !== "resolved"
17830
+ (market) => (0, import_hooks52.resolveMarketTradingState)(market).kind !== "resolved"
17724
17831
  );
17725
17832
  }, [displayedMarkets]);
17726
- const { prices: midpointsFallback, venueByOutcomeId: midpointsFallbackVenues } = (0, import_hooks51.useViewportMidpoints)(midpointEligibleMarkets);
17833
+ const { prices: midpointsFallback, venueByOutcomeId: midpointsFallbackVenues } = (0, import_hooks52.useViewportMidpoints)(midpointEligibleMarkets);
17727
17834
  (0, import_react28.useEffect)(() => {
17728
17835
  if (isResolvedEvent) {
17729
17836
  setAreResolvedMarketsVisible(false);
@@ -17742,7 +17849,7 @@ var MarketDetailsList = ({
17742
17849
  return;
17743
17850
  }
17744
17851
  const fallbackSelectableMarket = displayedMarkets.find(
17745
- (market) => !(0, import_hooks51.resolveMarketTradingState)(market).isTradingDisabled
17852
+ (market) => !(0, import_hooks52.resolveMarketTradingState)(market).isTradingDisabled
17746
17853
  );
17747
17854
  if (!fallbackSelectableMarket) {
17748
17855
  return;
@@ -17764,7 +17871,7 @@ var MarketDetailsList = ({
17764
17871
  setExpandedMarketId(marketId);
17765
17872
  onExpandedMarketChange == null ? void 0 : onExpandedMarketChange(marketId);
17766
17873
  if (marketId === selectedMarketId) return;
17767
- if ((0, import_hooks51.resolveMarketTradingState)(market).isTradingDisabled) return;
17874
+ if ((0, import_hooks52.resolveMarketTradingState)(market).isTradingDisabled) return;
17768
17875
  tradingContext == null ? void 0 : tradingContext.selectMarket(market.id, market);
17769
17876
  };
17770
17877
  if (!hasPrefetchedMarkets && isLoading) {
@@ -17857,7 +17964,7 @@ var MarketDetailsList = ({
17857
17964
  MarketDetailsList.displayName = "MarketDetailsList";
17858
17965
 
17859
17966
  // src/events/list/index.tsx
17860
- var import_hooks53 = require("@agg-build/hooks");
17967
+ var import_hooks54 = require("@agg-build/hooks");
17861
17968
  var import_sdk17 = require("@agg-build/sdk");
17862
17969
  var Dialog2 = __toESM(require("@radix-ui/react-dialog"));
17863
17970
  var import_react31 = require("react");
@@ -17980,7 +18087,7 @@ var CategorySidebar = ({
17980
18087
  CategorySidebar.displayName = "CategorySidebar";
17981
18088
 
17982
18089
  // src/events/list/event-list-tabs.tsx
17983
- var import_hooks52 = require("@agg-build/hooks");
18090
+ var import_hooks53 = require("@agg-build/hooks");
17984
18091
  var import_sdk16 = require("@agg-build/sdk");
17985
18092
  var import_react30 = require("react");
17986
18093
 
@@ -18068,14 +18175,14 @@ var renderTabIcon = (tab, isActive) => {
18068
18175
  );
18069
18176
  };
18070
18177
  var useEventListTabs = (tabs) => {
18071
- const labels = (0, import_hooks52.useLabels)();
18072
- const { disabledVenues, isLoading: isAppConfigLoading } = (0, import_hooks52.useAppConfig)();
18073
- const { isLocationBlocked } = (0, import_hooks52.useGeoBlock)();
18178
+ const labels = (0, import_hooks53.useLabels)();
18179
+ const { disabledVenues, isLoading: isAppConfigLoading } = (0, import_hooks53.useAppConfig)();
18180
+ const { isLocationBlocked } = (0, import_hooks53.useGeoBlock)();
18074
18181
  return (0, import_react30.useMemo)(() => {
18075
18182
  const baseTabs = tabs != null ? tabs : getDefaultEventListTabs(labels);
18076
18183
  return baseTabs.flatMap((tab) => {
18077
18184
  if (!tab.venueLogo) return [tab];
18078
- const availabilityState = (0, import_hooks52.getVenueAvailabilityState)({
18185
+ const availabilityState = (0, import_hooks53.getVenueAvailabilityState)({
18079
18186
  venueId: tab.venueLogo,
18080
18187
  disabledVenues,
18081
18188
  isConfigLoading: isAppConfigLoading && tab.venueLogo === import_sdk16.Venue.kalshi,
@@ -18260,15 +18367,15 @@ var EventList = ({
18260
18367
  stateRef
18261
18368
  }) => {
18262
18369
  var _a, _b, _c, _d, _e;
18263
- const labels = (0, import_hooks53.useLabels)();
18264
- const { disabledVenues } = (0, import_hooks53.useAppConfig)();
18370
+ const labels = (0, import_hooks54.useLabels)();
18371
+ const { disabledVenues } = (0, import_hooks54.useAppConfig)();
18265
18372
  const {
18266
18373
  features: { enableVenueEventDiscoveryFilters, showSportsMarkets }
18267
- } = (0, import_hooks53.useSdkUiConfig)();
18374
+ } = (0, import_hooks54.useSdkUiConfig)();
18268
18375
  const isDiscoveryFiltersEnabled = enableVenueEventDiscoveryFilters && !search;
18269
18376
  const resolvedTabs = useEventListTabs();
18270
18377
  const visibleVenues = (0, import_react31.useMemo)(
18271
- () => disabledVenues.length === 0 ? void 0 : (0, import_hooks53.getVisibleVenueIdsByConfig)(import_sdk17.VENUES, disabledVenues),
18378
+ () => disabledVenues.length === 0 ? void 0 : (0, import_hooks54.getVisibleVenueIdsByConfig)(import_sdk17.VENUES, disabledVenues),
18272
18379
  [disabledVenues]
18273
18380
  );
18274
18381
  const [activeTabValue, setActiveTabValue] = (0, import_react31.useState)(
@@ -18313,7 +18420,7 @@ var EventList = ({
18313
18420
  setCategoryPath([]);
18314
18421
  setCollapsedCategoryIds(/* @__PURE__ */ new Set());
18315
18422
  }, [baseCategoryId, isDiscoveryFiltersEnabled]);
18316
- const { categories: topLevelCategories } = (0, import_hooks53.useCategories)({
18423
+ const { categories: topLevelCategories } = (0, import_hooks54.useCategories)({
18317
18424
  queryKeyScope: "event-list-top-categories",
18318
18425
  enabled: isDiscoveryFiltersEnabled,
18319
18426
  limit: 100
@@ -18329,7 +18436,7 @@ var EventList = ({
18329
18436
  ])
18330
18437
  );
18331
18438
  }, [categoryPath, sortedTopLevelCategories]);
18332
- const { childrenByParentId: baseChildrenByParentId } = (0, import_hooks53.useCategoryChildren)({
18439
+ const { childrenByParentId: baseChildrenByParentId } = (0, import_hooks54.useCategoryChildren)({
18333
18440
  queryKeyScope: "event-list-category-children",
18334
18441
  enabled: isDiscoveryFiltersEnabled,
18335
18442
  parentIds: baseCategoryChildPrefetchIds,
@@ -18350,7 +18457,7 @@ var EventList = ({
18350
18457
  }
18351
18458
  return Array.from(ids);
18352
18459
  }, [baseCategoryId, baseChildrenByParentId, categoryPath]);
18353
- const { childrenByParentId: visibleChildrenByParentId } = (0, import_hooks53.useCategoryChildren)({
18460
+ const { childrenByParentId: visibleChildrenByParentId } = (0, import_hooks54.useCategoryChildren)({
18354
18461
  queryKeyScope: "event-list-category-children",
18355
18462
  enabled: isDiscoveryFiltersEnabled,
18356
18463
  parentIds: visibleChildPrefetchIds,
@@ -18366,7 +18473,7 @@ var EventList = ({
18366
18473
  }
18367
18474
  return Array.from(ids);
18368
18475
  }, [categoryPath, visibleChildrenByParentId]);
18369
- const { childrenByParentId: visibleGrandchildrenByParentId } = (0, import_hooks53.useCategoryChildren)({
18476
+ const { childrenByParentId: visibleGrandchildrenByParentId } = (0, import_hooks54.useCategoryChildren)({
18370
18477
  queryKeyScope: "event-list-category-children",
18371
18478
  enabled: isDiscoveryFiltersEnabled,
18372
18479
  parentIds: visibleGrandchildPrefetchIds,
@@ -18422,14 +18529,14 @@ var EventList = ({
18422
18529
  isFetchingNextPage,
18423
18530
  isPlaceholderData,
18424
18531
  loadedPageCount
18425
- } = (0, import_hooks53.useVenueEvents)({
18532
+ } = (0, import_hooks54.useVenueEvents)({
18426
18533
  queryKeyScope: "event-list",
18427
18534
  venues,
18428
18535
  search,
18429
18536
  categoryIds: resolvedCategoryIds,
18430
18537
  matchStatus,
18431
18538
  limit: requestLimit,
18432
- status: [import_hooks53.MarketStatus.open],
18539
+ status: [import_hooks54.MarketStatus.open],
18433
18540
  sortBy: sortQueryParams.sortBy,
18434
18541
  sortDir: sortQueryParams.sortDir,
18435
18542
  endDateFrom,
@@ -18464,7 +18571,7 @@ var EventList = ({
18464
18571
  const visibleMidpointVenueMarketIds = (0, import_react31.useMemo)(() => {
18465
18572
  return collectMidpointVenueMarketIds(visibleVenueMarkets);
18466
18573
  }, [visibleVenueMarkets]);
18467
- const { midpointRows: sharedMidpointRows, isLoading: isSharedMidpointsLoading } = (0, import_hooks53.useVenueMarketMidpoints)({
18574
+ const { midpointRows: sharedMidpointRows, isLoading: isSharedMidpointsLoading } = (0, import_hooks54.useVenueMarketMidpoints)({
18468
18575
  venueMarketIds: visibleMidpointVenueMarketIds,
18469
18576
  enabled: visibleMidpointVenueMarketIds.length > 0
18470
18577
  });
@@ -18645,7 +18752,7 @@ var EventList = ({
18645
18752
  onMarketClick,
18646
18753
  getMarketHref,
18647
18754
  href: getEventHref == null ? void 0 : getEventHref(event),
18648
- marketStatus: import_hooks53.MarketStatus.open
18755
+ marketStatus: import_hooks54.MarketStatus.open
18649
18756
  },
18650
18757
  event.id
18651
18758
  )),
@@ -18725,12 +18832,12 @@ var EventList = ({
18725
18832
  EventList.displayName = "EventList";
18726
18833
 
18727
18834
  // src/pages/home/index.tsx
18728
- var import_hooks71 = require("@agg-build/hooks");
18835
+ var import_hooks72 = require("@agg-build/hooks");
18729
18836
  var import_sdk24 = require("@agg-build/sdk");
18730
18837
  var import_react49 = require("react");
18731
18838
 
18732
18839
  // src/pages/event-market/index.tsx
18733
- var import_hooks70 = require("@agg-build/hooks");
18840
+ var import_hooks71 = require("@agg-build/hooks");
18734
18841
  var import_react46 = require("react");
18735
18842
 
18736
18843
  // src/trading/types.ts
@@ -18740,7 +18847,7 @@ var parseVenue = (v) => (0, import_sdk18.safeParse)(v, isVenue);
18740
18847
  var parseAmount = (v) => (0, import_sdk18.safeParse)(v, import_sdk18.isFiniteNonNeg);
18741
18848
 
18742
18849
  // src/trading/settlement/settlement-details.tsx
18743
- var import_hooks54 = require("@agg-build/hooks");
18850
+ var import_hooks55 = require("@agg-build/hooks");
18744
18851
  var import_jsx_runtime155 = require("react/jsx-runtime");
18745
18852
  var hasContent = (value) => {
18746
18853
  return typeof value === "string" && value.trim().length > 0;
@@ -18764,11 +18871,11 @@ var buildVenueSettlementRules = (venueMarkets) => {
18764
18871
  };
18765
18872
  var SettlementDetails = ({ className }) => {
18766
18873
  var _a, _b, _c, _d, _e, _f;
18767
- const tradingContext = (0, import_hooks54.useEventTradingContext)();
18874
+ const tradingContext = (0, import_hooks55.useEventTradingContext)();
18768
18875
  const selectedEvent = (_a = tradingContext == null ? void 0 : tradingContext.selectedEvent) != null ? _a : null;
18769
18876
  const selectedMarket = (_b = tradingContext == null ? void 0 : tradingContext.selectedMarket) != null ? _b : null;
18770
18877
  if (!selectedEvent) return null;
18771
- const activeMarket = selectedMarket != null ? selectedMarket : (0, import_hooks54.resolveDefaultTradingMarket)(selectedEvent);
18878
+ const activeMarket = selectedMarket != null ? selectedMarket : (0, import_hooks55.resolveDefaultTradingMarket)(selectedEvent);
18772
18879
  if (!activeMarket) return null;
18773
18880
  const allVenueMarkets = normalizeVenueMarketCluster(selectedEvent.venueMarkets);
18774
18881
  const activeMarketCluster = normalizeVenueMarketCluster(
@@ -18809,10 +18916,9 @@ var SettlementDetails = ({ className }) => {
18809
18916
  SettlementDetails.displayName = "SettlementDetails";
18810
18917
 
18811
18918
  // src/trading/place-order/index.tsx
18812
- var import_hooks63 = require("@agg-build/hooks");
18919
+ var import_hooks64 = require("@agg-build/hooks");
18813
18920
  var import_sdk23 = require("@agg-build/sdk");
18814
18921
  var import_react38 = __toESM(require("@number-flow/react"));
18815
- var DropdownMenu2 = __toESM(require("@radix-ui/react-dropdown-menu"));
18816
18922
  var Popover = __toESM(require("@radix-ui/react-popover"));
18817
18923
  var import_dayjs8 = __toESM(require("dayjs"));
18818
18924
  var import_timezone2 = __toESM(require("dayjs/plugin/timezone"));
@@ -18820,14 +18926,14 @@ var import_utc2 = __toESM(require("dayjs/plugin/utc"));
18820
18926
  var import_react39 = require("react");
18821
18927
 
18822
18928
  // src/geo-block-banner/index.tsx
18823
- var import_hooks55 = require("@agg-build/hooks");
18929
+ var import_hooks56 = require("@agg-build/hooks");
18824
18930
  var import_jsx_runtime156 = require("react/jsx-runtime");
18825
18931
  var GeoBlockBanner = ({
18826
18932
  venue,
18827
18933
  termsUrl = AGG_TERMS_OF_SERVICE_URL,
18828
18934
  className
18829
18935
  }) => {
18830
- const labels = (0, import_hooks55.useLabels)();
18936
+ const labels = (0, import_hooks56.useLabels)();
18831
18937
  const message = venue ? labels.trading.geoBlockVenueMessage(venue) : labels.trading.geoBlockGenericMessage;
18832
18938
  return /* @__PURE__ */ (0, import_jsx_runtime156.jsxs)(
18833
18939
  "div",
@@ -18849,7 +18955,7 @@ GeoBlockBanner.displayName = "GeoBlockBanner";
18849
18955
 
18850
18956
  // src/onboarding/index.tsx
18851
18957
  var import_react36 = require("react");
18852
- var import_hooks61 = require("@agg-build/hooks");
18958
+ var import_hooks62 = require("@agg-build/hooks");
18853
18959
  var Dialog5 = __toESM(require("@radix-ui/react-dialog"));
18854
18960
 
18855
18961
  // src/onboarding/onboarding-modal.constants.ts
@@ -18873,7 +18979,7 @@ var ONCHAIN_VENUES = [
18873
18979
 
18874
18980
  // src/onboarding/steps/how-it-works.tsx
18875
18981
  var import_react32 = require("react");
18876
- var import_hooks56 = require("@agg-build/hooks");
18982
+ var import_hooks57 = require("@agg-build/hooks");
18877
18983
  var import_jsx_runtime157 = require("react/jsx-runtime");
18878
18984
  var defaultIcons = {
18879
18985
  createAccount: /* @__PURE__ */ (0, import_jsx_runtime157.jsx)(CreateAccountIcon, { className: "h-[28px] w-[28px] text-agg-muted-foreground" }),
@@ -18882,7 +18988,7 @@ var defaultIcons = {
18882
18988
  stayInControl: /* @__PURE__ */ (0, import_jsx_runtime157.jsx)(StayInControlIcon, { className: "h-[28px] w-[28px] text-agg-muted-foreground" })
18883
18989
  };
18884
18990
  var HowItWorksStep = ({ onContinue, icons }) => {
18885
- const labels = (0, import_hooks56.useLabels)();
18991
+ const labels = (0, import_hooks57.useLabels)();
18886
18992
  const scrollRef = (0, import_react32.useRef)(null);
18887
18993
  const [showTopGradient, setShowTopGradient] = (0, import_react32.useState)(false);
18888
18994
  const [showBottomGradient, setShowBottomGradient] = (0, import_react32.useState)(true);
@@ -18956,10 +19062,10 @@ HowItWorksStep.displayName = "HowItWorksStep";
18956
19062
 
18957
19063
  // src/onboarding/steps/profile-setup.tsx
18958
19064
  var import_react33 = require("react");
18959
- var import_hooks57 = require("@agg-build/hooks");
19065
+ var import_hooks58 = require("@agg-build/hooks");
18960
19066
  var import_jsx_runtime158 = require("react/jsx-runtime");
18961
19067
  var ProfileSetupStep = ({ onContinue }) => {
18962
- const labels = (0, import_hooks57.useLabels)();
19068
+ const labels = (0, import_hooks58.useLabels)();
18963
19069
  const [username, setUsername] = (0, import_react33.useState)("");
18964
19070
  const [avatarFile, setAvatarFile] = (0, import_react33.useState)();
18965
19071
  const [avatarPreview, setAvatarPreview] = (0, import_react33.useState)();
@@ -19089,7 +19195,7 @@ var ProfileSetupStep = ({ onContinue }) => {
19089
19195
  ProfileSetupStep.displayName = "ProfileSetupStep";
19090
19196
 
19091
19197
  // src/onboarding/steps/connect-accounts.tsx
19092
- var import_hooks58 = require("@agg-build/hooks");
19198
+ var import_hooks59 = require("@agg-build/hooks");
19093
19199
  var import_jsx_runtime159 = require("react/jsx-runtime");
19094
19200
  var OnchainVenueLogos = () => {
19095
19201
  return /* @__PURE__ */ (0, import_jsx_runtime159.jsx)("div", { className: "flex gap-1 sm:gap-0 sm:-space-x-5", children: ONCHAIN_VENUES.map((venue, index) => /* @__PURE__ */ (0, import_jsx_runtime159.jsx)("div", { style: { zIndex: ONCHAIN_VENUES.length - index }, children: /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(VenueLogo, { venue, variant: "logo", size: "medium", className: "sm:h-8 sm:w-8" }) }, venue)) });
@@ -19103,7 +19209,7 @@ var VenueCard = ({
19103
19209
  onConnect,
19104
19210
  connected = false
19105
19211
  }) => {
19106
- const labels = (0, import_hooks58.useLabels)();
19212
+ const labels = (0, import_hooks59.useLabels)();
19107
19213
  const action = connected ? /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(CheckCircleIcon, { className: "h-6 w-6 text-agg-success" }) : /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(
19108
19214
  Button,
19109
19215
  {
@@ -19162,7 +19268,7 @@ var ConnectAccountsStep = ({
19162
19268
  onContinue,
19163
19269
  connectedOnchain = false
19164
19270
  }) => {
19165
- const labels = (0, import_hooks58.useLabels)();
19271
+ const labels = (0, import_hooks59.useLabels)();
19166
19272
  const canContinue = connectedOnchain;
19167
19273
  return /* @__PURE__ */ (0, import_jsx_runtime159.jsxs)("div", { className: "flex flex-col gap-6", children: [
19168
19274
  /* @__PURE__ */ (0, import_jsx_runtime159.jsx)("h2", { className: "text-center text-agg-2xl font-agg-bold text-agg-foreground", children: labels.onboarding.connectAccounts.title }),
@@ -19197,7 +19303,7 @@ ConnectAccountsStep.displayName = "ConnectAccountsStep";
19197
19303
 
19198
19304
  // src/onboarding/steps/connect-onchain-modal.tsx
19199
19305
  var import_react34 = require("react");
19200
- var import_hooks59 = require("@agg-build/hooks");
19306
+ var import_hooks60 = require("@agg-build/hooks");
19201
19307
  var Dialog3 = __toESM(require("@radix-ui/react-dialog"));
19202
19308
  var import_jsx_runtime160 = require("react/jsx-runtime");
19203
19309
  var ConnectOnchainModal = ({
@@ -19205,7 +19311,7 @@ var ConnectOnchainModal = ({
19205
19311
  onOpenChange,
19206
19312
  onConnect
19207
19313
  }) => {
19208
- const labels = (0, import_hooks59.useLabels)();
19314
+ const labels = (0, import_hooks60.useLabels)();
19209
19315
  const [connecting, setConnecting] = (0, import_react34.useState)(false);
19210
19316
  const [error, setError] = (0, import_react34.useState)();
19211
19317
  const handleCancel = (0, import_react34.useCallback)(() => {
@@ -19304,7 +19410,7 @@ var ConnectOnchainModal = ({
19304
19410
  ConnectOnchainModal.displayName = "ConnectOnchainModal";
19305
19411
 
19306
19412
  // src/onboarding/steps/connect-kalshi-modal.tsx
19307
- var import_hooks60 = require("@agg-build/hooks");
19413
+ var import_hooks61 = require("@agg-build/hooks");
19308
19414
  var import_sdk20 = require("@agg-build/sdk");
19309
19415
  var Dialog4 = __toESM(require("@radix-ui/react-dialog"));
19310
19416
  var import_react35 = require("react");
@@ -19331,8 +19437,8 @@ var ConnectKalshiModal = ({
19331
19437
  onOpenChange,
19332
19438
  onVerify
19333
19439
  }) => {
19334
- const labels = (0, import_hooks60.useLabels)();
19335
- const { disabledVenues, isLoading: isAppConfigLoading } = (0, import_hooks60.useAppConfig)();
19440
+ const labels = (0, import_hooks61.useLabels)();
19441
+ const { disabledVenues, isLoading: isAppConfigLoading } = (0, import_hooks61.useAppConfig)();
19336
19442
  const apiKeyInputRef = (0, import_react35.useRef)(null);
19337
19443
  const errorId = (0, import_react35.useId)();
19338
19444
  const [apiKeyId, setApiKeyId] = (0, import_react35.useState)("");
@@ -19340,7 +19446,7 @@ var ConnectKalshiModal = ({
19340
19446
  const [isVerifying, setIsVerifying] = (0, import_react35.useState)(false);
19341
19447
  const [isConnected, setIsConnected] = (0, import_react35.useState)(false);
19342
19448
  const [error, setError] = (0, import_react35.useState)();
19343
- const availabilityState = (0, import_hooks60.getVenueAvailabilityState)({
19449
+ const availabilityState = (0, import_hooks61.getVenueAvailabilityState)({
19344
19450
  venueId: import_sdk20.Venue.kalshi,
19345
19451
  disabledVenues,
19346
19452
  isConfigLoading: isAppConfigLoading
@@ -19642,7 +19748,7 @@ var OnboardingModal = ({
19642
19748
  connectedOnchain = false
19643
19749
  }) => {
19644
19750
  var _a;
19645
- const labels = (0, import_hooks61.useLabels)();
19751
+ const labels = (0, import_hooks62.useLabels)();
19646
19752
  const [step, setStep] = (0, import_react36.useState)(ONBOARDING_STEPS.HOW_IT_WORKS);
19647
19753
  const stepLabels = {
19648
19754
  [ONBOARDING_STEPS.HOW_IT_WORKS]: labels.onboarding.modal.stepHowItWorks,
@@ -19727,12 +19833,12 @@ var requestAggWithdrawModalOpen = () => {
19727
19833
  };
19728
19834
 
19729
19835
  // src/trading/fund-kalshi-modal.tsx
19730
- var import_hooks62 = require("@agg-build/hooks");
19836
+ var import_hooks63 = require("@agg-build/hooks");
19731
19837
  var import_sdk21 = require("@agg-build/sdk");
19732
19838
  var Dialog6 = __toESM(require("@radix-ui/react-dialog"));
19733
19839
  var import_jsx_runtime163 = require("react/jsx-runtime");
19734
19840
  var FundKalshiModal = ({ open, onOpenChange }) => {
19735
- const labels = (0, import_hooks62.useLabels)();
19841
+ const labels = (0, import_hooks63.useLabels)();
19736
19842
  const modalLabels = labels.trading.fundKalshiModal;
19737
19843
  return /* @__PURE__ */ (0, import_jsx_runtime163.jsx)(Modal, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime163.jsxs)(
19738
19844
  Modal.Container,
@@ -19804,11 +19910,12 @@ var MIN_SELL_ORDER_SHARES = 1;
19804
19910
  var DEFAULT_SLIPPAGE_VALUE = "0.5";
19805
19911
  var HIGH_SLIPPAGE_THRESHOLD = 10;
19806
19912
  var PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT = 3;
19913
+ var PLACE_ORDER_NUMERIC_INPUT_CLASS_NAME = "bg-transparent text-right text-agg-3xl font-agg-bold leading-agg-9 tracking-agg-normal text-agg-foreground outline-none";
19807
19914
  var PLACE_ORDER_CONTAINER_CLASS_NAME = "w-full overflow-hidden rounded-agg-xl border border-agg-separator bg-agg-secondary shadow-none hover:shadow-none";
19808
19915
  var PLACE_ORDER_OUTCOME_BUTTON_CLASS_NAMES = {
19809
19916
  activeNegative: "border-agg-error/50 bg-agg-error/15 font-agg-bold text-agg-error",
19810
19917
  activePositive: "border-agg-success/50 bg-agg-success/15 font-agg-bold text-agg-success",
19811
- base: "flex h-10 flex-1 items-center justify-center rounded-agg-full border px-6 text-agg-base leading-agg-6",
19918
+ base: "flex h-11 flex-1 items-center justify-center rounded-agg-full border px-6 text-agg-base leading-agg-6",
19812
19919
  inactive: "border-transparent bg-agg-secondary-hover font-agg-normal text-agg-foreground hover:bg-agg-tertiary"
19813
19920
  };
19814
19921
 
@@ -20277,6 +20384,93 @@ var routePriceLabelFormatter = new Intl.NumberFormat("en-US", {
20277
20384
  maximumFractionDigits: 1
20278
20385
  });
20279
20386
  var GEO_BLOCK_WARNING_PREFIX = "Venue not available in your region";
20387
+ var normalizeOutcomeName = (value) => {
20388
+ var _a;
20389
+ return (_a = value == null ? void 0 : value.trim().toLowerCase()) != null ? _a : "";
20390
+ };
20391
+ var findMatchingVenueOutcome = (market, selectedOutcome) => {
20392
+ var _a, _b;
20393
+ const selectedNames = new Set(
20394
+ [selectedOutcome.label, selectedOutcome.title].map(normalizeOutcomeName).filter(Boolean)
20395
+ );
20396
+ return (_b = (_a = market.venueMarketOutcomes) == null ? void 0 : _a.find((outcome) => {
20397
+ const normalizedLabel = normalizeOutcomeName(outcome.label);
20398
+ return normalizedLabel !== "" && selectedNames.has(normalizedLabel);
20399
+ })) != null ? _b : null;
20400
+ };
20401
+ var buildLimitOrderVenueOptions = ({
20402
+ currentPrices,
20403
+ livePrices,
20404
+ market,
20405
+ selectedOutcomeId
20406
+ }) => {
20407
+ var _a, _b, _c, _d;
20408
+ if (!market || !selectedOutcomeId) return [];
20409
+ const selectedOutcome = market.venueMarketOutcomes.find(
20410
+ (outcome) => outcome.id === selectedOutcomeId
20411
+ );
20412
+ if (!selectedOutcome) return [];
20413
+ const options = /* @__PURE__ */ new Map();
20414
+ const addOption = ({
20415
+ outcomeId,
20416
+ venue,
20417
+ venueMarketId
20418
+ }) => {
20419
+ var _a2;
20420
+ const parsedVenue = parseVenue(venue);
20421
+ if (!parsedVenue.success || options.has(parsedVenue.data)) return;
20422
+ options.set(parsedVenue.data, {
20423
+ currentPrice: (_a2 = livePrices == null ? void 0 : livePrices.get(outcomeId)) != null ? _a2 : currentPrices.get(outcomeId),
20424
+ venue: parsedVenue.data,
20425
+ venueMarketId,
20426
+ venueMarketOutcomeId: outcomeId
20427
+ });
20428
+ };
20429
+ addOption({
20430
+ outcomeId: selectedOutcome.id,
20431
+ venue: market.venue,
20432
+ venueMarketId: market.id
20433
+ });
20434
+ const matchedMarketsById = new Map(
20435
+ ((_a = market.matchedVenueMarkets) != null ? _a : []).map((matchedMarket) => [matchedMarket.id, matchedMarket])
20436
+ );
20437
+ const matchedOutcomeRefs = (_b = selectedOutcome.matchedVenueMarketOutcomes) != null ? _b : [];
20438
+ for (const ref of matchedOutcomeRefs) {
20439
+ const matchedMarket = matchedMarketsById.get(ref.venueMarketId);
20440
+ const matchedOutcome = (_c = matchedMarket == null ? void 0 : matchedMarket.venueMarketOutcomes) == null ? void 0 : _c.find(
20441
+ (outcome) => outcome.id === ref.venueMarketOutcomeId
20442
+ );
20443
+ if (!matchedMarket || !matchedOutcome) continue;
20444
+ addOption({
20445
+ outcomeId: matchedOutcome.id,
20446
+ venue: matchedMarket.venue,
20447
+ venueMarketId: matchedMarket.id
20448
+ });
20449
+ }
20450
+ if (matchedOutcomeRefs.length === 0) {
20451
+ for (const matchedMarket of (_d = market.matchedVenueMarkets) != null ? _d : []) {
20452
+ const matchedOutcome = findMatchingVenueOutcome(matchedMarket, selectedOutcome);
20453
+ if (!matchedOutcome) continue;
20454
+ addOption({
20455
+ outcomeId: matchedOutcome.id,
20456
+ venue: matchedMarket.venue,
20457
+ venueMarketId: matchedMarket.id
20458
+ });
20459
+ }
20460
+ }
20461
+ return [...options.values()];
20462
+ };
20463
+ var resolveAutomaticLimitOrderVenueOption = (options, side) => {
20464
+ if (options.length === 0) return null;
20465
+ return [...options].sort((left, right) => {
20466
+ if (left.currentPrice == null && right.currentPrice == null) {
20467
+ return left.venue.localeCompare(right.venue);
20468
+ }
20469
+ if (left.currentPrice == null) return 1;
20470
+ if (right.currentPrice == null) return -1;
20471
+ return side === "buy" ? left.currentPrice - right.currentPrice : right.currentPrice - left.currentPrice;
20472
+ })[0];
20473
+ };
20280
20474
  var isGeoBlockWarningReason = (reason) => reason.startsWith(GEO_BLOCK_WARNING_PREFIX);
20281
20475
  var extractGeoBlockedVenues = (warnings) => {
20282
20476
  if (!(warnings == null ? void 0 : warnings.length)) return /* @__PURE__ */ new Set();
@@ -20284,6 +20478,12 @@ var extractGeoBlockedVenues = (warnings) => {
20284
20478
  warnings.filter((w) => w.venue && isGeoBlockWarningReason(w.reason)).map((w) => w.venue)
20285
20479
  );
20286
20480
  };
20481
+ var getSmartRouteTotalFees = (feeBreakdown) => {
20482
+ if (!feeBreakdown) return null;
20483
+ const feeParts = [feeBreakdown.venueFees, feeBreakdown.bridgeFees, feeBreakdown.executionGas];
20484
+ if (!feeParts.every(Number.isFinite)) return null;
20485
+ return feeParts.reduce((total, fee) => total + fee, 0);
20486
+ };
20287
20487
  var hasLowLiquidityWarning = (warnings) => {
20288
20488
  if (!(warnings == null ? void 0 : warnings.length)) return false;
20289
20489
  return warnings.some((warning) => (warning == null ? void 0 : warning.reason) === "low_liquidity");
@@ -21935,7 +22135,7 @@ var PlaceOrderSlippageControl = ({
21935
22135
  minimumValue: slippageMinimumValue
21936
22136
  }) => {
21937
22137
  var _a, _b;
21938
- const labels = (0, import_hooks63.useLabels)();
22138
+ const labels = (0, import_hooks64.useLabels)();
21939
22139
  const containerRef = (0, import_react39.useRef)(null);
21940
22140
  const triggerRef = (0, import_react39.useRef)(null);
21941
22141
  const inputRef = (0, import_react39.useRef)(null);
@@ -22208,7 +22408,7 @@ var PlaceOrderResolvedView = ({
22208
22408
  isSportsEvent = false
22209
22409
  }) => {
22210
22410
  var _a, _b;
22211
- const labels = (0, import_hooks63.useLabels)();
22411
+ const labels = (0, import_hooks64.useLabels)();
22212
22412
  const tradingLabels = labels.trading;
22213
22413
  const resolvingTimestamp = (_a = resolutionTimestamp != null ? resolutionTimestamp : tradingState.resolvesAt) != null ? _a : tradingState.endsAt;
22214
22414
  const isResolvingMarket = false;
@@ -22572,23 +22772,24 @@ var PlaceOrder = ({
22572
22772
  resolvedClaim,
22573
22773
  midpointsResult
22574
22774
  }) => {
22575
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y;
22775
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$;
22576
22776
  const {
22577
22777
  enableDebug: isExecutionDebugEnabled,
22578
22778
  features: { enableAnimations, showFeesBreakdown, showLimitOrders },
22779
+ formatting: { formatPrice },
22579
22780
  general: { locale },
22580
22781
  trading: { executionMode: configuredExecutionMode = "live" } = { executionMode: "live" }
22581
- } = (0, import_hooks63.useSdkUiConfig)();
22582
- const labels = (0, import_hooks63.useLabels)();
22782
+ } = (0, import_hooks64.useSdkUiConfig)();
22783
+ const labels = (0, import_hooks64.useLabels)();
22583
22784
  const tradingLabels = labels.trading;
22584
22785
  const toastCtx = useOptionalToast();
22585
- const { isTradingBlocked } = (0, import_hooks63.useGeoBlock)();
22586
- const tradingContext = (0, import_hooks63.useEventTradingContext)();
22786
+ const { isTradingBlocked } = (0, import_hooks64.useGeoBlock)();
22787
+ const tradingContext = (0, import_hooks64.useEventTradingContext)();
22587
22788
  const selectedEvent = (_a = tradingContext == null ? void 0 : tradingContext.selectedEvent) != null ? _a : null;
22588
22789
  const selectedMarket = (_b = tradingContext == null ? void 0 : tradingContext.selectedMarket) != null ? _b : null;
22589
22790
  const selectedOutcomeId = (_c = tradingContext == null ? void 0 : tradingContext.selectedOutcomeId) != null ? _c : null;
22590
22791
  const resolvedEventTradingState = (0, import_react39.useMemo)(() => {
22591
- return eventTradingState != null ? eventTradingState : (0, import_hooks63.resolveEventTradingState)(selectedEvent);
22792
+ return eventTradingState != null ? eventTradingState : (0, import_hooks64.resolveEventTradingState)(selectedEvent);
22592
22793
  }, [eventTradingState, selectedEvent]);
22593
22794
  const scopedSelectedEvent = (0, import_react39.useMemo)(() => {
22594
22795
  var _a2;
@@ -22616,7 +22817,7 @@ var PlaceOrder = ({
22616
22817
  )) != null ? _f : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venueMarketOutcomes[0]) != null ? _g : null;
22617
22818
  const scopedSelectedOutcomeId = (_h = scopedSelectedOutcome == null ? void 0 : scopedSelectedOutcome.id) != null ? _h : null;
22618
22819
  const resolvedTradingState = (0, import_react39.useMemo)(() => {
22619
- return (0, import_hooks63.resolveMarketTradingState)(scopedSelectedMarket);
22820
+ return (0, import_hooks64.resolveMarketTradingState)(scopedSelectedMarket);
22620
22821
  }, [scopedSelectedMarket]);
22621
22822
  const resolvedReadOnlyMarket = (0, import_react39.useMemo)(() => {
22622
22823
  var _a2;
@@ -22630,11 +22831,11 @@ var PlaceOrder = ({
22630
22831
  scopedSelectedMarket
22631
22832
  ]);
22632
22833
  const resolvedReadOnlyTradingState = (0, import_react39.useMemo)(() => {
22633
- return (0, import_hooks63.resolveMarketTradingState)(resolvedReadOnlyMarket);
22834
+ return (0, import_hooks64.resolveMarketTradingState)(resolvedReadOnlyMarket);
22634
22835
  }, [resolvedReadOnlyMarket]);
22635
22836
  const isEndedWithoutKnownWinner = false;
22636
22837
  const orderEligibility = (0, import_react39.useMemo)(
22637
- () => (0, import_hooks63.resolveOrderEligibility)({
22838
+ () => (0, import_hooks64.resolveOrderEligibility)({
22638
22839
  event: scopedSelectedEvent,
22639
22840
  market: scopedSelectedMarket,
22640
22841
  outcome: scopedSelectedOutcome,
@@ -22643,11 +22844,11 @@ var PlaceOrder = ({
22643
22844
  [scopedSelectedEvent, scopedSelectedMarket, scopedSelectedOutcome, resolvedEventTradingState]
22644
22845
  );
22645
22846
  const isResolvedOutcomeCtaLocked = resolvedEventTradingState.kind === "resolved" || resolvedTradingState.kind === "resolved";
22646
- const { isAuthenticated, user } = (0, import_hooks63.useAggAuthContext)();
22847
+ const { isAuthenticated, user } = (0, import_hooks64.useAggAuthContext)();
22647
22848
  const resolvedExecutionMode = executionMode != null ? executionMode : configuredExecutionMode;
22648
22849
  const isPaperMode = resolvedExecutionMode === "paper";
22649
- const liveBalanceState = (0, import_hooks63.useAggBalanceState)();
22650
- const paperBalancesQuery = (0, import_hooks63.useManagedBalances)({
22850
+ const liveBalanceState = (0, import_hooks64.useAggBalanceState)();
22851
+ const paperBalancesQuery = (0, import_hooks64.useManagedBalances)({
22651
22852
  enabled: Boolean(isAuthenticated && isPaperMode),
22652
22853
  mode: "paper"
22653
22854
  });
@@ -22667,22 +22868,22 @@ var PlaceOrder = ({
22667
22868
  const liveAvailableBalance = (_i = liveBalanceState.availableBalance) != null ? _i : liveBalanceState.totalBalance;
22668
22869
  const totalBalance = isPaperMode ? paperTotalBalance : liveAvailableBalance;
22669
22870
  const isBalanceLoading = isPaperMode ? paperBalancesQuery.isLoading : liveBalanceState.isLoading;
22670
- const executeManaged = (0, import_hooks63.useExecuteManaged)();
22671
- const placeLimitOrder = (0, import_hooks63.usePlaceLimitOrder)();
22672
- const aggClient = (0, import_hooks63.useAggClient)();
22673
- const queryClient = (0, import_hooks63.useQueryClient)();
22674
- const { disabledVenues, isLoading: isAppConfigLoading } = (0, import_hooks63.useAppConfig)();
22675
- const { data: kalshiKeyStatus, refetch: refetchKalshiKeyStatus } = (0, import_hooks63.useVenueKeyStatus)(
22871
+ const executeManaged = (0, import_hooks64.useExecuteManaged)();
22872
+ const placeLimitOrder = (0, import_hooks64.usePlaceLimitOrder)();
22873
+ const aggClient = (0, import_hooks64.useAggClient)();
22874
+ const queryClient = (0, import_hooks64.useQueryClient)();
22875
+ const { disabledVenues, isLoading: isAppConfigLoading } = (0, import_hooks64.useAppConfig)();
22876
+ const { data: kalshiKeyStatus, refetch: refetchKalshiKeyStatus } = (0, import_hooks64.useVenueKeyStatus)(
22676
22877
  import_sdk23.Venue.kalshi,
22677
22878
  isAuthenticated
22678
22879
  );
22679
22880
  const [isConnectKalshiModalOpen, setIsConnectKalshiModalOpen] = (0, import_react39.useState)(false);
22680
22881
  const [isFundKalshiModalOpen, setIsFundKalshiModalOpen] = (0, import_react39.useState)(false);
22681
- const livePrices = (0, import_hooks63.useLiveOutcomePrices)(
22882
+ const livePrices = (0, import_hooks64.useLiveOutcomePrices)(
22682
22883
  scopedSelectedMarket ? [scopedSelectedMarket] : void 0
22683
22884
  );
22684
- const wsBestPrices = (0, import_hooks63.useLiveBestPrices)(scopedSelectedMarket ? [scopedSelectedMarket] : void 0);
22685
- const fetchedClusterMidpointResult = (0, import_hooks63.useMidpoints)(
22885
+ const wsBestPrices = (0, import_hooks64.useLiveBestPrices)(scopedSelectedMarket ? [scopedSelectedMarket] : void 0);
22886
+ const fetchedClusterMidpointResult = (0, import_hooks64.useMidpoints)(
22686
22887
  midpointsResult ? [] : scopedSelectedMarket ? [scopedSelectedMarket] : []
22687
22888
  );
22688
22889
  const clusterMidpointResult = midpointsResult != null ? midpointsResult : fetchedClusterMidpointResult;
@@ -22690,12 +22891,12 @@ var PlaceOrder = ({
22690
22891
  const clusterBestMidpoint = clusterMidpointResult.bestMidpoint;
22691
22892
  const clusterBestPricesRest = clusterMidpointResult.bestPrices;
22692
22893
  const clusterBestPrices = (0, import_react39.useMemo)(
22693
- () => (0, import_hooks63.mergeBestPricesPreferringLive)(clusterBestPricesRest, wsBestPrices),
22894
+ () => (0, import_hooks64.mergeBestPricesPreferringLive)(clusterBestPricesRest, wsBestPrices),
22694
22895
  [clusterBestPricesRest, wsBestPrices]
22695
22896
  );
22696
22897
  const [internalTab, setInternalTab] = (0, import_react39.useState)("buy");
22697
22898
  const [executionType, setExecutionType] = (0, import_react39.useState)("market");
22698
- const [isExecutionTypeMenuOpen, setIsExecutionTypeMenuOpen] = (0, import_react39.useState)(false);
22899
+ const [selectedLimitVenue, setSelectedLimitVenue] = (0, import_react39.useState)(null);
22699
22900
  const [limitPrice, setLimitPrice] = (0, import_react39.useState)(0.5);
22700
22901
  const [limitPriceInputValue, setLimitPriceInputValue] = (0, import_react39.useState)(formatLimitPriceInputValue(0.5));
22701
22902
  const [limitPriceInputError, setLimitPriceInputError] = (0, import_react39.useState)(null);
@@ -22745,7 +22946,6 @@ var PlaceOrder = ({
22745
22946
  ]);
22746
22947
  const buyTabRef = (0, import_react39.useRef)(null);
22747
22948
  const sellTabRef = (0, import_react39.useRef)(null);
22748
- const executionTypeTriggerRef = (0, import_react39.useRef)(null);
22749
22949
  const expirationTriggerRef = (0, import_react39.useRef)(null);
22750
22950
  const limitPriceInitializedForOutcomeRef = (0, import_react39.useRef)(void 0);
22751
22951
  const expirationOptionRefs = (0, import_react39.useRef)([]);
@@ -22781,16 +22981,37 @@ var PlaceOrder = ({
22781
22981
  scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.id,
22782
22982
  scopedSelectedOutcomeId
22783
22983
  ]);
22784
- const debouncedAmount = (0, import_hooks63.useDebouncedValue)(internalAmount, 300);
22984
+ const debouncedAmount = (0, import_hooks64.useDebouncedValue)(internalAmount, 300);
22785
22985
  const isQuoteInputEditing = internalAmount !== debouncedAmount;
22786
22986
  const isLimitOrder = showLimitOrders && executionType === "limit";
22787
22987
  const isSell = (0, import_react39.useMemo)(() => internalTab === "sell", [internalTab]);
22988
+ const limitVenueOptions = (0, import_react39.useMemo)(
22989
+ () => {
22990
+ var _a2;
22991
+ return buildLimitOrderVenueOptions({
22992
+ currentPrices: (_a2 = clusterMidpointResult.currentMidpointsByOutcomeId) != null ? _a2 : clusterMidpointResult.prices,
22993
+ livePrices,
22994
+ market: scopedSelectedMarket,
22995
+ selectedOutcomeId: scopedSelectedOutcomeId
22996
+ });
22997
+ },
22998
+ [clusterMidpointResult, livePrices, scopedSelectedMarket, scopedSelectedOutcomeId]
22999
+ );
23000
+ const visibleLimitVenueOptions = (0, import_react39.useMemo)(() => {
23001
+ return limitVenueOptions.filter((option) => {
23002
+ return (0, import_hooks64.getVenueAvailabilityState)({
23003
+ venueId: option.venue,
23004
+ disabledVenues,
23005
+ isConfigLoading: isAppConfigLoading
23006
+ }) !== "hidden";
23007
+ });
23008
+ }, [disabledVenues, isAppConfigLoading, limitVenueOptions]);
22788
23009
  const {
22789
23010
  positions: executionPositions,
22790
23011
  dataUpdatedAt: executionPositionsUpdatedAt,
22791
23012
  isLoading: isExecutionPositionsLoading,
22792
23013
  isFetching: isExecutionPositionsFetching
22793
- } = (0, import_hooks63.useExecutionPositions)({
23014
+ } = (0, import_hooks64.useExecutionPositions)({
22794
23015
  enabled: Boolean(isAuthenticated && isSell),
22795
23016
  mode: isPaperMode ? "paper" : void 0
22796
23017
  });
@@ -22805,9 +23026,70 @@ var PlaceOrder = ({
22805
23026
  isEditing: isQuoteInputEditing,
22806
23027
  isMarketOpen: resolvedTradingState.kind === "open" && !isEndedWithoutKnownWinner,
22807
23028
  isPanelActive: isQuotePanelActive,
22808
- isSubmitting: submissionProgressState != null || isBeforeActionPending || executeManaged.isPending
23029
+ isSubmitting: submissionProgressState != null || isBeforeActionPending || executeManaged.isPending || placeLimitOrder.isPending
22809
23030
  };
22810
- const smartRoute = (0, import_hooks63.useSmartRoute)(__spreadProps(__spreadValues({
23031
+ const limitVenueQuoteRequests = (0, import_react39.useMemo)(
23032
+ () => visibleLimitVenueOptions.map((option) => ({
23033
+ venue: option.venue,
23034
+ venueMarketOutcomeId: option.venueMarketOutcomeId
23035
+ })),
23036
+ [visibleLimitVenueOptions]
23037
+ );
23038
+ const hasValidLimitVenueQuoteAmount = debouncedAmount > 0;
23039
+ const isLimitVenueQuoteEnabled = isLimitOrder && isQuotePanelActive && !isEndedWithoutKnownWinner && !submissionProgressState && !isBeforeActionPending && !placeLimitOrder.isPending && hasValidLimitVenueQuoteAmount && orderEligibility.canPlaceOrder && (!isSell || sellFilledForOutcomeId === scopedSelectedOutcomeId && !isQuoteInputEditing);
23040
+ const limitVenueQuotes = (0, import_hooks64.useLimitOrderVenueQuotes)({
23041
+ requests: limitVenueQuoteRequests,
23042
+ tradeSide: internalTab,
23043
+ amount: debouncedAmount,
23044
+ marketId: scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.id,
23045
+ accountId: (_k = user == null ? void 0 : user.id) != null ? _k : null,
23046
+ chainBalances: chainBalancesOverride,
23047
+ mode: isPaperMode ? "paper" : void 0,
23048
+ slipCapBps: 1e6,
23049
+ enabled: isLimitVenueQuoteEnabled,
23050
+ refreshContext: smartRouteRefreshContext
23051
+ });
23052
+ const limitVenueQuoteByVenue = (0, import_react39.useMemo)(
23053
+ () => new Map(limitVenueQuotes.quotes.map((quote) => [quote.request.venue, quote])),
23054
+ [limitVenueQuotes.quotes]
23055
+ );
23056
+ const geoBlockedLimitVenues = (0, import_react39.useMemo)(() => {
23057
+ var _a2;
23058
+ const venues = /* @__PURE__ */ new Set();
23059
+ for (const quote of limitVenueQuotes.quotes) {
23060
+ if (extractGeoBlockedVenues((_a2 = quote.data) == null ? void 0 : _a2.warnings).has(quote.request.venue)) {
23061
+ venues.add(quote.request.venue);
23062
+ }
23063
+ }
23064
+ return venues;
23065
+ }, [limitVenueQuotes.quotes]);
23066
+ const availableLimitVenueOptions = (0, import_react39.useMemo)(() => {
23067
+ return visibleLimitVenueOptions.filter((option) => {
23068
+ return !geoBlockedLimitVenues.has(option.venue) && (0, import_hooks64.getVenueAvailabilityState)({
23069
+ venueId: option.venue,
23070
+ disabledVenues,
23071
+ isConfigLoading: isAppConfigLoading
23072
+ }) === "available";
23073
+ });
23074
+ }, [disabledVenues, geoBlockedLimitVenues, isAppConfigLoading, visibleLimitVenueOptions]);
23075
+ const automaticLimitVenueOption = (0, import_react39.useMemo)(
23076
+ () => resolveAutomaticLimitOrderVenueOption(availableLimitVenueOptions, internalTab),
23077
+ [availableLimitVenueOptions, internalTab]
23078
+ );
23079
+ const selectedLimitVenueOption = (0, import_react39.useMemo)(() => {
23080
+ if (selectedLimitVenue) {
23081
+ const selectedOption = availableLimitVenueOptions.find(
23082
+ (option) => option.venue === selectedLimitVenue
23083
+ );
23084
+ if (selectedOption) return selectedOption;
23085
+ }
23086
+ return automaticLimitVenueOption;
23087
+ }, [automaticLimitVenueOption, availableLimitVenueOptions, selectedLimitVenue]);
23088
+ (0, import_react39.useEffect)(() => {
23089
+ if (!selectedLimitVenue || !geoBlockedLimitVenues.has(selectedLimitVenue)) return;
23090
+ setSelectedLimitVenue(null);
23091
+ }, [geoBlockedLimitVenues, selectedLimitVenue]);
23092
+ const smartRoute = (0, import_hooks64.useSmartRoute)(__spreadProps(__spreadValues({
22811
23093
  venueMarketOutcomeId: scopedSelectedOutcomeId,
22812
23094
  maxSpend: isSell ? void 0 : debouncedAmount,
22813
23095
  sellShares: isSell ? debouncedAmount : void 0,
@@ -22822,7 +23104,7 @@ var PlaceOrder = ({
22822
23104
  enabled: isSmartRouteEnabled
22823
23105
  }, isSell ? {
22824
23106
  sellCacheScope: {
22825
- accountId: (_k = user == null ? void 0 : user.id) != null ? _k : null,
23107
+ accountId: (_l = user == null ? void 0 : user.id) != null ? _l : null,
22826
23108
  positionVersion: executionPositionsUpdatedAt
22827
23109
  }
22828
23110
  } : {}), {
@@ -22876,14 +23158,14 @@ var PlaceOrder = ({
22876
23158
  },
22877
23159
  [debouncedAmount, isSell, scopedSelectedOutcomeId, smartRoute.data, smartRoute.isLoading]
22878
23160
  );
22879
- const venueSellQuotes = (0, import_hooks63.useVenueSellQuotes)({
23161
+ const venueSellQuotes = (0, import_hooks64.useVenueSellQuotes)({
22880
23162
  venueMarketOutcomeId: scopedSelectedOutcomeId,
22881
- accountId: (_l = user == null ? void 0 : user.id) != null ? _l : null,
23163
+ accountId: (_m = user == null ? void 0 : user.id) != null ? _m : null,
22882
23164
  positionVersion: executionPositionsUpdatedAt,
22883
23165
  requests: venueSellQuoteRequests,
22884
23166
  mode: isPaperMode ? "paper" : void 0,
22885
23167
  slipCapBps: 1e6,
22886
- enabled: isSell && isSmartRouteEnabled && !smartRoute.isLoading && ((_m = smartRoute.data) == null ? void 0 : _m.venueMarketOutcomeId) === scopedSelectedOutcomeId,
23168
+ enabled: isSell && isSmartRouteEnabled && !smartRoute.isLoading && ((_n = smartRoute.data) == null ? void 0 : _n.venueMarketOutcomeId) === scopedSelectedOutcomeId,
22887
23169
  refreshContext: smartRouteRefreshContext
22888
23170
  });
22889
23171
  const currentSellableShares = (0, import_react39.useMemo)(() => {
@@ -22918,13 +23200,13 @@ var PlaceOrder = ({
22918
23200
  isSell,
22919
23201
  scopedSelectedMarket,
22920
23202
  scopedSelectedOutcome,
22921
- (_o = (_n = smartRoute.data) == null ? void 0 : _n.positionAvailability) == null ? void 0 : _o.totalSellableShares
23203
+ (_p = (_o = smartRoute.data) == null ? void 0 : _o.positionAvailability) == null ? void 0 : _p.totalSellableShares
22922
23204
  ]);
22923
23205
  const maxSellableShares = (0, import_react39.useMemo)(
22924
23206
  () => floorToDecimals(currentSellableShares, SELL_SHARE_INPUT_DECIMALS),
22925
23207
  [currentSellableShares]
22926
23208
  );
22927
- const isCurrentSellableSharesLoading = isSell && isAuthenticated && !(typeof ((_q = (_p = smartRoute.data) == null ? void 0 : _p.positionAvailability) == null ? void 0 : _q.totalSellableShares) === "number") && (isExecutionPositionsLoading || isExecutionPositionsFetching);
23209
+ const isCurrentSellableSharesLoading = isSell && isAuthenticated && !(typeof ((_r = (_q = smartRoute.data) == null ? void 0 : _q.positionAvailability) == null ? void 0 : _r.totalSellableShares) === "number") && (isExecutionPositionsLoading || isExecutionPositionsFetching);
22928
23210
  const displayedCurrentSellableShares = (0, import_react39.useMemo)(() => {
22929
23211
  if (!Number.isFinite(currentSellableShares) || currentSellableShares <= 0) return 0;
22930
23212
  return floorToDecimals(currentSellableShares, SELL_SHARE_DISPLAY_DECIMALS);
@@ -22934,7 +23216,7 @@ var PlaceOrder = ({
22934
23216
  [maxSellableShares]
22935
23217
  );
22936
23218
  const isAtMaxSellableShares = isSell && maxSellableShares > 0 && Math.abs(internalAmount - maxSellableShares) < 1e-9;
22937
- const isSellAmountAboveAvailability = isSell && ((_r = smartRoute.data) == null ? void 0 : _r.venueMarketOutcomeId) === scopedSelectedOutcomeId && typeof ((_s = smartRoute.data.positionAvailability) == null ? void 0 : _s.totalSellableShares) === "number" && internalAmount > maxSellableShares;
23219
+ const isSellAmountAboveAvailability = isSell && ((_s = smartRoute.data) == null ? void 0 : _s.venueMarketOutcomeId) === scopedSelectedOutcomeId && typeof ((_t = smartRoute.data.positionAvailability) == null ? void 0 : _t.totalSellableShares) === "number" && internalAmount > maxSellableShares;
22938
23220
  (0, import_react39.useEffect)(() => {
22939
23221
  if (submissionProgressState != null) return;
22940
23222
  if (!isSell || isCurrentSellableSharesLoading) return;
@@ -22970,8 +23252,8 @@ var PlaceOrder = ({
22970
23252
  isSell,
22971
23253
  onAmountChange,
22972
23254
  scopedSelectedOutcomeId,
22973
- (_u = (_t = smartRoute.data) == null ? void 0 : _t.positionAvailability) == null ? void 0 : _u.totalSellableShares,
22974
- (_v = smartRoute.data) == null ? void 0 : _v.venueMarketOutcomeId,
23255
+ (_v = (_u = smartRoute.data) == null ? void 0 : _u.positionAvailability) == null ? void 0 : _v.totalSellableShares,
23256
+ (_w = smartRoute.data) == null ? void 0 : _w.venueMarketOutcomeId,
22975
23257
  submissionProgressState
22976
23258
  ]);
22977
23259
  const routeCards = (0, import_react39.useMemo)(() => {
@@ -23009,7 +23291,7 @@ var PlaceOrder = ({
23009
23291
  return selectedRouteCardId;
23010
23292
  }
23011
23293
  return resolveDefaultRouteCardId(routeCards, isSell ? void 0 : (_a2 = smartRoute.data) == null ? void 0 : _a2.status);
23012
- }, [routeCards, selectedRouteCardId, isSell, (_w = smartRoute.data) == null ? void 0 : _w.status]);
23294
+ }, [routeCards, selectedRouteCardId, isSell, (_x = smartRoute.data) == null ? void 0 : _x.status]);
23013
23295
  (0, import_react39.useEffect)(() => {
23014
23296
  if (routeCards.length === 0) {
23015
23297
  setSelectedRouteCardId(null);
@@ -23032,7 +23314,6 @@ var PlaceOrder = ({
23032
23314
  (0, import_react39.useEffect)(() => {
23033
23315
  if (showLimitOrders || executionType !== "limit") return;
23034
23316
  setExecutionType("market");
23035
- setIsExecutionTypeMenuOpen(false);
23036
23317
  setIsLimitExpirationPickerOpen(false);
23037
23318
  }, [executionType, showLimitOrders]);
23038
23319
  (0, import_react39.useEffect)(() => {
@@ -23048,15 +23329,19 @@ var PlaceOrder = ({
23048
23329
  setLimitPriceInputValue(formatLimitPriceInputValue(nextLimitPrice));
23049
23330
  setLimitPriceInputError(null);
23050
23331
  }, [executionType, scopedSelectedOutcomeId, selectedOutcomeDisplayPrice]);
23332
+ (0, import_react39.useEffect)(() => {
23333
+ setSelectedLimitVenue(null);
23334
+ }, [scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.id, scopedSelectedOutcomeId]);
23051
23335
  const orderedRouteCards = routeCards;
23052
- const selectedRouteCard = (_y = (_x = orderedRouteCards.find((card) => card.id === resolvedSelectedRouteCardId)) != null ? _x : orderedRouteCards[0]) != null ? _y : null;
23336
+ const selectedRouteCard = (_z = (_y = orderedRouteCards.find((card) => card.id === resolvedSelectedRouteCardId)) != null ? _y : orderedRouteCards[0]) != null ? _z : null;
23053
23337
  const isKalshiRoute = (0, import_react39.useMemo)(() => {
23338
+ if (isLimitOrder) return (selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue) === import_sdk23.Venue.kalshi;
23054
23339
  if (selectedRouteCard) {
23055
23340
  return selectedRouteCard.venue === "kalshi" || selectedRouteCard.quoteData.fills.some((f) => f.venue === "kalshi");
23056
23341
  }
23057
23342
  return (scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venue) === "kalshi";
23058
- }, [selectedRouteCard, scopedSelectedMarket]);
23059
- const displayedBalance = isPaperMode ? paperTotalBalance : isKalshiRoute ? (_z = liveBalanceState.kalshiBalance) != null ? _z : 0 : liveAvailableBalance;
23343
+ }, [isLimitOrder, selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue, selectedRouteCard, scopedSelectedMarket]);
23344
+ const displayedBalance = isPaperMode ? paperTotalBalance : isKalshiRoute ? (_A = liveBalanceState.kalshiBalance) != null ? _A : 0 : liveAvailableBalance;
23060
23345
  const legacyKalshiAccount = (0, import_react39.useMemo)(
23061
23346
  () => {
23062
23347
  var _a2;
@@ -23064,10 +23349,10 @@ var PlaceOrder = ({
23064
23349
  },
23065
23350
  [user == null ? void 0 : user.venueAccounts]
23066
23351
  );
23067
- const isKalshiAccountActive = (_A = kalshiKeyStatus == null ? void 0 : kalshiKeyStatus.connected) != null ? _A : (legacyKalshiAccount == null ? void 0 : legacyKalshiAccount.status) === "active";
23068
- const isKalshiVerified = ((_B = kalshiKeyStatus == null ? void 0 : kalshiKeyStatus.kycStatus) != null ? _B : legacyKalshiAccount == null ? void 0 : legacyKalshiAccount.kycStatus) === "verified";
23352
+ const isKalshiAccountActive = (_B = kalshiKeyStatus == null ? void 0 : kalshiKeyStatus.connected) != null ? _B : (legacyKalshiAccount == null ? void 0 : legacyKalshiAccount.status) === "active";
23353
+ const isKalshiVerified = ((_C = kalshiKeyStatus == null ? void 0 : kalshiKeyStatus.kycStatus) != null ? _C : legacyKalshiAccount == null ? void 0 : legacyKalshiAccount.kycStatus) === "verified";
23069
23354
  const hasKalshiConnectionState = kalshiKeyStatus !== void 0 || (user == null ? void 0 : user.venueAccounts) != null;
23070
- const isKalshiAvailable = (0, import_hooks63.getVenueAvailabilityState)({
23355
+ const isKalshiAvailable = (0, import_hooks64.getVenueAvailabilityState)({
23071
23356
  venueId: "kalshi",
23072
23357
  disabledVenues,
23073
23358
  isConfigLoading: isAppConfigLoading
@@ -23092,7 +23377,7 @@ var PlaceOrder = ({
23092
23377
  [aggClient, onConnectKalshi, refetchKalshiKeyStatus]
23093
23378
  );
23094
23379
  const needsKycVerification = isAuthenticated && hasKalshiConnectionState && isKalshiRoute && isKalshiAccountActive && !isKalshiVerified;
23095
- const verifyKalshiConnectionLabel = (_F = (_E = (_D = (_C = labels.onboarding) == null ? void 0 : _C.connectKalshiModal) == null ? void 0 : _D.actions) == null ? void 0 : _E.verifyConnection) != null ? _F : tradingLabels.kycRequired;
23380
+ const verifyKalshiConnectionLabel = (_G = (_F = (_E = (_D = labels.onboarding) == null ? void 0 : _D.connectKalshiModal) == null ? void 0 : _E.actions) == null ? void 0 : _F.verifyConnection) != null ? _G : tradingLabels.kycRequired;
23096
23381
  const handleRouteCardSelect = (0, import_react39.useCallback)(
23097
23382
  (cardId) => {
23098
23383
  if (cardId === resolvedSelectedRouteCardId) {
@@ -23106,16 +23391,16 @@ var PlaceOrder = ({
23106
23391
  },
23107
23392
  [resolvedSelectedRouteCardId, routeCards]
23108
23393
  );
23109
- const executionProgress = (0, import_hooks63.useExecutionProgress)({
23110
- orderIds: (_G = submissionProgressState == null ? void 0 : submissionProgressState.orderIds) != null ? _G : null,
23111
- quoteId: (_H = submissionProgressState == null ? void 0 : submissionProgressState.quoteId) != null ? _H : null,
23394
+ const executionProgress = (0, import_hooks64.useExecutionProgress)({
23395
+ orderIds: (_H = submissionProgressState == null ? void 0 : submissionProgressState.orderIds) != null ? _H : null,
23396
+ quoteId: (_I = submissionProgressState == null ? void 0 : submissionProgressState.quoteId) != null ? _I : null,
23112
23397
  mode: isPaperMode ? "paper" : void 0,
23113
- enabled: ((submissionProgressState == null ? void 0 : submissionProgressState.phase) === "submitting" || (submissionProgressState == null ? void 0 : submissionProgressState.phase) === "executing") && !!((_I = submissionProgressState == null ? void 0 : submissionProgressState.orderIds) == null ? void 0 : _I.length)
23398
+ enabled: ((submissionProgressState == null ? void 0 : submissionProgressState.phase) === "submitting" || (submissionProgressState == null ? void 0 : submissionProgressState.phase) === "executing") && !!((_J = submissionProgressState == null ? void 0 : submissionProgressState.orderIds) == null ? void 0 : _J.length)
23114
23399
  });
23115
- const selectedOutcomeLabel = (_L = (_K = (_J = outcomes.find((outcome) => outcome.id === scopedSelectedOutcomeId)) == null ? void 0 : _J.label) != null ? _K : scopedSelectedOutcome == null ? void 0 : scopedSelectedOutcome.label) != null ? _L : "";
23116
- const headerImage = (_N = (_M = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.image) != null ? _M : scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.image) != null ? _N : null;
23117
- const headerTitle = (_P = (_O = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.title) != null ? _O : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question) != null ? _P : "";
23118
- const headerSubtitle = (_Q = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question) != null ? _Q : "";
23400
+ const selectedOutcomeLabel = (_M = (_L = (_K = outcomes.find((outcome) => outcome.id === scopedSelectedOutcomeId)) == null ? void 0 : _K.label) != null ? _L : scopedSelectedOutcome == null ? void 0 : scopedSelectedOutcome.label) != null ? _M : "";
23401
+ const headerImage = (_O = (_N = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.image) != null ? _N : scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.image) != null ? _O : null;
23402
+ const headerTitle = (_Q = (_P = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.title) != null ? _P : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question) != null ? _Q : "";
23403
+ const headerSubtitle = (_R = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question) != null ? _R : "";
23119
23404
  const buildExecutionSummary = (0, import_react39.useCallback)(
23120
23405
  (quoteData, executionVenue, orderId, partialFillSummary) => {
23121
23406
  var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
@@ -23381,8 +23666,8 @@ var PlaceOrder = ({
23381
23666
  }
23382
23667
  if (submissionProgressState.phase === "success" && submissionProgressState.summary) {
23383
23668
  emitTerminalOrderNotifications();
23384
- (0, import_hooks63.invalidateBalanceQueries)(queryClient);
23385
- (0, import_hooks63.invalidatePositionQueries)(queryClient);
23669
+ (0, import_hooks64.invalidateBalanceQueries)(queryClient);
23670
+ (0, import_hooks64.invalidatePositionQueries)(queryClient);
23386
23671
  if (debugStore && debugAttemptId) {
23387
23672
  debugStore.updateAttempt(debugAttemptId, {
23388
23673
  status: "succeeded",
@@ -23413,19 +23698,19 @@ var PlaceOrder = ({
23413
23698
  queryClient,
23414
23699
  submissionProgressState
23415
23700
  ]);
23416
- const activeQuoteData = (_S = (_R = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData) != null ? _R : smartRoute.data) != null ? _S : null;
23417
- const visibleRouteCards = orderedRouteCards.length > PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT && !isRoutesExpanded ? orderedRouteCards.slice(0, PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT) : orderedRouteCards;
23701
+ const activeQuoteData = isLimitOrder ? null : (_T = (_S = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData) != null ? _S : smartRoute.data) != null ? _T : null;
23702
+ const visibleMarketRouteCards = orderedRouteCards.length > PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT && !isRoutesExpanded ? orderedRouteCards.slice(0, PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT) : orderedRouteCards;
23418
23703
  const hasEnteredAmount = internalAmount > 0;
23419
23704
  const isQuoteLoading = !isLimitOrder && hasEnteredAmount && (smartRoute.isFetching || smartRoute.isLoading || isSell && (venueSellQuotes.isFetching || venueSellQuotes.isLoading));
23420
23705
  const routeLoadingMessage = isQuoteLoading ? smartRoute.loadingReason === "updating-route" ? tradingLabels.updatingRoute : smartRoute.loadingReason === "refreshing-quotes" ? tradingLabels.refreshingQuotes : tradingLabels.findingBestOdds : null;
23421
- const selectedRouteFills = (_T = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData.fills) != null ? _T : [];
23706
+ const selectedRouteFills = (_U = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData.fills) != null ? _U : [];
23422
23707
  const isKalshiOnlyRoute = isKalshiRoute && ((selectedRouteCard == null ? void 0 : selectedRouteCard.venue) === import_sdk23.Venue.kalshi || selectedRouteFills.length > 0 && selectedRouteFills.every((fill) => fill.venue === import_sdk23.Venue.kalshi));
23423
23708
  const isOnchainOnlyRoute = !isKalshiRoute || selectedRouteFills.length > 0 && selectedRouteFills.every((fill) => fill.venue !== import_sdk23.Venue.kalshi);
23424
23709
  const kalshiRequiredAmount = isSell ? 0 : selectedRouteFills.filter((fill) => fill.venue === import_sdk23.Venue.kalshi).reduce((total, fill) => total + fill.venueQty * fill.avgPrice, 0);
23425
23710
  const onchainRequiredAmount = isSell ? 0 : selectedRouteFills.filter((fill) => fill.venue !== import_sdk23.Venue.kalshi).reduce((total, fill) => total + fill.venueQty * fill.avgPrice, 0);
23426
23711
  const resolvedKalshiRequiredAmount = isKalshiOnlyRoute || isKalshiRoute && selectedRouteFills.length === 0 ? internalAmount : kalshiRequiredAmount;
23427
23712
  const resolvedOnchainRequiredAmount = isOnchainOnlyRoute || !isKalshiRoute && selectedRouteFills.length === 0 ? internalAmount : onchainRequiredAmount;
23428
- const isKalshiBalanceInsufficient = !isPaperMode && isKalshiRoute && resolvedKalshiRequiredAmount > ((_U = liveBalanceState.kalshiBalance) != null ? _U : 0);
23713
+ const isKalshiBalanceInsufficient = !isPaperMode && isKalshiRoute && resolvedKalshiRequiredAmount > ((_V = liveBalanceState.kalshiBalance) != null ? _V : 0);
23429
23714
  const isOnchainBalanceInsufficient = resolvedOnchainRequiredAmount > liveAvailableBalance;
23430
23715
  const isInsufficientBalance = !isSell && isAuthenticated && hasEnteredAmount && !isBalanceLoading && (isLimitOrder ? internalAmount > totalBalance : isPaperMode ? internalAmount > paperTotalBalance : isKalshiBalanceInsufficient || isOnchainBalanceInsufficient);
23431
23716
  const isQuoteInsufficientBalance = !isLimitOrder && (activeQuoteData == null ? void 0 : activeQuoteData.status) === "insufficient_balance";
@@ -23519,9 +23804,9 @@ var PlaceOrder = ({
23519
23804
  }
23520
23805
  return (_d2 = selectedRouteCard.hint) != null ? _d2 : "";
23521
23806
  }, [selectedRouteCard, tradingLabels]);
23522
- const displayedToWinValue = (_V = selectedRouteCard == null ? void 0 : selectedRouteCard.numericValue) != null ? _V : 0;
23807
+ const displayedToWinValue = (_W = selectedRouteCard == null ? void 0 : selectedRouteCard.numericValue) != null ? _W : 0;
23523
23808
  const limitOrderPayload = (0, import_react39.useMemo)(() => {
23524
- if (!scopedSelectedMarket || !scopedSelectedOutcomeId || internalAmount <= 0) return null;
23809
+ if (!selectedLimitVenueOption || internalAmount <= 0) return null;
23525
23810
  if (limitPriceInputError) return null;
23526
23811
  const expirationDate = resolveLimitExpirationDate({
23527
23812
  expirationType: limitExpirationType,
@@ -23537,8 +23822,8 @@ var PlaceOrder = ({
23537
23822
  });
23538
23823
  const expiresAt = expirationDate ? serializeLimitOrderExpiration(expirationDate) : void 0;
23539
23824
  return __spreadValues({
23540
- venue: scopedSelectedMarket.venue,
23541
- venueMarketOutcomeId: scopedSelectedOutcomeId,
23825
+ venue: selectedLimitVenueOption.venue,
23826
+ venueMarketOutcomeId: selectedLimitVenueOption.venueMarketOutcomeId,
23542
23827
  side: internalTab,
23543
23828
  limitPriceRaw,
23544
23829
  sizeRaw,
@@ -23552,8 +23837,7 @@ var PlaceOrder = ({
23552
23837
  limitExpirationType,
23553
23838
  limitPrice,
23554
23839
  limitPriceInputError,
23555
- scopedSelectedMarket,
23556
- scopedSelectedOutcomeId
23840
+ selectedLimitVenueOption
23557
23841
  ]);
23558
23842
  const resolvedLimitExpirationDraftDate = (0, import_react39.useMemo)(() => {
23559
23843
  return resolveLimitExpirationDate({
@@ -23596,11 +23880,70 @@ var PlaceOrder = ({
23596
23880
  )
23597
23881
  ) / Number(LIMIT_ORDER_RAW_SCALE);
23598
23882
  }, [internalTab, limitOrderPayload]);
23883
+ const limitRouteCards = (0, import_react39.useMemo)(() => {
23884
+ return visibleLimitVenueOptions.map((option) => {
23885
+ var _a2, _b2;
23886
+ const availabilityState = (0, import_hooks64.getVenueAvailabilityState)({
23887
+ venueId: option.venue,
23888
+ disabledVenues,
23889
+ isConfigLoading: isAppConfigLoading
23890
+ });
23891
+ const isGeoBlocked = geoBlockedLimitVenues.has(option.venue);
23892
+ const isUnavailable = isTradingBlocked || isGeoBlocked || availabilityState !== "available";
23893
+ const currentPriceLabel = option.currentPrice == null ? "\u2014" : formatProbabilityCents(option.currentPrice, formatPrice);
23894
+ const totalFees = getSmartRouteTotalFees(
23895
+ (_b2 = (_a2 = limitVenueQuoteByVenue.get(option.venue)) == null ? void 0 : _a2.data) == null ? void 0 : _b2.feeBreakdown
23896
+ );
23897
+ const feeLabel = totalFees == null ? void 0 : formatUsd(totalFees, { minimumFractionDigits: 2, maximumFractionDigits: 2 });
23898
+ return {
23899
+ id: `limit-venue-${option.venue}-${option.venueMarketOutcomeId}`,
23900
+ hint: isGeoBlocked ? tradingLabels.venueUnavailableInRegion : tradingLabels.limitRoutingCurrentPrice(currentPriceLabel, feeLabel),
23901
+ isUnavailable,
23902
+ kind: "venue",
23903
+ label: getTradingVenueLabel(option.venue),
23904
+ numericValue: displayedLimitToWinValue,
23905
+ value: formatUsd(displayedLimitToWinValue, {
23906
+ maximumFractionDigits: 2,
23907
+ minimumFractionDigits: 2
23908
+ }),
23909
+ venue: option.venue
23910
+ };
23911
+ });
23912
+ }, [
23913
+ disabledVenues,
23914
+ displayedLimitToWinValue,
23915
+ formatPrice,
23916
+ geoBlockedLimitVenues,
23917
+ isAppConfigLoading,
23918
+ isTradingBlocked,
23919
+ limitVenueQuoteByVenue,
23920
+ tradingLabels,
23921
+ visibleLimitVenueOptions
23922
+ ]);
23923
+ const limitVenueOptionByCardId = (0, import_react39.useMemo)(() => {
23924
+ return new Map(
23925
+ visibleLimitVenueOptions.map((option) => [
23926
+ `limit-venue-${option.venue}-${option.venueMarketOutcomeId}`,
23927
+ option
23928
+ ])
23929
+ );
23930
+ }, [visibleLimitVenueOptions]);
23931
+ const activeRouteCards = isLimitOrder ? limitRouteCards : visibleMarketRouteCards;
23932
+ const activeRouteCardCount = isLimitOrder ? limitRouteCards.length : orderedRouteCards.length;
23933
+ const handleActiveRouteCardSelect = (cardId) => {
23934
+ if (!isLimitOrder) {
23935
+ handleRouteCardSelect(cardId);
23936
+ return;
23937
+ }
23938
+ const option = limitVenueOptionByCardId.get(cardId);
23939
+ if (!option) return;
23940
+ setSelectedLimitVenue(option.venue);
23941
+ };
23599
23942
  const displayedLimitToWinHint = formatLimitPriceLabel(limitPrice);
23600
23943
  const activeFeeBreakdown = activeQuoteData == null ? void 0 : activeQuoteData.feeBreakdown;
23601
23944
  const estimatedFeesValue = (0, import_react39.useMemo)(() => {
23602
- if (!activeFeeBreakdown) return null;
23603
- const totalFees = activeFeeBreakdown.venueFees + activeFeeBreakdown.bridgeFees + activeFeeBreakdown.executionGas;
23945
+ const totalFees = getSmartRouteTotalFees(activeFeeBreakdown);
23946
+ if (totalFees == null) return null;
23604
23947
  return formatUsd(totalFees, { minimumFractionDigits: 2, maximumFractionDigits: 2 });
23605
23948
  }, [activeFeeBreakdown]);
23606
23949
  const feeBreakdownRows = (0, import_react39.useMemo)(() => {
@@ -23638,13 +23981,15 @@ var PlaceOrder = ({
23638
23981
  ];
23639
23982
  }, [activeFeeBreakdown, tradingLabels]);
23640
23983
  const isActionLoading = isPrimaryActionLoading || executeManaged.isPending || placeLimitOrder.isPending || isBeforeActionPending;
23641
- const selectedRouteGeoBlocked = (_W = selectedRouteCard == null ? void 0 : selectedRouteCard.isUnavailable) != null ? _W : false;
23984
+ const selectedLimitRouteCardId = selectedLimitVenueOption ? `limit-venue-${selectedLimitVenueOption.venue}-${selectedLimitVenueOption.venueMarketOutcomeId}` : null;
23985
+ const selectedLimitRouteCard = selectedLimitRouteCardId ? (_X = limitRouteCards.find((card) => card.id === selectedLimitRouteCardId)) != null ? _X : null : null;
23986
+ const selectedRouteGeoBlocked = isLimitOrder ? (_Y = selectedLimitRouteCard == null ? void 0 : selectedLimitRouteCard.isUnavailable) != null ? _Y : false : (_Z = selectedRouteCard == null ? void 0 : selectedRouteCard.isUnavailable) != null ? _Z : false;
23642
23987
  const geoBlockedVenuesFromWarnings = (0, import_react39.useMemo)(
23643
23988
  () => {
23644
23989
  var _a2;
23645
23990
  return extractGeoBlockedVenues((_a2 = smartRoute.data) == null ? void 0 : _a2.warnings);
23646
23991
  },
23647
- [(_X = smartRoute.data) == null ? void 0 : _X.warnings]
23992
+ [(__ = smartRoute.data) == null ? void 0 : __.warnings]
23648
23993
  );
23649
23994
  const isPrimaryVenueGeoBlocked = (0, import_react39.useMemo)(() => {
23650
23995
  var _a2, _b2;
@@ -23652,12 +23997,12 @@ var PlaceOrder = ({
23652
23997
  const fills = (_b2 = (_a2 = selectedRouteCard.quoteData) == null ? void 0 : _a2.fills) != null ? _b2 : [];
23653
23998
  return fills.length > 0 && fills.every((f) => geoBlockedVenuesFromWarnings.has(f.venue));
23654
23999
  }, [selectedRouteCard, geoBlockedVenuesFromWarnings]);
23655
- const shouldShowGeoBlockBanner = isTradingBlocked || selectedRouteGeoBlocked || isPrimaryVenueGeoBlocked;
24000
+ const shouldShowGeoBlockBanner = isTradingBlocked || selectedRouteGeoBlocked || isPrimaryVenueGeoBlocked || isLimitOrder && limitRouteCards.length > 0 && limitRouteCards.every((card) => card.isUnavailable);
23656
24001
  const shouldShowLowLiquidityWarning = !isQuoteInputEditing && !isQuoteLoading && (activeQuoteData == null ? void 0 : activeQuoteData.venueMarketOutcomeId) === scopedSelectedOutcomeId && hasLowLiquidityWarning(activeQuoteData.warnings);
23657
24002
  const actionLabel = `${internalTab === "buy" ? tradingLabels.buy : tradingLabels.sell} ${selectedOutcomeLabel}`.trim();
23658
24003
  const isActionDisabled = isPrimaryActionDisabled || !orderEligibility.canPlaceOrder || isActionLoading || !hasEnteredAmount || !scopedSelectedMarket || isInsufficientBalance || isQuoteInsufficientBalance || isSell && isQuoteInputEditing || isSellAmountAboveAvailability || isBelowMinimum || !isLimitOrder && isQuoteLoading || (isLimitOrder ? !limitOrderPayload : !selectedRouteCard || !selectedRouteCard.quoteData.quoteId) || selectedRouteGeoBlocked || !isAuthenticated || !isLimitOrder && quoteStatus !== void 0;
23659
- const shouldShowSmartRouting = !isLimitOrder && orderEligibility.canPlaceOrder && hasEnteredAmount && !isBelowMinimum && (orderedRouteCards.length > 0 || smartRoute.isFetching || smartRoute.isLoading || isSell && (venueSellQuotes.isFetching || venueSellQuotes.isLoading));
23660
- const shouldShowRouteToggle = !isQuoteLoading && orderedRouteCards.length > PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT;
24004
+ const shouldShowSmartRouting = orderEligibility.canPlaceOrder && hasEnteredAmount && !isBelowMinimum && (isLimitOrder ? limitRouteCards.length > 0 : orderedRouteCards.length > 0 || smartRoute.isFetching || smartRoute.isLoading || isSell && (venueSellQuotes.isFetching || venueSellQuotes.isLoading));
24005
+ const shouldShowRouteToggle = !isLimitOrder && !isQuoteLoading && orderedRouteCards.length > PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT;
23661
24006
  const handleReturnToOrderForm = (0, import_react39.useCallback)(() => {
23662
24007
  const submittedSelection = submittedSelectionRef.current;
23663
24008
  submittedSelectionRef.current = null;
@@ -24302,7 +24647,7 @@ var PlaceOrder = ({
24302
24647
  PlaceOrderResolvedView,
24303
24648
  {
24304
24649
  tradingState: resolvedReadOnlyTradingState,
24305
- resolutionTimestamp: (_Y = resolvedEventTradingState.resolvesAt) != null ? _Y : resolvedReadOnlyTradingState.resolvesAt,
24650
+ resolutionTimestamp: (_$ = resolvedEventTradingState.resolvesAt) != null ? _$ : resolvedReadOnlyTradingState.resolvesAt,
24306
24651
  resolvedClaim,
24307
24652
  classNames,
24308
24653
  className,
@@ -24385,261 +24730,228 @@ var PlaceOrder = ({
24385
24730
  tabItem.value
24386
24731
  );
24387
24732
  }) }),
24388
- showLimitOrders ? /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)(
24389
- DropdownMenu2.Root,
24733
+ showLimitOrders ? /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
24734
+ Select,
24390
24735
  {
24391
- open: isExecutionTypeMenuOpen,
24392
- onOpenChange: setIsExecutionTypeMenuOpen,
24393
- children: [
24394
- /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(DropdownMenu2.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)(
24395
- "button",
24396
- {
24397
- ref: executionTypeTriggerRef,
24398
- type: "button",
24399
- className: cn(
24400
- "agg-order-type-trigger mb-2 flex cursor-pointer items-center gap-2 rounded-agg-sm px-2 py-1 text-agg-base leading-agg-6 text-agg-foreground",
24401
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-0 focus-visible:ring-offset-agg-secondary"
24402
- ),
24403
- "aria-label": tradingLabels.orderTypeAria,
24404
- children: [
24405
- /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("span", { children: isLimitOrder ? tradingLabels.orderTypeLimit : tradingLabels.orderTypeMarket }),
24406
- /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(Icon, { name: "chevron-down", size: "small", className: "h-4 w-4", "aria-hidden": true })
24407
- ]
24408
- }
24409
- ) }),
24410
- /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
24411
- DropdownMenu2.Portal,
24412
- {
24413
- container: resolvePlaceOrderPortalContainer(executionTypeTriggerRef.current),
24414
- children: /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
24415
- DropdownMenu2.Content,
24416
- {
24417
- align: "end",
24418
- sideOffset: 8,
24419
- className: "z-50 min-w-[140px] rounded-agg-lg border border-agg-separator bg-agg-secondary p-1 shadow-[0_8px_16px_rgba(0,0,0,0.12)]",
24420
- children: [
24421
- { value: "market", label: tradingLabels.orderTypeMarket },
24422
- { value: "limit", label: tradingLabels.orderTypeLimit }
24423
- ].map((item) => /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
24424
- DropdownMenu2.Item,
24425
- {
24426
- className: cn(
24427
- "cursor-pointer rounded-agg-sm px-3 py-2 text-agg-sm leading-agg-5 text-agg-foreground outline-none hover:bg-agg-secondary-hover focus:bg-agg-secondary-hover",
24428
- executionType === item.value && "font-agg-bold text-agg-primary"
24429
- ),
24430
- onSelect: () => handleExecutionTypeChange(item.value),
24431
- children: item.label
24432
- },
24433
- item.value
24434
- ))
24435
- }
24436
- )
24437
- }
24438
- )
24439
- ]
24736
+ ariaLabel: tradingLabels.orderTypeAria,
24737
+ className: "mb-2",
24738
+ triggerClassName: "agg-order-type-trigger",
24739
+ items: [
24740
+ { value: "market", label: tradingLabels.orderTypeMarket },
24741
+ { value: "limit", label: tradingLabels.orderTypeLimit }
24742
+ ],
24743
+ value: executionType,
24744
+ onChange: handleExecutionTypeChange,
24745
+ variant: "inline",
24746
+ openOnHover: true,
24747
+ contentAlign: "end",
24748
+ contentSideOffset: 4
24440
24749
  }
24441
24750
  ) : null
24442
24751
  ]
24443
24752
  }
24444
24753
  ),
24445
- outcomes.length >= 2 ? /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("div", { className: "agg-outcomes flex w-full max-w-full gap-2", children: outcomes.map((outcome, index) => {
24446
- var _a2, _b2, _c2;
24447
- const price = getDisplayOutcomePrice({
24448
- outcomeId: outcome.id,
24449
- outcomeLabel: outcome.label,
24450
- selection: (_a2 = tradingContext == null ? void 0 : tradingContext.tradeSide) != null ? _a2 : isSell ? "sell" : "buy",
24451
- bestPrices: clusterBestPrices,
24452
- bestMidpoint: clusterBestMidpoint,
24453
- bestMidpointsByOutcomeId: clusterBestMidpointsByOutcomeId,
24454
- livePrices
24455
- });
24456
- const isActive = outcome.id === scopedSelectedOutcomeId;
24457
- const isPositive = resolveIsPositiveOutcome(outcome, index);
24458
- const isPriceLoading = clusterMidpointResult.isLoading && price == null;
24459
- return /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)(
24460
- "button",
24461
- {
24462
- "data-id": outcome.id,
24463
- type: "button",
24464
- className: cn(
24465
- "agg-outcome-button",
24466
- getOutcomeButtonClassName({
24467
- enableAnimations,
24468
- isActive,
24469
- isPositive
24470
- }),
24471
- "disabled:cursor-not-allowed disabled:opacity-60",
24472
- "leading-agg-5! flex-1 min-w-0 gap-1 md:gap-2"
24473
- ),
24474
- "aria-pressed": isActive,
24475
- "aria-label": `${(_b2 = outcome.title) != null ? _b2 : outcome.label} ${formatProbabilityCents(price)}`,
24476
- disabled: !orderEligibility.canPlaceOrder || isResolvedOutcomeCtaLocked,
24477
- onClick: () => handleOutcomeChange(outcome.id),
24478
- children: [
24479
- /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
24480
- Typography,
24481
- {
24482
- as: "span",
24483
- variant: isActive ? "body-strong" : "body",
24484
- className: cn("whitespace-nowrap truncate"),
24485
- children: (_c2 = outcome.title) != null ? _c2 : outcome.label
24486
- }
24754
+ /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("div", { className: "agg-order-entry-section flex flex-col gap-4", children: [
24755
+ outcomes.length >= 2 ? /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("div", { className: "agg-outcomes flex w-full max-w-full gap-2", children: outcomes.map((outcome, index) => {
24756
+ var _a2, _b2, _c2;
24757
+ const price = getDisplayOutcomePrice({
24758
+ outcomeId: outcome.id,
24759
+ outcomeLabel: outcome.label,
24760
+ selection: (_a2 = tradingContext == null ? void 0 : tradingContext.tradeSide) != null ? _a2 : isSell ? "sell" : "buy",
24761
+ bestPrices: clusterBestPrices,
24762
+ bestMidpoint: clusterBestMidpoint,
24763
+ bestMidpointsByOutcomeId: clusterBestMidpointsByOutcomeId,
24764
+ livePrices
24765
+ });
24766
+ const isActive = outcome.id === scopedSelectedOutcomeId;
24767
+ const isPositive = resolveIsPositiveOutcome(outcome, index);
24768
+ const isPriceLoading = clusterMidpointResult.isLoading && price == null;
24769
+ return /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)(
24770
+ "button",
24771
+ {
24772
+ "data-id": outcome.id,
24773
+ type: "button",
24774
+ className: cn(
24775
+ "agg-outcome-button",
24776
+ getOutcomeButtonClassName({
24777
+ enableAnimations,
24778
+ isActive,
24779
+ isPositive
24780
+ }),
24781
+ "disabled:cursor-not-allowed disabled:opacity-60",
24782
+ "leading-agg-5! flex-1 min-w-0 gap-1 md:gap-2"
24487
24783
  ),
24488
- isPriceLoading ? /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
24489
- "span",
24490
- {
24491
- "aria-hidden": "true",
24492
- className: cn(
24493
- "agg-place-order-outcome-price-loading",
24494
- "h-4 w-10 shrink-0 rounded-agg-sm bg-agg-separator animate-pulse"
24495
- )
24496
- }
24497
- ) : /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(Typography, { as: "span", variant: isActive ? "body-strong" : "body", children: formatProbabilityCents(price) })
24498
- ]
24499
- },
24500
- outcome.id
24501
- );
24502
- }) }) : null,
24503
- isLimitOrder ? /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("div", { className: "agg-limit-price-section flex items-center justify-between gap-4", children: [
24504
- /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.limitPrice }),
24505
- /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("div", { className: "flex min-w-0 flex-col items-end gap-1", children: [
24506
- /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("div", { className: "flex items-center gap-2", children: [
24507
- /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("label", { className: "relative flex items-center", children: [
24508
- /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
24509
- "input",
24510
- {
24511
- type: "text",
24512
- inputMode: "decimal",
24513
- "aria-label": tradingLabels.limitPriceInputAria,
24514
- "aria-invalid": Boolean(limitPriceInputError),
24515
- value: limitPriceInputValue,
24516
- onChange: handleLimitPriceInputChange,
24517
- onBlur: handleLimitPriceInputBlur,
24518
- className: cn(
24519
- "h-9 w-[108px] rounded-agg-sm bg-transparent pr-5 text-right text-agg-3xl font-agg-bold leading-agg-9 text-agg-foreground outline-none",
24520
- "focus-visible:ring-2 focus-visible:ring-agg-primary",
24521
- limitPriceInputError && "text-agg-error focus-visible:ring-agg-error"
24522
- )
24784
+ "aria-pressed": isActive,
24785
+ "aria-label": `${(_b2 = outcome.title) != null ? _b2 : outcome.label} ${formatProbabilityCents(price, formatPrice)}`,
24786
+ disabled: !orderEligibility.canPlaceOrder || isResolvedOutcomeCtaLocked,
24787
+ onClick: () => handleOutcomeChange(outcome.id),
24788
+ children: [
24789
+ /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
24790
+ Typography,
24791
+ {
24792
+ as: "span",
24793
+ variant: isActive ? "body-strong" : "body",
24794
+ className: cn("whitespace-nowrap truncate"),
24795
+ children: (_c2 = outcome.title) != null ? _c2 : outcome.label
24796
+ }
24797
+ ),
24798
+ isPriceLoading ? /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
24799
+ "span",
24800
+ {
24801
+ "aria-hidden": "true",
24802
+ className: cn(
24803
+ "agg-place-order-outcome-price-loading",
24804
+ "h-4 w-10 shrink-0 rounded-agg-sm bg-agg-separator animate-pulse"
24805
+ )
24806
+ }
24807
+ ) : /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(Typography, { as: "span", variant: isActive ? "body-strong" : "body", children: formatProbabilityCents(price, formatPrice) })
24808
+ ]
24809
+ },
24810
+ outcome.id
24811
+ );
24812
+ }) }) : null,
24813
+ isLimitOrder ? /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("div", { className: "agg-limit-price-section flex items-center justify-between gap-4", children: [
24814
+ /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.limitPrice }),
24815
+ /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("div", { className: "flex min-w-0 flex-col items-end gap-1", children: [
24816
+ /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("div", { className: "flex items-center gap-2", children: [
24817
+ /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("label", { className: "relative flex items-center", children: [
24818
+ /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
24819
+ "input",
24820
+ {
24821
+ type: "text",
24822
+ inputMode: "decimal",
24823
+ "aria-label": tradingLabels.limitPriceInputAria,
24824
+ "aria-invalid": Boolean(limitPriceInputError),
24825
+ value: limitPriceInputValue,
24826
+ onChange: handleLimitPriceInputChange,
24827
+ onBlur: handleLimitPriceInputBlur,
24828
+ className: cn(
24829
+ PLACE_ORDER_NUMERIC_INPUT_CLASS_NAME,
24830
+ "h-9 w-[108px] pr-5",
24831
+ limitPriceInputError && "text-agg-error focus-visible:text-agg-error"
24832
+ )
24833
+ }
24834
+ ),
24835
+ /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("span", { className: "pointer-events-none absolute right-1 text-agg-3xl font-agg-bold leading-agg-9 text-agg-foreground", children: "\xA2" })
24836
+ ] }),
24837
+ /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
24838
+ "button",
24839
+ {
24840
+ type: "button",
24841
+ className: "flex size-8 cursor-pointer items-center justify-center rounded-agg-lg bg-agg-secondary-hover text-agg-foreground hover:bg-agg-tertiary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary",
24842
+ "aria-label": tradingLabels.limitPriceDecreaseAria,
24843
+ onClick: () => handleLimitPriceStep("decrease"),
24844
+ children: /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(Icon, { name: "minus", size: "small", className: "h-4 w-4", "aria-hidden": true })
24523
24845
  }
24524
24846
  ),
24525
- /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("span", { className: "pointer-events-none absolute right-1 text-agg-3xl font-agg-bold leading-agg-9 text-agg-foreground", children: "\xA2" })
24847
+ /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
24848
+ "button",
24849
+ {
24850
+ type: "button",
24851
+ className: "flex size-8 cursor-pointer items-center justify-center rounded-agg-lg bg-agg-secondary-hover text-agg-foreground hover:bg-agg-tertiary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary",
24852
+ "aria-label": tradingLabels.limitPriceIncreaseAria,
24853
+ onClick: () => handleLimitPriceStep("increase"),
24854
+ children: /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(Icon, { name: "plus", size: "small", className: "h-4 w-4", "aria-hidden": true })
24855
+ }
24856
+ )
24526
24857
  ] }),
24527
- /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
24528
- "button",
24529
- {
24530
- type: "button",
24531
- className: "flex size-8 cursor-pointer items-center justify-center rounded-agg-lg bg-agg-secondary-hover text-agg-foreground hover:bg-agg-tertiary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary",
24532
- "aria-label": tradingLabels.limitPriceDecreaseAria,
24533
- onClick: () => handleLimitPriceStep("decrease"),
24534
- children: /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(Icon, { name: "minus", size: "small", className: "h-4 w-4", "aria-hidden": true })
24858
+ limitPriceInputError ? /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("p", { className: "max-w-[220px] text-right text-agg-xs leading-agg-4 text-agg-error", children: limitPriceInputError }) : null
24859
+ ] })
24860
+ ] }) : null,
24861
+ /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("div", { className: "agg-order-amount-section flex items-start justify-between gap-4", children: [
24862
+ /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("div", { className: "agg-order-amount-meta flex flex-col", children: [
24863
+ /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("p", { className: "agg-order-amount-label text-agg-base font-agg-bold leading-agg-6 text-agg-foreground whitespace-nowrap", children: tradingLabels.amount(internalTab) }),
24864
+ isAuthenticated ? isSell ? /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("div", { className: "agg-balance-value flex items-baseline gap-1.5 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: isCurrentSellableSharesLoading ? /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(LoadingIcon, { size: "small" }) : /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)(import_jsx_runtime166.Fragment, { children: [
24865
+ /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("span", { className: "whitespace-pre", children: displayedCurrentSellableSharesLabel }),
24866
+ displayedCurrentSellableShares > 0 ? /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
24867
+ "button",
24868
+ {
24869
+ type: "button",
24870
+ className: cn(
24871
+ "agg-max-shares-button",
24872
+ "cursor-pointer disabled:cursor-not-allowed",
24873
+ "bg-transparent p-0 text-agg-sm font-agg-bold leading-agg-5 text-agg-primary disabled:text-agg-muted-foreground",
24874
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-0 focus-visible:ring-offset-agg-secondary"
24875
+ ),
24876
+ "aria-label": tradingLabels.maxShares,
24877
+ disabled: !orderEligibility.canPlaceOrder || isAtMaxSellableShares,
24878
+ onClick: handleFillSellableShares,
24879
+ children: tradingLabels.maxShares
24880
+ }
24881
+ ) : null
24882
+ ] }) }) : /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("p", { className: "agg-balance-value flex items-center gap-2 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: isBalanceLoading ? /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(LoadingIcon, { size: "small" }) : tradingLabels.balance(formatUsd(displayedBalance)) }) : null
24883
+ ] }),
24884
+ /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
24885
+ CurrencyInput,
24886
+ {
24887
+ value: internalAmount,
24888
+ onChange: handleAmountChange,
24889
+ ariaLabel: tradingLabels.amount(internalTab),
24890
+ max: isLimitOrder && !isSell && isAuthenticated && !isBalanceLoading ? totalBalance : void 0,
24891
+ isInvalid: isInsufficientBalance || isBelowMinimum,
24892
+ disabled: !orderEligibility.canPlaceOrder,
24893
+ prefix: internalTab === "buy" ? "$" : "",
24894
+ decimalPlaces: isSell ? SELL_SHARE_INPUT_DECIMALS : 2,
24895
+ classNames: {
24896
+ input: cn(
24897
+ "agg-order-amount-input",
24898
+ PLACE_ORDER_NUMERIC_INPUT_CLASS_NAME,
24899
+ "w-full max-w-[168px]",
24900
+ hasEnteredAmount ? "text-agg-foreground" : "text-agg-separator caret-agg-foreground"
24901
+ )
24535
24902
  }
24536
- ),
24903
+ }
24904
+ )
24905
+ ] }),
24906
+ showFeesBreakdown && hasEnteredAmount && !isBelowMinimum && estimatedFeesValue ? /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("div", { className: "agg-order-fees-section flex items-center justify-between gap-4", children: [
24907
+ /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("div", { className: "flex items-center gap-1.5", children: [
24537
24908
  /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
24538
- "button",
24909
+ Typography,
24539
24910
  {
24540
- type: "button",
24541
- className: "flex size-8 cursor-pointer items-center justify-center rounded-agg-lg bg-agg-secondary-hover text-agg-foreground hover:bg-agg-tertiary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary",
24542
- "aria-label": tradingLabels.limitPriceIncreaseAria,
24543
- onClick: () => handleLimitPriceStep("increase"),
24544
- children: /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(Icon, { name: "plus", size: "small", className: "h-4 w-4", "aria-hidden": true })
24911
+ variant: "text-sm",
24912
+ className: "text-agg-sm leading-agg-5 text-agg-muted-foreground",
24913
+ children: tradingLabels.estimatedFees
24545
24914
  }
24546
- )
24547
- ] }),
24548
- limitPriceInputError ? /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("p", { className: "max-w-[220px] text-right text-agg-xs leading-agg-4 text-agg-error", children: limitPriceInputError }) : null
24549
- ] })
24550
- ] }) : null,
24551
- /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("div", { className: "agg-order-amount-section flex items-start justify-between gap-4", children: [
24552
- /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("div", { className: "agg-order-amount-meta flex flex-col", children: [
24553
- /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("p", { className: "agg-order-amount-label text-agg-base font-agg-bold leading-agg-6 text-agg-foreground whitespace-nowrap", children: tradingLabels.amount(internalTab) }),
24554
- isAuthenticated ? isSell ? /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("div", { className: "agg-balance-value flex items-baseline gap-1.5 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: isCurrentSellableSharesLoading ? /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(LoadingIcon, { size: "small" }) : /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)(import_jsx_runtime166.Fragment, { children: [
24555
- /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("span", { className: "whitespace-pre", children: displayedCurrentSellableSharesLabel }),
24556
- displayedCurrentSellableShares > 0 ? /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
24557
- "button",
24915
+ ),
24916
+ feeBreakdownRows.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
24917
+ Tooltip,
24558
24918
  {
24559
- type: "button",
24560
- className: cn(
24561
- "agg-max-shares-button",
24562
- "cursor-pointer disabled:cursor-not-allowed",
24563
- "bg-transparent p-0 text-agg-sm font-agg-bold leading-agg-5 text-agg-primary disabled:text-agg-muted-foreground",
24564
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-0 focus-visible:ring-offset-agg-secondary"
24565
- ),
24566
- "aria-label": tradingLabels.maxShares,
24567
- disabled: !orderEligibility.canPlaceOrder || isAtMaxSellableShares,
24568
- onClick: handleFillSellableShares,
24569
- children: tradingLabels.maxShares
24919
+ "aria-label": tradingLabels.estimatedFeesTooltipAria,
24920
+ classNames: {
24921
+ content: cn(
24922
+ "min-w-[220px] max-w-[320px] rounded-[10px] px-5 py-4",
24923
+ "shadow-[0_12px_12px_rgba(0,0,0,0.10)]"
24924
+ ),
24925
+ icon: "h-3 w-3 text-agg-muted-foreground",
24926
+ trigger: "h-3 w-3 text-agg-muted-foreground"
24927
+ },
24928
+ content: /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("div", { className: "flex w-full flex-col gap-2", children: feeBreakdownRows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)(
24929
+ "div",
24930
+ {
24931
+ className: "flex items-center justify-between gap-3 text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground",
24932
+ children: [
24933
+ /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("span", { children: row.label }),
24934
+ row.kind === "badge" ? /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
24935
+ "span",
24936
+ {
24937
+ className: cn(
24938
+ "agg-fee-badge inline-flex items-center justify-center rounded-agg-sm border border-agg-primary/50",
24939
+ "bg-linear-to-b from-agg-primary/8 to-agg-primary/15 px-1.5 py-1",
24940
+ "text-agg-xs font-agg-bold leading-agg-4 text-agg-primary uppercase whitespace-nowrap"
24941
+ ),
24942
+ children: row.badgeLabel
24943
+ }
24944
+ ) : /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("span", { className: "text-right", children: row.value })
24945
+ ]
24946
+ },
24947
+ row.label
24948
+ )) })
24570
24949
  }
24571
24950
  ) : null
24572
- ] }) }) : /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("p", { className: "agg-balance-value flex items-center gap-2 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: isBalanceLoading ? /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(LoadingIcon, { size: "small" }) : tradingLabels.balance(formatUsd(displayedBalance)) }) : null
24573
- ] }),
24574
- /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
24575
- CurrencyInput,
24576
- {
24577
- value: internalAmount,
24578
- onChange: handleAmountChange,
24579
- ariaLabel: tradingLabels.amount(internalTab),
24580
- max: isLimitOrder && !isSell && isAuthenticated && !isBalanceLoading ? totalBalance : void 0,
24581
- isInvalid: isInsufficientBalance || isBelowMinimum,
24582
- disabled: !orderEligibility.canPlaceOrder,
24583
- prefix: internalTab === "buy" ? "$" : "",
24584
- decimalPlaces: isSell ? SELL_SHARE_INPUT_DECIMALS : 2,
24585
- classNames: {
24586
- input: cn(
24587
- "agg-order-amount-input",
24588
- "w-full max-w-[168px] text-right text-agg-3xl font-agg-bold leading-agg-9 tracking-agg-normal",
24589
- hasEnteredAmount ? "text-agg-foreground" : "text-agg-separator caret-agg-foreground"
24590
- )
24591
- }
24592
- }
24593
- )
24951
+ ] }),
24952
+ /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: estimatedFeesValue })
24953
+ ] }) : null
24594
24954
  ] }),
24595
- showFeesBreakdown && hasEnteredAmount && !isBelowMinimum && estimatedFeesValue ? /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("div", { className: "agg-order-fees-section flex items-center justify-between gap-4", children: [
24596
- /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("div", { className: "flex items-center gap-1.5", children: [
24597
- /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
24598
- Typography,
24599
- {
24600
- variant: "text-sm",
24601
- className: "text-agg-sm leading-agg-5 text-agg-muted-foreground",
24602
- children: tradingLabels.estimatedFees
24603
- }
24604
- ),
24605
- feeBreakdownRows.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
24606
- Tooltip,
24607
- {
24608
- "aria-label": tradingLabels.estimatedFeesTooltipAria,
24609
- classNames: {
24610
- content: cn(
24611
- "min-w-[220px] max-w-[320px] rounded-[10px] px-5 py-4",
24612
- "shadow-[0_12px_12px_rgba(0,0,0,0.10)]"
24613
- ),
24614
- icon: "h-3 w-3 text-agg-muted-foreground",
24615
- trigger: "h-3 w-3 text-agg-muted-foreground"
24616
- },
24617
- content: /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("div", { className: "flex w-full flex-col gap-2", children: feeBreakdownRows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)(
24618
- "div",
24619
- {
24620
- className: "flex items-center justify-between gap-3 text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground",
24621
- children: [
24622
- /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("span", { children: row.label }),
24623
- row.kind === "badge" ? /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
24624
- "span",
24625
- {
24626
- className: cn(
24627
- "agg-fee-badge inline-flex items-center justify-center rounded-agg-sm border border-agg-primary/50",
24628
- "bg-linear-to-b from-agg-primary/8 to-agg-primary/15 px-1.5 py-1",
24629
- "text-agg-xs font-agg-bold leading-agg-4 text-agg-primary uppercase whitespace-nowrap"
24630
- ),
24631
- children: row.badgeLabel
24632
- }
24633
- ) : /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("span", { className: "text-right", children: row.value })
24634
- ]
24635
- },
24636
- row.label
24637
- )) })
24638
- }
24639
- ) : null
24640
- ] }),
24641
- /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: estimatedFeesValue })
24642
- ] }) : null,
24643
24955
  shouldShowSmartRouting ? /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("div", { className: "agg-route-panel flex flex-col gap-3", children: [
24644
24956
  /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("div", { className: "agg-route-panel-header flex items-center justify-between gap-4", children: [
24645
24957
  /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("p", { className: "agg-route-panel-title text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.smartRouting }),
@@ -24648,10 +24960,10 @@ var PlaceOrder = ({
24648
24960
  {
24649
24961
  type: "button",
24650
24962
  className: "agg-route-toggle flex cursor-pointer items-center gap-1.5 text-agg-sm leading-agg-5 text-agg-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-0 focus-visible:ring-offset-agg-secondary",
24651
- "aria-label": tradingLabels.viewAllRoutes(orderedRouteCards.length),
24963
+ "aria-label": tradingLabels.viewAllRoutes(activeRouteCardCount),
24652
24964
  onClick: () => setIsRoutesExpanded((currentValue) => !currentValue),
24653
24965
  children: [
24654
- /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("span", { children: tradingLabels.viewAllRoutes(orderedRouteCards.length) }),
24966
+ /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("span", { children: tradingLabels.viewAllRoutes(activeRouteCardCount) }),
24655
24967
  /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
24656
24968
  Icon,
24657
24969
  {
@@ -24665,16 +24977,16 @@ var PlaceOrder = ({
24665
24977
  }
24666
24978
  ) : null
24667
24979
  ] }),
24668
- /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("div", { className: "agg-route-list flex flex-col gap-2", children: isQuoteLoading ? /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("div", { className: "agg-route-loading flex flex-col gap-2", "aria-hidden": "true", children: [
24980
+ /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("div", { className: "agg-route-list flex flex-col gap-2", children: !isLimitOrder && isQuoteLoading ? /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("div", { className: "agg-route-loading flex flex-col gap-2", "aria-hidden": "true", children: [
24669
24981
  /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(PlaceOrderRouteCardSkeleton, {}),
24670
24982
  /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(PlaceOrderRouteCardSkeleton, {})
24671
- ] }) : visibleRouteCards.length > 0 ? visibleRouteCards.map((card) => {
24983
+ ] }) : activeRouteCards.length > 0 ? activeRouteCards.map((card) => {
24672
24984
  return /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(import_react39.Fragment, { children: renderRouteCard({
24673
24985
  card,
24674
24986
  enableAnimations,
24675
24987
  isExpanded: card.kind === "split" ? isSplitDetailOpen : isRoutesExpanded,
24676
- isSelected: !card.isUnavailable && card.id === resolvedSelectedRouteCardId,
24677
- onSelect: handleRouteCardSelect,
24988
+ isSelected: !card.isUnavailable && card.id === (isLimitOrder ? selectedLimitRouteCardId : resolvedSelectedRouteCardId),
24989
+ onSelect: handleActiveRouteCardSelect,
24678
24990
  tradingLabels
24679
24991
  }) }, card.id);
24680
24992
  }) : null })
@@ -24695,7 +25007,6 @@ var PlaceOrder = ({
24695
25007
  className: "flex min-w-0 cursor-pointer items-center justify-end gap-2 text-right text-agg-base leading-agg-6 text-agg-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary",
24696
25008
  "aria-label": tradingLabels.expirationMenuAria,
24697
25009
  children: [
24698
- /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(Icon, { name: "calendar", size: "small", className: "h-4 w-4 shrink-0", "aria-hidden": true }),
24699
25010
  /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("span", { className: "min-w-0 truncate", children: limitExpirationType === "GTC" ? tradingLabels.expirationGoodTilCanceled : limitExpirationType === "FIVE_MINUTES" ? tradingLabels.expirationFiveMinutes : limitExpirationType === "ONE_HOUR" ? tradingLabels.expirationOneHour : limitExpirationType === "END_OF_DAY" ? tradingLabels.expirationEndOfDay : resolvedCustomExpirationDate ? (0, import_dayjs8.default)(resolvedCustomExpirationDate).format(
24700
25011
  "MMM D, YYYY [at] HH:mm"
24701
25012
  ) : tradingLabels.expirationCustom }),
@@ -24999,7 +25310,7 @@ var PlaceOrder = ({
24999
25310
  className: "agg-order-submit h-12 w-full px-8 text-agg-base leading-agg-6 shadow-none",
25000
25311
  disabled: !orderEligibility.canPlaceOrder || shouldShowGeoBlockBanner,
25001
25312
  "aria-label": tradingLabels.signInToTrade,
25002
- onClick: import_hooks63.requestAggAuthChooserOpen,
25313
+ onClick: import_hooks64.requestAggAuthChooserOpen,
25003
25314
  children: tradingLabels.signInToTrade
25004
25315
  }
25005
25316
  ) : /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
@@ -25071,7 +25382,7 @@ var PlaceOrder = ({
25071
25382
  PlaceOrder.displayName = "PlaceOrder";
25072
25383
 
25073
25384
  // src/trading/use-claim-winnings.ts
25074
- var import_hooks64 = require("@agg-build/hooks");
25385
+ var import_hooks65 = require("@agg-build/hooks");
25075
25386
  var import_react40 = require("react");
25076
25387
  var toClaimError = (err) => {
25077
25388
  if (err instanceof Error) return err;
@@ -25079,11 +25390,11 @@ var toClaimError = (err) => {
25079
25390
  };
25080
25391
  function useClaimWinnings(options = {}) {
25081
25392
  const { onClaim, onClaimResult, onClaimSubmitError, externalClaimingKeys } = options;
25082
- const labels = (0, import_hooks64.useLabels)();
25393
+ const labels = (0, import_hooks65.useLabels)();
25083
25394
  const claimNotificationLabels = labels.notifications.claim;
25084
25395
  const toastCtx = useOptionalToast();
25085
- const queryClient = (0, import_hooks64.useQueryClient)();
25086
- const redeemMutation = (0, import_hooks64.useRedeem)();
25396
+ const queryClient = (0, import_hooks65.useQueryClient)();
25397
+ const redeemMutation = (0, import_hooks65.useRedeem)();
25087
25398
  const [activeRedeems, setActiveRedeems] = (0, import_react40.useState)({});
25088
25399
  const activeClaimKeysRef = (0, import_react40.useRef)(/* @__PURE__ */ new Set());
25089
25400
  const pendingClaimToastIdsRef = (0, import_react40.useRef)({});
@@ -25093,7 +25404,7 @@ function useClaimWinnings(options = {}) {
25093
25404
  () => Object.values(activeRedeems),
25094
25405
  [activeRedeems]
25095
25406
  );
25096
- const lifecycleStates = (0, import_hooks64.useRedeemLifecycles)(lifecycleInputs);
25407
+ const lifecycleStates = (0, import_hooks65.useRedeemLifecycles)(lifecycleInputs);
25097
25408
  const internalClaimingIds = (0, import_react40.useMemo)(() => {
25098
25409
  const out = __spreadValues({}, submittingClaimKeys);
25099
25410
  for (const [claimKey, active] of Object.entries(activeRedeems)) {
@@ -25108,13 +25419,13 @@ function useClaimWinnings(options = {}) {
25108
25419
  [externalClaimingKeys, internalClaimingIds]
25109
25420
  );
25110
25421
  const invalidateClaimUiState = (0, import_react40.useCallback)(() => {
25111
- (0, import_hooks64.invalidateBalanceQueries)(queryClient);
25112
- (0, import_hooks64.invalidatePositionQueries)(queryClient);
25422
+ (0, import_hooks65.invalidateBalanceQueries)(queryClient);
25423
+ (0, import_hooks65.invalidatePositionQueries)(queryClient);
25113
25424
  queryClient.invalidateQueries({
25114
- queryKey: import_hooks64.executionKeys.claimablePositionsCount(),
25425
+ queryKey: import_hooks65.executionKeys.claimablePositionsCount(),
25115
25426
  refetchType: "active"
25116
25427
  });
25117
- (0, import_hooks64.invalidateUserActivityQueries)(queryClient);
25428
+ (0, import_hooks65.invalidateUserActivityQueries)(queryClient);
25118
25429
  }, [queryClient]);
25119
25430
  const claim = (0, import_react40.useCallback)(
25120
25431
  (_0) => __async(null, [_0], function* ({ claimKey, winningOutcomeIds, payload }) {
@@ -25311,7 +25622,7 @@ function useClaimWinnings(options = {}) {
25311
25622
  }
25312
25623
 
25313
25624
  // src/trading/use-resolved-market-claim.ts
25314
- var import_hooks65 = require("@agg-build/hooks");
25625
+ var import_hooks66 = require("@agg-build/hooks");
25315
25626
  var import_react41 = require("react");
25316
25627
  var sharesFormatter = new Intl.NumberFormat("en-US", { maximumFractionDigits: 2 });
25317
25628
  var dateFormatter = new Intl.DateTimeFormat("en-US", {
@@ -25328,12 +25639,12 @@ var formatResolutionDate = (value) => {
25328
25639
  function useResolvedMarketClaim(options = {}) {
25329
25640
  var _a;
25330
25641
  const { market, enabled = true, executionMode } = options;
25331
- const { isAuthenticated } = (0, import_hooks65.useAggAuthState)();
25332
- const tradingState = (0, import_react41.useMemo)(() => (0, import_hooks65.resolveMarketTradingState)(market), [market]);
25642
+ const { isAuthenticated } = (0, import_hooks66.useAggAuthState)();
25643
+ const tradingState = (0, import_react41.useMemo)(() => (0, import_hooks66.resolveMarketTradingState)(market), [market]);
25333
25644
  const isResolved = tradingState.kind === "resolved";
25334
25645
  const marketId = (_a = market == null ? void 0 : market.id) != null ? _a : null;
25335
25646
  const shouldFetch = Boolean(enabled && isAuthenticated && isResolved && marketId);
25336
- const { positions } = (0, import_hooks65.useExecutionPositions)(__spreadValues({
25647
+ const { positions } = (0, import_hooks66.useExecutionPositions)(__spreadValues({
25337
25648
  enabled: shouldFetch,
25338
25649
  status: "active",
25339
25650
  limit: 50
@@ -25350,7 +25661,7 @@ function useResolvedMarketClaim(options = {}) {
25350
25661
  (outcome) => outcome.winner === true && outcome.totalSize > 0
25351
25662
  );
25352
25663
  if (winningOutcomes.length === 0) return void 0;
25353
- const totals = (0, import_hooks65.computeClosedPositionTotals)(group);
25664
+ const totals = (0, import_hooks66.computeClosedPositionTotals)(group);
25354
25665
  const winningShares = winningOutcomes.reduce((sum, outcome) => sum + outcome.totalSize, 0);
25355
25666
  const winningOutcomeLabel = (_a2 = resolveResolvedOutcomeLabel({
25356
25667
  market: market != null ? market : group.venueMarket,
@@ -25434,7 +25745,7 @@ var resolveEventMarketPageStickyState = ({
25434
25745
  };
25435
25746
 
25436
25747
  // src/pages/event-market/event-market.shared.tsx
25437
- var import_hooks66 = require("@agg-build/hooks");
25748
+ var import_hooks67 = require("@agg-build/hooks");
25438
25749
  var Dialog7 = __toESM(require("@radix-ui/react-dialog"));
25439
25750
  var import_react42 = require("react");
25440
25751
  var import_jsx_runtime167 = require("react/jsx-runtime");
@@ -25503,7 +25814,7 @@ var EventMarketPageMobileTrade = ({
25503
25814
  midpointsResult,
25504
25815
  onBeforePrimaryAction
25505
25816
  }) => {
25506
- const labels = (0, import_hooks66.useLabels)();
25817
+ const labels = (0, import_hooks67.useLabels)();
25507
25818
  if (!showPlaceOrder) return null;
25508
25819
  const handleOpenChange = (nextOpen) => {
25509
25820
  onOpenChange(nextOpen);
@@ -25558,7 +25869,7 @@ var EventMarketPageMobileTrade = ({
25558
25869
  var EventMarketPageUnavailableState = ({
25559
25870
  ariaLabel: _ariaLabel
25560
25871
  }) => {
25561
- const labels = (0, import_hooks66.useLabels)();
25872
+ const labels = (0, import_hooks67.useLabels)();
25562
25873
  return /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(
25563
25874
  StateMessage,
25564
25875
  {
@@ -25574,7 +25885,7 @@ var EventMarketPageUnavailableState = ({
25574
25885
  var EventMarketPageNotFoundState = ({
25575
25886
  ariaLabel: _ariaLabel
25576
25887
  }) => {
25577
- const labels = (0, import_hooks66.useLabels)();
25888
+ const labels = (0, import_hooks67.useLabels)();
25578
25889
  return /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(
25579
25890
  StateMessage,
25580
25891
  {
@@ -25671,11 +25982,11 @@ var EventMarketPageLoadingState = ({
25671
25982
  };
25672
25983
 
25673
25984
  // src/pages/event-market/sports-event-market-page.tsx
25674
- var import_hooks69 = require("@agg-build/hooks");
25985
+ var import_hooks70 = require("@agg-build/hooks");
25675
25986
  var import_react45 = require("react");
25676
25987
 
25677
25988
  // src/pages/event-market/sports-markets.tsx
25678
- var import_hooks68 = require("@agg-build/hooks");
25989
+ var import_hooks69 = require("@agg-build/hooks");
25679
25990
  var import_react44 = require("react");
25680
25991
 
25681
25992
  // src/pages/event-market/sports-event-market.utils.ts
@@ -26524,7 +26835,7 @@ var mergeSportsSectionMarketsIntoEvent = ({
26524
26835
  };
26525
26836
 
26526
26837
  // src/pages/event-market/sports-market-card.tsx
26527
- var import_hooks67 = require("@agg-build/hooks");
26838
+ var import_hooks68 = require("@agg-build/hooks");
26528
26839
  var import_react43 = require("react");
26529
26840
 
26530
26841
  // src/pages/event-market/sports-line-rail.tsx
@@ -26574,7 +26885,7 @@ function SportsLineRail({
26574
26885
  const didInit = React.useRef(false);
26575
26886
  const programmatic = React.useRef(false);
26576
26887
  const progTimer = React.useRef(void 0);
26577
- const skipCenterOnPropSync = React.useRef(false);
26888
+ const skipCenterForIndex = React.useRef(null);
26578
26889
  const pendingScrollIndex = React.useRef(null);
26579
26890
  const scrollSettleTimer = React.useRef(void 0);
26580
26891
  const stopCount = stops.length;
@@ -26614,9 +26925,15 @@ function SportsLineRail({
26614
26925
  if (!w) return;
26615
26926
  const firstW = (_b = (_a = itemRefs.current[0]) == null ? void 0 : _a.offsetWidth) != null ? _b : 0;
26616
26927
  const lastW = (_d = (_c = itemRefs.current[stopCount - 1]) == null ? void 0 : _c.offsetWidth) != null ? _d : 0;
26617
- setPad({
26928
+ const nextPad = {
26618
26929
  left: Math.max(0, w / 2 - firstW / 2),
26619
26930
  right: Math.max(0, w / 2 - lastW / 2)
26931
+ };
26932
+ setPad((currentPad) => {
26933
+ if (currentPad.left === nextPad.left && currentPad.right === nextPad.right) {
26934
+ return currentPad;
26935
+ }
26936
+ return nextPad;
26620
26937
  });
26621
26938
  updateMask();
26622
26939
  };
@@ -26629,7 +26946,7 @@ function SportsLineRail({
26629
26946
  scrollSettleTimer.current = setTimeout(() => {
26630
26947
  const nextIndex = pendingScrollIndex.current;
26631
26948
  if (nextIndex == null || nextIndex === selectedIndex) return;
26632
- skipCenterOnPropSync.current = true;
26949
+ skipCenterForIndex.current = nextIndex;
26633
26950
  onSelect(nextIndex);
26634
26951
  }, 120);
26635
26952
  }
@@ -26653,11 +26970,12 @@ function SportsLineRail({
26653
26970
  const c = scrollRef.current;
26654
26971
  const el = itemRefs.current[selectedIndex];
26655
26972
  if (!c || !el || !c.clientWidth) return;
26656
- if (skipCenterOnPropSync.current) {
26657
- skipCenterOnPropSync.current = false;
26973
+ if (skipCenterForIndex.current === selectedIndex) {
26974
+ skipCenterForIndex.current = null;
26658
26975
  updateMask();
26659
26976
  return;
26660
26977
  }
26978
+ skipCenterForIndex.current = null;
26661
26979
  const max = c.scrollWidth - c.clientWidth;
26662
26980
  const target = el.offsetLeft - c.clientWidth / 2 + el.clientWidth / 2;
26663
26981
  programmatic.current = true;
@@ -26672,11 +26990,18 @@ function SportsLineRail({
26672
26990
  }, 500);
26673
26991
  updateMask();
26674
26992
  }, [selectedIndex, stopCount, pad, updateMask]);
26675
- const select = (index) => {
26676
- const next = Math.min(stops.length - 1, Math.max(0, index));
26993
+ const clampStopIndex = (index) => Math.min(stops.length - 1, Math.max(0, index));
26994
+ const handleStopClick = (index) => {
26995
+ const next = clampStopIndex(index);
26996
+ if (next !== selectedIndex) {
26997
+ skipCenterForIndex.current = next;
26998
+ }
26999
+ onSelect(next);
27000
+ };
27001
+ const handleStep = (delta) => {
27002
+ const next = clampStopIndex(selectedIndex + delta);
26677
27003
  if (next !== selectedIndex) onSelect(next);
26678
27004
  };
26679
- const step = (delta) => select(selectedIndex + delta);
26680
27005
  if (stopCount === 0) return null;
26681
27006
  return /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)(
26682
27007
  "div",
@@ -26688,7 +27013,7 @@ function SportsLineRail({
26688
27013
  "button",
26689
27014
  {
26690
27015
  type: "button",
26691
- onClick: () => step(-1),
27016
+ onClick: () => handleStep(-1),
26692
27017
  disabled: selectedIndex === 0,
26693
27018
  "aria-label": previousAriaLabel != null ? previousAriaLabel : "Previous line",
26694
27019
  className: "flex size-5! shrink-0 cursor-pointer items-center justify-center text-agg-muted-foreground transition-colors hover:text-agg-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary disabled:cursor-not-allowed disabled:opacity-30",
@@ -26711,7 +27036,7 @@ function SportsLineRail({
26711
27036
  ref: (el) => {
26712
27037
  itemRefs.current[index] = el;
26713
27038
  },
26714
- onClick: () => select(index),
27039
+ onClick: () => handleStopClick(index),
26715
27040
  disabled: stop.disabled,
26716
27041
  "aria-pressed": active,
26717
27042
  className: "flex shrink-0 cursor-pointer flex-col items-center gap-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-40",
@@ -26757,7 +27082,7 @@ function SportsLineRail({
26757
27082
  "button",
26758
27083
  {
26759
27084
  type: "button",
26760
- onClick: () => step(1),
27085
+ onClick: () => handleStep(1),
26761
27086
  disabled: selectedIndex === stopCount - 1,
26762
27087
  "aria-label": nextAriaLabel != null ? nextAriaLabel : "Next line",
26763
27088
  className: "flex size-5! shrink-0 cursor-pointer items-center justify-center text-agg-muted-foreground transition-colors hover:text-agg-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary disabled:cursor-not-allowed disabled:opacity-30",
@@ -26771,15 +27096,81 @@ function SportsLineRail({
26771
27096
 
26772
27097
  // src/pages/event-market/sports-market-card.tsx
26773
27098
  var import_jsx_runtime169 = require("react/jsx-runtime");
26774
- var resolveSportsLineOutcomeSide = (outcome) => {
27099
+ var resolveSpreadHeaderOutcomeItems = ({
27100
+ market,
27101
+ groupMarkets,
27102
+ midpointsResult
27103
+ }) => {
26775
27104
  var _a;
26776
- for (const candidate of [outcome.label, outcome.title]) {
26777
- if (typeof candidate !== "string") continue;
26778
- const matchedSide = (_a = candidate.trim().toLowerCase().match(/(?:^|\s)(over|under)(?=\s|$)/)) == null ? void 0 : _a[1];
26779
- if (matchedSide === "over" || matchedSide === "under") return matchedSide;
26780
- }
27105
+ const outcomes = (_a = market.venueMarketOutcomes) != null ? _a : [];
27106
+ const lineValue = market.lineValue;
27107
+ if (outcomes.length < 2 || lineValue == null) return void 0;
27108
+ const { favored, dog } = resolveSpreadOutcomeTeamNames(market, groupMarkets);
27109
+ if (!favored && !dog) return void 0;
27110
+ const magnitude = Math.abs(lineValue);
27111
+ const formatLine = (value) => `${value > 0 ? "+" : "\u2212"}${Number.isInteger(magnitude) ? String(magnitude) : magnitude.toFixed(1)}`;
27112
+ return [
27113
+ { index: 0, name: favored, signedLine: -magnitude },
27114
+ { index: 1, name: dog, signedLine: magnitude }
27115
+ ].flatMap(({ index, name, signedLine }) => {
27116
+ var _a2;
27117
+ const outcome = outcomes[index];
27118
+ if (!outcome) return [];
27119
+ const label2 = name != null ? name : outcome.label.trim();
27120
+ const probability = midpointsResult == null ? void 0 : getDisplayOutcomePrice({
27121
+ outcomeId: outcome.id,
27122
+ outcomeLabel: outcome.label,
27123
+ bestMidpointsByOutcomeId: (_a2 = midpointsResult.bestMidpointsByOutcomeId) != null ? _a2 : midpointsResult.prices
27124
+ });
27125
+ return [
27126
+ {
27127
+ id: outcome.id,
27128
+ label: label2,
27129
+ title: label2,
27130
+ lineLabel: formatLine(signedLine),
27131
+ probability,
27132
+ isPriceLoading: (midpointsResult == null ? void 0 : midpointsResult.isLoading) === true && probability == null,
27133
+ tone: index === 0 ? "positive" : "negative",
27134
+ variant: "line",
27135
+ venue: market.venue
27136
+ }
27137
+ ];
27138
+ });
27139
+ };
27140
+ var resolveDisplayedOutcomes = ({
27141
+ market,
27142
+ venueMarkets,
27143
+ groupMarkets,
27144
+ useSpreadOverride
27145
+ }) => {
27146
+ var _a;
27147
+ const spreadHeaderOutcomeItems = useSpreadOverride ? resolveSpreadHeaderOutcomeItems({ market, groupMarkets }) : void 0;
27148
+ const resolvedMarket = resolveMarketFromVenueMarkets(venueMarkets, market.id);
27149
+ const headerOutcomeItems = spreadHeaderOutcomeItems != null ? spreadHeaderOutcomeItems : resolveHeaderOutcomeItems(
27150
+ (_a = resolvedMarket == null ? void 0 : resolvedMarket.venueMarkets) != null ? _a : [market],
27151
+ market,
27152
+ resolveSportsMarketCardVariant(market)
27153
+ );
27154
+ return headerOutcomeItems.flatMap((item) => {
27155
+ const outcome = market.venueMarketOutcomes.find((candidate) => candidate.id === item.id);
27156
+ return outcome ? [outcome] : [];
27157
+ });
27158
+ };
27159
+ var resolveSelectedOutcomeSide = ({
27160
+ displayedOutcomes,
27161
+ selectedOutcomeId
27162
+ }) => {
27163
+ const selectedOutcomeIndex = displayedOutcomes.findIndex(
27164
+ (outcome) => outcome.id === selectedOutcomeId
27165
+ );
27166
+ if (selectedOutcomeIndex === 0) return "left";
27167
+ if (selectedOutcomeIndex === 1) return "right";
26781
27168
  return null;
26782
27169
  };
27170
+ var resolveOutcomeBySide = (displayedOutcomes, side) => {
27171
+ var _a;
27172
+ return (_a = displayedOutcomes[side === "right" ? 1 : 0]) != null ? _a : displayedOutcomes[0];
27173
+ };
26783
27174
  var SportsMarketCard = ({
26784
27175
  group,
26785
27176
  venueMarkets,
@@ -26792,11 +27183,11 @@ var SportsMarketCard = ({
26792
27183
  midpointsResult
26793
27184
  }) => {
26794
27185
  var _a, _b, _c, _d, _e, _f, _g;
26795
- const labels = (0, import_hooks67.useLabels)();
27186
+ const labels = (0, import_hooks68.useLabels)();
26796
27187
  const {
26797
27188
  formatting: { formatCompactCurrency }
26798
- } = (0, import_hooks67.useSdkUiConfig)();
26799
- const tradingContext = (0, import_hooks67.useEventTradingContext)();
27189
+ } = (0, import_hooks68.useSdkUiConfig)();
27190
+ const tradingContext = (0, import_hooks68.useEventTradingContext)();
26800
27191
  const slide = (0, import_react43.useMemo)(() => buildSportsSlideFromGroup(group), [group]);
26801
27192
  const [selectedLineIndex, setSelectedLineIndex] = (0, import_react43.useState)(slide.defaultStopIndex);
26802
27193
  const combinedMoneylineMarkets = (0, import_react43.useMemo)(
@@ -26837,7 +27228,7 @@ var SportsMarketCard = ({
26837
27228
  const justOpened = isExpanded && !wasExpandedRef.current;
26838
27229
  wasExpandedRef.current = isExpanded;
26839
27230
  if (!justOpened || !activeMarket) return;
26840
- if ((0, import_hooks67.resolveMarketTradingState)(activeMarket).isTradingDisabled) return;
27231
+ if ((0, import_hooks68.resolveMarketTradingState)(activeMarket).isTradingDisabled) return;
26841
27232
  const selectedOutcomeId = tradingContext == null ? void 0 : tradingContext.selectedOutcomeId;
26842
27233
  const hasInScopeOutcome = selectedOutcomeId != null && activeMarket.venueMarketOutcomes.some((outcome) => outcome.id === selectedOutcomeId);
26843
27234
  if (hasInScopeOutcome) return;
@@ -26897,69 +27288,46 @@ var SportsMarketCard = ({
26897
27288
  });
26898
27289
  }, [combinedMoneylineMarkets, isCombinedMoneylineGroup, midpointsResult]);
26899
27290
  const spreadHeaderOutcomeItems = (0, import_react43.useMemo)(() => {
26900
- var _a2;
26901
27291
  if (slide.kind !== "spread" || !activeMarket) return void 0;
26902
- const outcomes = (_a2 = activeMarket.venueMarketOutcomes) != null ? _a2 : [];
26903
- const lineValue = activeMarket.lineValue;
26904
- if (outcomes.length < 2 || lineValue == null) return void 0;
26905
- const { favored, dog } = resolveSpreadOutcomeTeamNames(activeMarket, group.markets);
26906
- if (!favored && !dog) return void 0;
26907
- const magnitude = Math.abs(lineValue);
26908
- const formatLine = (value) => `${value > 0 ? "+" : "\u2212"}${Number.isInteger(magnitude) ? String(magnitude) : magnitude.toFixed(1)}`;
26909
- return [
26910
- { index: 0, name: favored, signedLine: -magnitude },
26911
- { index: 1, name: dog, signedLine: magnitude }
26912
- ].flatMap(({ index, name, signedLine }) => {
26913
- var _a3;
26914
- const outcome = outcomes[index];
26915
- if (!outcome) return [];
26916
- const label2 = name != null ? name : outcome.label.trim();
26917
- const probability = midpointsResult == null ? void 0 : getDisplayOutcomePrice({
26918
- outcomeId: outcome.id,
26919
- outcomeLabel: outcome.label,
26920
- bestMidpointsByOutcomeId: (_a3 = midpointsResult.bestMidpointsByOutcomeId) != null ? _a3 : midpointsResult.prices
26921
- });
26922
- return [
26923
- {
26924
- id: outcome.id,
26925
- label: label2,
26926
- title: label2,
26927
- lineLabel: formatLine(signedLine),
26928
- probability,
26929
- isPriceLoading: (midpointsResult == null ? void 0 : midpointsResult.isLoading) === true && probability == null,
26930
- tone: index === 0 ? "positive" : "negative",
26931
- variant: "line",
26932
- venue: activeMarket.venue
26933
- }
26934
- ];
27292
+ return resolveSpreadHeaderOutcomeItems({
27293
+ market: activeMarket,
27294
+ groupMarkets: group.markets,
27295
+ midpointsResult
26935
27296
  });
26936
27297
  }, [slide.kind, activeMarket, group.markets, midpointsResult]);
26937
27298
  const headerOutcomeItemsOverride = combinedMoneylineHeaderOutcomeItems != null ? combinedMoneylineHeaderOutcomeItems : spreadHeaderOutcomeItems;
26938
27299
  const headerOutcomeVariant = isCombinedMoneylineGroup ? "outcome" : resolveSportsMarketCardVariant(activeMarket);
26939
27300
  const handleLineSelect = (index) => {
26940
- var _a2, _b2;
26941
- const previousMarket = activeMarket;
27301
+ var _a2, _b2, _c2;
27302
+ const targetMarket = (_a2 = slide.stops[index]) == null ? void 0 : _a2.market;
27303
+ if (!targetMarket) return;
27304
+ const selectedMarket = (_c2 = (_b2 = tradingContext == null ? void 0 : tradingContext.selectedMarket) != null ? _b2 : venueMarkets.find((market) => market.id === (tradingContext == null ? void 0 : tradingContext.selectedMarketId))) != null ? _c2 : null;
27305
+ const selectedMarketIsInGroup = selectedMarket != null && group.markets.some((market) => market.id === selectedMarket.id);
27306
+ const selectedSide = selectedMarket ? resolveSelectedOutcomeSide({
27307
+ displayedOutcomes: resolveDisplayedOutcomes({
27308
+ market: selectedMarket,
27309
+ venueMarkets,
27310
+ groupMarkets: group.markets,
27311
+ useSpreadOverride: slide.kind === "spread" && selectedMarketIsInGroup
27312
+ }),
27313
+ selectedOutcomeId: tradingContext == null ? void 0 : tradingContext.selectedOutcomeId
27314
+ }) : null;
27315
+ const targetDisplayedOutcomes = resolveDisplayedOutcomes({
27316
+ market: targetMarket,
27317
+ venueMarkets,
27318
+ groupMarkets: group.markets,
27319
+ useSpreadOverride: slide.kind === "spread"
27320
+ });
27321
+ const nextOutcome = resolveOutcomeBySide(targetDisplayedOutcomes, selectedSide != null ? selectedSide : "left");
26942
27322
  setSelectedLineIndex(index);
26943
- const market = (_a2 = slide.stops[index]) == null ? void 0 : _a2.market;
26944
- if (!market) return;
26945
- const previousOutcomeIndex = previousMarket ? previousMarket.venueMarketOutcomes.findIndex(
26946
- (outcome) => outcome.id === (tradingContext == null ? void 0 : tradingContext.selectedOutcomeId)
26947
- ) : -1;
26948
- const previousOutcome = previousOutcomeIndex >= 0 ? previousMarket == null ? void 0 : previousMarket.venueMarketOutcomes[previousOutcomeIndex] : void 0;
26949
- const previousOutcomeSide = previousOutcome ? resolveSportsLineOutcomeSide(previousOutcome) : null;
26950
- const matchingSideOutcomes = previousOutcomeSide ? market.venueMarketOutcomes.filter(
26951
- (outcome) => resolveSportsLineOutcomeSide(outcome) === previousOutcomeSide
26952
- ) : [];
26953
- const matchingSideOutcome = matchingSideOutcomes.length === 1 ? matchingSideOutcomes[0] : void 0;
26954
- const nextOutcome = (_b2 = matchingSideOutcome != null ? matchingSideOutcome : previousOutcomeIndex >= 0 ? market.venueMarketOutcomes[previousOutcomeIndex] : void 0) != null ? _b2 : market.venueMarketOutcomes[0];
26955
27323
  if (nextOutcome) {
26956
- tradingContext == null ? void 0 : tradingContext.selectMarketAndOutcome(market.id, nextOutcome.id);
27324
+ tradingContext == null ? void 0 : tradingContext.selectMarketAndOutcome(targetMarket.id, nextOutcome.id);
26957
27325
  onOutcomeSelect == null ? void 0 : onOutcomeSelect(group.id, {
26958
- marketId: market.id,
27326
+ marketId: targetMarket.id,
26959
27327
  outcomeId: nextOutcome.id
26960
27328
  });
26961
27329
  } else {
26962
- tradingContext == null ? void 0 : tradingContext.selectMarket(market.id, market);
27330
+ tradingContext == null ? void 0 : tradingContext.selectMarket(targetMarket.id, targetMarket);
26963
27331
  }
26964
27332
  };
26965
27333
  return /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
@@ -26982,7 +27350,7 @@ var SportsMarketCard = ({
26982
27350
  stops: slide.stops.map((stop) => ({
26983
27351
  value: stop.value,
26984
27352
  venues: stop.venues,
26985
- disabled: stop.market.status !== import_hooks67.MarketStatus.open
27353
+ disabled: stop.market.status !== import_hooks68.MarketStatus.open
26986
27354
  })),
26987
27355
  selectedIndex: selectedLineIndex,
26988
27356
  onSelect: handleLineSelect,
@@ -27069,7 +27437,7 @@ var SportsTabButton = ({
27069
27437
  );
27070
27438
  };
27071
27439
  var SportsMarketsLoadingState = () => {
27072
- const labels = (0, import_hooks68.useLabels)();
27440
+ const labels = (0, import_hooks69.useLabels)();
27073
27441
  return /* @__PURE__ */ (0, import_jsx_runtime170.jsxs)(
27074
27442
  "div",
27075
27443
  {
@@ -27107,13 +27475,13 @@ var SportsMarkets = ({
27107
27475
  midpointsResult
27108
27476
  }) => {
27109
27477
  var _a, _b;
27110
- const labels = (0, import_hooks68.useLabels)();
27111
- const tradingContext = (0, import_hooks68.useEventTradingContext)();
27478
+ const labels = (0, import_hooks69.useLabels)();
27479
+ const tradingContext = (0, import_hooks69.useEventTradingContext)();
27112
27480
  const hasAggKey = Boolean(event.aggKey);
27113
- const gameMarketsQuery = (0, import_hooks68.useVenueMarkets)({
27481
+ const gameMarketsQuery = (0, import_hooks69.useVenueMarkets)({
27114
27482
  aggKey: event.aggKey ? [event.aggKey] : void 0,
27115
27483
  limit: 100,
27116
- status: import_hooks68.MarketStatus.open,
27484
+ status: import_hooks69.MarketStatus.open,
27117
27485
  enabled: hasAggKey
27118
27486
  });
27119
27487
  const {
@@ -27149,7 +27517,7 @@ var SportsMarkets = ({
27149
27517
  const [stableMarketsByTab, setStableMarketsByTab] = (0, import_react44.useState)({});
27150
27518
  const activeTabLabel = resolveSportsSectionLabel(labels, activeTab);
27151
27519
  const sectionFilters = resolveSportsSectionFilters(activeTab);
27152
- const sectionMarketsQuery = (0, import_hooks68.useVenueMarkets)({
27520
+ const sectionMarketsQuery = (0, import_hooks69.useVenueMarkets)({
27153
27521
  aggKey: event.aggKey ? [event.aggKey] : void 0,
27154
27522
  sportsMarketType: sectionFilters.sportsMarketType,
27155
27523
  period: sectionFilters.period,
@@ -27159,7 +27527,7 @@ var SportsMarkets = ({
27159
27527
  // heavy tab (e.g. "Other" spans other/team_props/player_props/specials/
27160
27528
  // completion — hundreds of markets on prop-rich events) from ~15 calls to 1-3.
27161
27529
  limit: 100,
27162
- status: import_hooks68.MarketStatus.open,
27530
+ status: import_hooks69.MarketStatus.open,
27163
27531
  enabled: hasAggKey
27164
27532
  });
27165
27533
  const {
@@ -27245,7 +27613,7 @@ var SportsMarkets = ({
27245
27613
  return;
27246
27614
  }
27247
27615
  setExpandedGroupId(groupId);
27248
- if ((0, import_hooks68.resolveMarketTradingState)(market).isTradingDisabled) return;
27616
+ if ((0, import_hooks69.resolveMarketTradingState)(market).isTradingDisabled) return;
27249
27617
  if (market.id !== (tradingContext == null ? void 0 : tradingContext.selectedMarketId)) {
27250
27618
  tradingContext == null ? void 0 : tradingContext.selectMarket(market.id, market);
27251
27619
  }
@@ -27349,7 +27717,7 @@ var SportsEventMarketPage = ({
27349
27717
  sectionMarketsByKey
27350
27718
  });
27351
27719
  }, [event, sectionMarketsByKey]);
27352
- const eventTradingState = (0, import_react45.useMemo)(() => (0, import_hooks69.resolveEventTradingState)(composedEvent), [composedEvent]);
27720
+ const eventTradingState = (0, import_react45.useMemo)(() => (0, import_hooks70.resolveEventTradingState)(composedEvent), [composedEvent]);
27353
27721
  const hasSportsSections = (0, import_react45.useMemo)(
27354
27722
  () => resolveVisibleSportsSectionTabs(event).length > 0,
27355
27723
  [event]
@@ -27359,12 +27727,12 @@ var SportsEventMarketPage = ({
27359
27727
  });
27360
27728
  const {
27361
27729
  trading: { executionMode: configuredExecutionMode }
27362
- } = (0, import_hooks69.useSdkUiConfig)();
27730
+ } = (0, import_hooks70.useSdkUiConfig)();
27363
27731
  const resolvedExecutionMode = executionMode != null ? executionMode : configuredExecutionMode;
27364
27732
  const [isMobileTradeOpen, setIsMobileTradeOpen] = (0, import_react45.useState)(false);
27365
27733
  const isMobileViewport = useIsMobileEventMarketViewport(SPORTS_EVENT_MARKET_MEDIA_QUERY);
27366
- const tradingContext = (0, import_hooks69.useEventTradingContext)();
27367
- const midpointsResult = (0, import_hooks69.useMidpoints)(composedEvent.venueMarkets);
27734
+ const tradingContext = (0, import_hooks70.useEventTradingContext)();
27735
+ const midpointsResult = (0, import_hooks70.useMidpoints)(composedEvent.venueMarkets);
27368
27736
  const internalResolvedClaim = useResolvedMarketClaim({
27369
27737
  market: eventTradingState.primaryMarket,
27370
27738
  enabled: eventTradingState.kind === "resolved",
@@ -27376,7 +27744,7 @@ var SportsEventMarketPage = ({
27376
27744
  (0, import_react45.useEffect)(() => {
27377
27745
  return () => {
27378
27746
  var _a;
27379
- (_a = setTradeSideRef.current) == null ? void 0 : _a.call(setTradeSideRef, import_hooks69.TradeSide.Buy);
27747
+ (_a = setTradeSideRef.current) == null ? void 0 : _a.call(setTradeSideRef, import_hooks70.TradeSide.Buy);
27380
27748
  };
27381
27749
  }, []);
27382
27750
  const handleSectionMarketsChange = (0, import_react45.useCallback)(
@@ -27548,22 +27916,22 @@ var EventMarketPageContent = ({
27548
27916
  resolvedClaim,
27549
27917
  onBeforePrimaryAction
27550
27918
  }) => {
27551
- const eventTradingState = (0, import_react46.useMemo)(() => (0, import_hooks70.resolveEventTradingState)(event), [event]);
27919
+ const eventTradingState = (0, import_react46.useMemo)(() => (0, import_hooks71.resolveEventTradingState)(event), [event]);
27552
27920
  const stickyOrderPanelState = resolveEventMarketPageStickyState({
27553
27921
  stickyOrderPanel
27554
27922
  });
27555
27923
  const {
27556
27924
  trading: { executionMode: configuredExecutionMode }
27557
- } = (0, import_hooks70.useSdkUiConfig)();
27925
+ } = (0, import_hooks71.useSdkUiConfig)();
27558
27926
  const resolvedExecutionMode = executionMode != null ? executionMode : configuredExecutionMode;
27559
27927
  const [isMobileTradeOpen, setIsMobileTradeOpen] = (0, import_react46.useState)(false);
27560
27928
  const isMobileViewport = useIsMobileEventMarketViewport();
27561
- const tradingContext = (0, import_hooks70.useEventTradingContext)();
27929
+ const tradingContext = (0, import_hooks71.useEventTradingContext)();
27562
27930
  const eventDetailVenueMarkets = (0, import_react46.useMemo)(
27563
27931
  () => normalizeVenueMarketCluster(event.venueMarkets),
27564
27932
  [event.venueMarkets]
27565
27933
  );
27566
- const midpointsResult = (0, import_hooks70.useMidpoints)(eventDetailVenueMarkets);
27934
+ const midpointsResult = (0, import_hooks71.useMidpoints)(eventDetailVenueMarkets);
27567
27935
  const internalResolvedClaim = useResolvedMarketClaim({
27568
27936
  market: eventTradingState.primaryMarket,
27569
27937
  enabled: eventTradingState.kind === "resolved",
@@ -27575,7 +27943,7 @@ var EventMarketPageContent = ({
27575
27943
  (0, import_react46.useEffect)(() => {
27576
27944
  return () => {
27577
27945
  var _a;
27578
- (_a = setTradeSideRef.current) == null ? void 0 : _a.call(setTradeSideRef, import_hooks70.TradeSide.Buy);
27946
+ (_a = setTradeSideRef.current) == null ? void 0 : _a.call(setTradeSideRef, import_hooks71.TradeSide.Buy);
27579
27947
  };
27580
27948
  }, []);
27581
27949
  if (!event.venueMarkets.length) {
@@ -27709,14 +28077,14 @@ var EventMarketPage = (props) => {
27709
28077
  var _a;
27710
28078
  const {
27711
28079
  features: { showSportsMarkets }
27712
- } = (0, import_hooks70.useSdkUiConfig)();
28080
+ } = (0, import_hooks71.useSdkUiConfig)();
27713
28081
  const hasEventProp = "event" in props && !!props.event;
27714
28082
  const {
27715
28083
  event: fetchedEvent,
27716
28084
  error: eventError,
27717
28085
  isLoading: isFetchingEvent,
27718
28086
  isEnriching
27719
- } = (0, import_hooks70.useEnrichedVenueEvent)({
28087
+ } = (0, import_hooks71.useEnrichedVenueEvent)({
27720
28088
  eventId: hasEventProp ? "" : (_a = props.eventId) != null ? _a : "",
27721
28089
  enabled: !props.isLoading && !hasEventProp && !!props.eventId
27722
28090
  });
@@ -27903,14 +28271,14 @@ var HomeSearchResults = ({
27903
28271
  onEventClick,
27904
28272
  onMarketClick
27905
28273
  }) => {
27906
- const labels = (0, import_hooks71.useLabels)();
27907
- const { search: searchConfig } = (0, import_hooks71.useSdkUiConfig)();
27908
- const { disabledVenues } = (0, import_hooks71.useAppConfig)();
28274
+ const labels = (0, import_hooks72.useLabels)();
28275
+ const { search: searchConfig } = (0, import_hooks72.useSdkUiConfig)();
28276
+ const { disabledVenues } = (0, import_hooks72.useAppConfig)();
27909
28277
  const [activeVenueTabValue, setActiveVenueTabValue] = (0, import_react49.useState)("all");
27910
28278
  const eventListTabs = useEventListTabs();
27911
28279
  const { headerRef, titleRef, shouldUseSelectOverflow } = useEventListTabsHeaderOverflow(eventListTabs);
27912
28280
  const visibleVenues = (0, import_react49.useMemo)(
27913
- () => disabledVenues.length === 0 ? void 0 : (0, import_hooks71.getVisibleVenueIdsByConfig)(import_sdk24.VENUES, disabledVenues),
28281
+ () => disabledVenues.length === 0 ? void 0 : (0, import_hooks72.getVisibleVenueIdsByConfig)(import_sdk24.VENUES, disabledVenues),
27914
28282
  [disabledVenues]
27915
28283
  );
27916
28284
  const activeVenueTab = (0, import_react49.useMemo)(() => {
@@ -27928,7 +28296,7 @@ var HomeSearchResults = ({
27928
28296
  hasNextPage,
27929
28297
  isFetchingNextPage,
27930
28298
  isPlaceholderData
27931
- } = (0, import_hooks71.useSearch)({
28299
+ } = (0, import_hooks72.useSearch)({
27932
28300
  q: query,
27933
28301
  type: "events",
27934
28302
  categoryIds: activeTabValue === ALL_CATEGORIES_TAB_VALUE ? void 0 : activeCategoryTab == null ? void 0 : activeCategoryTab.categoryIds,
@@ -27956,7 +28324,7 @@ var HomeSearchResults = ({
27956
28324
  const visibleMidpointVenueMarketIds = (0, import_react49.useMemo)(() => {
27957
28325
  return collectVisibleVenueMarketIds(visibleVenueMarkets);
27958
28326
  }, [visibleVenueMarkets]);
27959
- const { midpointRows: sharedMidpointRows, isLoading: isSharedMidpointsLoading } = (0, import_hooks71.useVenueMarketMidpoints)({
28327
+ const { midpointRows: sharedMidpointRows, isLoading: isSharedMidpointsLoading } = (0, import_hooks72.useVenueMarketMidpoints)({
27960
28328
  venueMarketIds: visibleMidpointVenueMarketIds,
27961
28329
  enabled: visibleMidpointVenueMarketIds.length > 0
27962
28330
  });
@@ -28105,7 +28473,7 @@ var HomePage = ({
28105
28473
  stickyOrderPanel
28106
28474
  }) => {
28107
28475
  var _a, _b, _c, _d;
28108
- const labels = (0, import_hooks71.useLabels)();
28476
+ const labels = (0, import_hooks72.useLabels)();
28109
28477
  const {
28110
28478
  search: {
28111
28479
  value: searchValue,
@@ -28115,8 +28483,8 @@ var HomePage = ({
28115
28483
  onSelect: onSelectEventInternal
28116
28484
  },
28117
28485
  trading: { executionMode }
28118
- } = (0, import_hooks71.useSdkUiConfig)();
28119
- const { capture, consume } = (0, import_hooks71.useEventListState)();
28486
+ } = (0, import_hooks72.useSdkUiConfig)();
28487
+ const { capture, consume } = (0, import_hooks72.useEventListState)();
28120
28488
  const [snapshot] = (0, import_react49.useState)(() => consume());
28121
28489
  const eventListStateRef = (0, import_react49.useRef)(null);
28122
28490
  const handleSelectEvent = (0, import_react49.useCallback)(
@@ -28186,7 +28554,7 @@ var HomePage = ({
28186
28554
  }, [isShowingAllResults, normalizedSearchValue, selectedEvent]);
28187
28555
  const resolvedSelectedEvent = selectedEvent != null ? selectedEvent : stickySelectedEvent;
28188
28556
  const resolvedAllCategoryTabLabel = allCategoryTabLabel === DEFAULT_ALL_CATEGORY_TAB_LABEL ? labels.home.trending : allCategoryTabLabel;
28189
- const { categories } = (0, import_hooks71.useCategories)({
28557
+ const { categories } = (0, import_hooks72.useCategories)({
28190
28558
  limit: categoriesLimit,
28191
28559
  enabled: !hasCustomTabs
28192
28560
  });
@@ -28396,7 +28764,7 @@ var HomePage = ({
28396
28764
  HomePage.displayName = "HomePage";
28397
28765
 
28398
28766
  // src/pages/user-profile/index.tsx
28399
- var import_hooks78 = require("@agg-build/hooks");
28767
+ var import_hooks79 = require("@agg-build/hooks");
28400
28768
  var import_sdk26 = require("@agg-build/sdk");
28401
28769
  var import_dayjs9 = __toESM(require("dayjs"));
28402
28770
  var import_react51 = require("react");
@@ -28422,7 +28790,7 @@ var formatChainIdLabel = (chainId) => {
28422
28790
  };
28423
28791
 
28424
28792
  // src/pages/user-profile/components/available-balance-card.tsx
28425
- var import_hooks72 = require("@agg-build/hooks");
28793
+ var import_hooks73 = require("@agg-build/hooks");
28426
28794
  var import_jsx_runtime174 = require("react/jsx-runtime");
28427
28795
  var BASE_URL = "https://assets.snagsolutions.io";
28428
28796
  var CHAIN_ID_TO_ICON_URL = {
@@ -28478,7 +28846,7 @@ var AvailableBalanceCard = ({
28478
28846
  isLoading = false,
28479
28847
  className
28480
28848
  }) => {
28481
- const labels = (0, import_hooks72.useLabels)();
28849
+ const labels = (0, import_hooks73.useLabels)();
28482
28850
  const balanceLabels = labels.userProfile.balance;
28483
28851
  const resolvedLabel = label2 != null ? label2 : balanceLabels.availableBalance;
28484
28852
  const hasPaperBalance = chains.some(isPaperChain);
@@ -28638,7 +29006,7 @@ var AvailableBalanceCard = ({
28638
29006
  AvailableBalanceCard.displayName = "AvailableBalanceCard";
28639
29007
 
28640
29008
  // src/pages/user-profile/components/claim-activity-breakdown-modal.tsx
28641
- var import_hooks73 = require("@agg-build/hooks");
29009
+ var import_hooks74 = require("@agg-build/hooks");
28642
29010
  var import_sdk25 = require("@agg-build/sdk");
28643
29011
  var import_jsx_runtime175 = require("react/jsx-runtime");
28644
29012
  var CLAIM_VENUE_LABELS = {
@@ -28657,7 +29025,7 @@ var ClaimActivityBreakdownModal = ({
28657
29025
  onTransactionSelect
28658
29026
  }) => {
28659
29027
  var _a;
28660
- const labels = (0, import_hooks73.useLabels)();
29028
+ const labels = (0, import_hooks74.useLabels)();
28661
29029
  return /* @__PURE__ */ (0, import_jsx_runtime175.jsx)(
28662
29030
  Modal,
28663
29031
  {
@@ -28766,7 +29134,7 @@ var ClaimActivityBreakdownModal = ({
28766
29134
  };
28767
29135
 
28768
29136
  // src/pages/user-profile/components/positions-activity.tsx
28769
- var import_hooks76 = require("@agg-build/hooks");
29137
+ var import_hooks77 = require("@agg-build/hooks");
28770
29138
  var import_react50 = require("react");
28771
29139
 
28772
29140
  // src/pages/user-profile/user-profile.constants.ts
@@ -28816,17 +29184,19 @@ var parsePercentLabel = (label2) => {
28816
29184
  const parsed = Number(match[1].replace(/,/g, ""));
28817
29185
  return Number.isFinite(parsed) ? parsed : null;
28818
29186
  };
28819
- var formatCurrency = (value) => {
29187
+ var formatCurrency = (value, formatCurrencyOverride) => {
28820
29188
  if (!isFiniteNumber(value)) return missingLabel;
29189
+ if (formatCurrencyOverride) return formatCurrencyOverride(value);
28821
29190
  return usdFormatter.format(value);
28822
29191
  };
28823
- var formatSignedCurrency = (value) => {
29192
+ var formatSignedCurrency = (value, formatCurrencyOverride) => {
28824
29193
  if (!isFiniteNumber(value)) return missingLabel;
28825
- if (value === 0) return usdFormatter.format(0);
28826
- return `${value > 0 ? "+" : "-"}${usdFormatter.format(Math.abs(value))}`;
29194
+ if (value === 0) return formatCurrency(0, formatCurrencyOverride);
29195
+ return `${value > 0 ? "+" : "-"}${formatCurrency(Math.abs(value), formatCurrencyOverride)}`;
28827
29196
  };
28828
- var formatPriceCents2 = (value) => {
29197
+ var formatPriceCents2 = (value, formatPrice) => {
28829
29198
  if (!isFiniteNumber(value)) return missingLabel;
29199
+ if (formatPrice) return formatPrice(value);
28830
29200
  return `${Math.round(value * 100)}\xA2`;
28831
29201
  };
28832
29202
  var formatSignedPercent = (value) => {
@@ -28921,7 +29291,8 @@ var getPositionTone = (value) => {
28921
29291
  if (!isFiniteNumber(value) || value === 0) return "neutral";
28922
29292
  return value > 0 ? "positive" : "negative";
28923
29293
  };
28924
- var toPositionRowViewModel = (position, labels = defaultLabels2) => {
29294
+ var toPositionRowViewModel = (position, labels = defaultLabels2, formatters = {}) => {
29295
+ const { formatCurrency: currency, formatPrice: price } = formatters;
28925
29296
  const positionStatus = resolvePositionStatus(position);
28926
29297
  const currentValue = getCurrentValue(position);
28927
29298
  const currentPnl = getPnlValue(position, currentValue);
@@ -28939,20 +29310,20 @@ var toPositionRowViewModel = (position, labels = defaultLabels2) => {
28939
29310
  resolutionLabel: position.resolutionLabel || position.outcomeLabel || missingLabel,
28940
29311
  venueShareBreakdown: position.venueShareBreakdown,
28941
29312
  totalTraded: {
28942
- primaryLabel: formatCurrency(getTotalTradedValue(position)),
28943
- averageLabel: `${labels.avgPrefix} ${formatPriceCents2(getAveragePrice(position))}`
29313
+ primaryLabel: formatCurrency(getTotalTradedValue(position), currency),
29314
+ averageLabel: `${labels.avgPrefix} ${formatPriceCents2(getAveragePrice(position), price)}`
28944
29315
  },
28945
29316
  currentValue: {
28946
- primaryLabel: formatCurrency(currentValue),
28947
- deltaLabel: formatSignedCurrency(currentPnl),
28948
- priceLabel: `${labels.nowPrefix} ${formatPriceCents2(getCurrentPrice(position))}`,
29317
+ primaryLabel: formatCurrency(currentValue, currency),
29318
+ deltaLabel: formatSignedCurrency(currentPnl, currency),
29319
+ priceLabel: `${labels.nowPrefix} ${formatPriceCents2(getCurrentPrice(position), price)}`,
28949
29320
  percentLabel: formatSignedPercent(currentPercent),
28950
29321
  tone: getPositionTone(currentPnl)
28951
29322
  },
28952
29323
  payout: {
28953
- primaryLabel: formatCurrency(finalPayout),
28954
- deltaLabel: formatSignedCurrency(payoutPnl),
28955
- priceLabel: `${labels.finalPrefix} ${formatPriceCents2(getFinalPrice(position))}`,
29324
+ primaryLabel: formatCurrency(finalPayout, currency),
29325
+ deltaLabel: formatSignedCurrency(payoutPnl, currency),
29326
+ priceLabel: `${labels.finalPrefix} ${formatPriceCents2(getFinalPrice(position), price)}`,
28956
29327
  percentLabel: formatSignedPercent(payoutPercent),
28957
29328
  tone: getPositionTone(payoutPnl)
28958
29329
  },
@@ -29554,11 +29925,24 @@ var EmptyState = ({ title: title2, description, className }) => {
29554
29925
  EmptyState.displayName = "EmptyState";
29555
29926
 
29556
29927
  // src/pages/user-profile/components/open-order-row.tsx
29557
- var import_hooks74 = require("@agg-build/hooks");
29928
+ var import_hooks75 = require("@agg-build/hooks");
29558
29929
  var import_jsx_runtime178 = require("react/jsx-runtime");
29559
29930
  var shouldUseNativeLinkNavigation2 = (event) => {
29560
29931
  return event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button === 1;
29561
29932
  };
29933
+ var CANCELLABLE_LIMIT_ORDER_STATUSES = /* @__PURE__ */ new Set([
29934
+ "submitted",
29935
+ "open",
29936
+ "partially_filled_open",
29937
+ "cancel_pending"
29938
+ ]);
29939
+ var canCancelOpenOrder = (order) => {
29940
+ const status = order.status.trim().toLowerCase();
29941
+ if (status === "pending" && !order.dagRunId) return true;
29942
+ const isLimitOrder = order.orderType === "limit" || order.limitPriceLabel != null;
29943
+ if (!isLimitOrder) return false;
29944
+ return CANCELLABLE_LIMIT_ORDER_STATUSES.has(status);
29945
+ };
29562
29946
  var OpenOrderRow = ({
29563
29947
  order,
29564
29948
  href,
@@ -29573,7 +29957,7 @@ var OpenOrderRow = ({
29573
29957
  expirationHeader
29574
29958
  }) => {
29575
29959
  var _a, _b, _c, _d;
29576
- const labels = (0, import_hooks74.useLabels)().userProfile.openOrders;
29960
+ const labels = (0, import_hooks75.useLabels)().userProfile.openOrders;
29577
29961
  const resolvedCancelLabel = cancelLabel != null ? cancelLabel : labels.cancel;
29578
29962
  const resolvedCancelAriaLabel = cancelAriaLabel != null ? cancelAriaLabel : labels.cancelOrderAria(order.id);
29579
29963
  const resolvedLimitPriceHeader = limitPriceHeader != null ? limitPriceHeader : labels.limitPriceHeader;
@@ -29594,9 +29978,7 @@ var OpenOrderRow = ({
29594
29978
  event.stopPropagation();
29595
29979
  onCancel == null ? void 0 : onCancel(order);
29596
29980
  };
29597
- const status = order.status.toLowerCase();
29598
- const isLimitOrder = order.orderType === "limit";
29599
- const canCancel = status === "open" || status === "partially_filled_open" || status === "cancel_pending" || status === "submitted" && isLimitOrder || status === "pending" && !order.dagRunId;
29981
+ const canCancel = canCancelOpenOrder(order);
29600
29982
  const Wrapper = href ? "a" : "div";
29601
29983
  const wrapperProps = href ? {
29602
29984
  href,
@@ -29628,7 +30010,7 @@ var OpenOrderRow = ({
29628
30010
  /* @__PURE__ */ (0, import_jsx_runtime178.jsx)("div", { className: "agg-open-order-image flex h-10 w-10 shrink-0 items-center justify-center lg:h-15 lg:w-15", children: /* @__PURE__ */ (0, import_jsx_runtime178.jsx)(
29629
30011
  RemoteImage,
29630
30012
  {
29631
- src: (0, import_hooks74.optimizedImageUrl)(order.thumbnailSrc, 60),
30013
+ src: (0, import_hooks75.optimizedImageUrl)(order.thumbnailSrc, 60),
29632
30014
  alt: "",
29633
30015
  className: "h-full w-full rounded-agg-sm object-cover"
29634
30016
  }
@@ -29683,7 +30065,7 @@ var OpenOrderRow = ({
29683
30065
  OpenOrderRow.displayName = "OpenOrderRow";
29684
30066
 
29685
30067
  // src/pages/user-profile/components/position-row.tsx
29686
- var import_hooks75 = require("@agg-build/hooks");
30068
+ var import_hooks76 = require("@agg-build/hooks");
29687
30069
  var import_jsx_runtime179 = require("react/jsx-runtime");
29688
30070
  var shouldUseNativeLinkNavigation3 = (event) => {
29689
30071
  return event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button === 1;
@@ -29821,12 +30203,17 @@ var PositionRow = ({
29821
30203
  onClaim,
29822
30204
  isClaiming = false
29823
30205
  }) => {
29824
- const labels = (0, import_hooks75.useLabels)().userProfile.positions;
29825
- const model = toPositionRowViewModel(position, {
29826
- avgPrefix: labels.avgPrefix,
29827
- nowPrefix: labels.nowPrefix,
29828
- finalPrefix: labels.finalPrefix
29829
- });
30206
+ const labels = (0, import_hooks76.useLabels)().userProfile.positions;
30207
+ const { formatCurrency: formatCurrency2, formatPrice } = (0, import_hooks76.useAggUiConfig)().formatting;
30208
+ const model = toPositionRowViewModel(
30209
+ position,
30210
+ {
30211
+ avgPrefix: labels.avgPrefix,
30212
+ nowPrefix: labels.nowPrefix,
30213
+ finalPrefix: labels.finalPrefix
30214
+ },
30215
+ { formatCurrency: formatCurrency2, formatPrice }
30216
+ );
29830
30217
  const isClosed = (variant != null ? variant : model.bucket) === "closed";
29831
30218
  const handleClaim = (event) => {
29832
30219
  event.preventDefault();
@@ -29875,7 +30262,7 @@ var PositionRow = ({
29875
30262
  /* @__PURE__ */ (0, import_jsx_runtime179.jsx)("div", { className: "agg-position-image flex h-10 w-10 shrink-0 items-center justify-center md:h-15 md:w-15", children: /* @__PURE__ */ (0, import_jsx_runtime179.jsx)(
29876
30263
  RemoteImage,
29877
30264
  {
29878
- src: (0, import_hooks75.optimizedImageUrl)(model.thumbnailSrc, 60),
30265
+ src: (0, import_hooks76.optimizedImageUrl)(model.thumbnailSrc, 60),
29879
30266
  alt: "",
29880
30267
  className: "h-full w-full rounded-agg-sm object-cover"
29881
30268
  }
@@ -30044,9 +30431,10 @@ var PositionsActivity = ({
30044
30431
  initialPositionFilter = "active",
30045
30432
  className
30046
30433
  }) => {
30047
- const userProfileLabels = (0, import_hooks76.useLabels)().userProfile;
30434
+ const userProfileLabels = (0, import_hooks77.useLabels)().userProfile;
30048
30435
  const positionsLabels = userProfileLabels.positions;
30049
30436
  const openOrdersLabels = userProfileLabels.openOrders;
30437
+ const { formatCurrency: formatCurrency2, formatPrice } = (0, import_hooks77.useAggUiConfig)().formatting;
30050
30438
  const tabItems = (0, import_react50.useMemo)(
30051
30439
  () => getTabItems(userProfileLabels.tabs, showOpenOrders),
30052
30440
  [showOpenOrders, userProfileLabels.tabs]
@@ -30125,14 +30513,25 @@ var PositionsActivity = ({
30125
30513
  title: position.title,
30126
30514
  thumbnailSrc: position.thumbnailSrc,
30127
30515
  metaPrimary: position.outcomeLabel,
30128
- metaSecondary: toPositionRowViewModel(position, {
30129
- avgPrefix: positionsLabels.avgPrefix,
30130
- nowPrefix: positionsLabels.nowPrefix,
30131
- finalPrefix: positionsLabels.finalPrefix
30132
- }).currentValue.primaryLabel,
30516
+ metaSecondary: toPositionRowViewModel(
30517
+ position,
30518
+ {
30519
+ avgPrefix: positionsLabels.avgPrefix,
30520
+ nowPrefix: positionsLabels.nowPrefix,
30521
+ finalPrefix: positionsLabels.finalPrefix
30522
+ },
30523
+ { formatCurrency: formatCurrency2, formatPrice }
30524
+ ).currentValue.primaryLabel,
30133
30525
  raw: position
30134
30526
  }));
30135
- }, [filteredPositions, isPositionsTab, positionsLabels, searchValue]);
30527
+ }, [
30528
+ filteredPositions,
30529
+ formatCurrency2,
30530
+ formatPrice,
30531
+ isPositionsTab,
30532
+ positionsLabels,
30533
+ searchValue
30534
+ ]);
30136
30535
  const handleSearchChange = (event) => {
30137
30536
  setSearchValue(event.target.value);
30138
30537
  };
@@ -30303,7 +30702,7 @@ var PositionsActivity = ({
30303
30702
  /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(
30304
30703
  "img",
30305
30704
  {
30306
- src: (0, import_hooks76.optimizedImageUrl)(item.thumbnailSrc, 48),
30705
+ src: (0, import_hooks77.optimizedImageUrl)(item.thumbnailSrc, 48),
30307
30706
  alt: "",
30308
30707
  className: "size-12 shrink-0 rounded-agg-lg object-cover"
30309
30708
  }
@@ -30624,7 +31023,7 @@ var buildAggTxExplorerHref = (chainId, txHash) => {
30624
31023
  };
30625
31024
 
30626
31025
  // src/pages/user-profile/components/user-info-card.tsx
30627
- var import_hooks77 = require("@agg-build/hooks");
31026
+ var import_hooks78 = require("@agg-build/hooks");
30628
31027
  var import_jsx_runtime182 = require("react/jsx-runtime");
30629
31028
  var UserInfoCard = ({
30630
31029
  user,
@@ -30635,7 +31034,7 @@ var UserInfoCard = ({
30635
31034
  className
30636
31035
  }) => {
30637
31036
  var _a;
30638
- const labels = (0, import_hooks77.useLabels)();
31037
+ const labels = (0, import_hooks78.useLabels)();
30639
31038
  const wallets = (_a = user.connectedWallets) != null ? _a : [];
30640
31039
  const hasWallets = wallets.length > 0;
30641
31040
  return /* @__PURE__ */ (0, import_jsx_runtime182.jsxs)(
@@ -30651,7 +31050,7 @@ var UserInfoCard = ({
30651
31050
  /* @__PURE__ */ (0, import_jsx_runtime182.jsx)("div", { className: "agg-profile-avatar shrink-0", children: user.avatarUrl ? /* @__PURE__ */ (0, import_jsx_runtime182.jsx)(
30652
31051
  RemoteImage,
30653
31052
  {
30654
- src: (0, import_hooks77.optimizedImageUrl)(user.avatarUrl, 120),
31053
+ src: (0, import_hooks78.optimizedImageUrl)(user.avatarUrl, 120),
30655
31054
  alt: user.username,
30656
31055
  className: "h-20 w-20 rounded-full object-cover sm:h-[120px] sm:w-[120px]"
30657
31056
  }
@@ -31271,16 +31670,16 @@ var UserProfilePage = ({
31271
31670
  (0, import_react51.useEffect)(() => {
31272
31671
  setIsHydrated(true);
31273
31672
  }, []);
31274
- const { user: currentUser, isAuthenticated } = (0, import_hooks78.useAggAuthState)();
31275
- const { isDepositBlocked } = (0, import_hooks78.useGeoBlock)();
31276
- const balanceState = (0, import_hooks78.useAggBalance)();
31277
- const labels = (0, import_hooks78.useLabels)();
31673
+ const { user: currentUser, isAuthenticated } = (0, import_hooks79.useAggAuthState)();
31674
+ const { isDepositBlocked } = (0, import_hooks79.useGeoBlock)();
31675
+ const balanceState = (0, import_hooks79.useAggBalance)();
31676
+ const labels = (0, import_hooks79.useLabels)();
31278
31677
  const {
31279
31678
  features: { showLimitOrders },
31280
31679
  trading: { executionMode: configuredExecutionMode }
31281
- } = (0, import_hooks78.useSdkUiConfig)();
31282
- const client = (0, import_hooks78.useAggClient)();
31283
- const cancelOrderMutation = (0, import_hooks78.useCancelManagedOrder)();
31680
+ } = (0, import_hooks79.useSdkUiConfig)();
31681
+ const client = (0, import_hooks79.useAggClient)();
31682
+ const cancelOrderMutation = (0, import_hooks79.useCancelManagedOrder)();
31284
31683
  const toastContext = useOptionalToast();
31285
31684
  const [internalCancellingIds, setInternalCancellingIds] = (0, import_react51.useState)({});
31286
31685
  const { claim: startClaim, claimingKeys } = useClaimWinnings({
@@ -31301,13 +31700,13 @@ var UserProfilePage = ({
31301
31700
  const [selectedClaimActivity, setSelectedClaimActivity] = (0, import_react51.useState)(null);
31302
31701
  const resolvedExecutionMode = executionMode != null ? executionMode : configuredExecutionMode;
31303
31702
  const queryExecutionMode = resolvedExecutionMode === "paper" ? "paper" : void 0;
31304
- const activePositionsQuery = (0, import_hooks78.useExecutionPositions)({
31703
+ const activePositionsQuery = (0, import_hooks79.useExecutionPositions)({
31305
31704
  enabled: shouldUseHookData && isAuthenticated,
31306
31705
  status: "active",
31307
31706
  limit: 25,
31308
31707
  mode: queryExecutionMode
31309
31708
  });
31310
- const closedPositionsQuery = (0, import_hooks78.useExecutionPositions)({
31709
+ const closedPositionsQuery = (0, import_hooks79.useExecutionPositions)({
31311
31710
  enabled: shouldUseHookData && isAuthenticated,
31312
31711
  status: "closed",
31313
31712
  limit: 25,
@@ -31323,55 +31722,55 @@ var UserProfilePage = ({
31323
31722
  (0, import_react51.useEffect)(() => {
31324
31723
  setPositionFilter(initialPositionFilter);
31325
31724
  }, [initialPositionFilter]);
31326
- const ordersQuery = (0, import_hooks78.useExecutionOrders)({
31725
+ const ordersQuery = (0, import_hooks79.useExecutionOrders)({
31327
31726
  enabled: shouldUseHookData && isAuthenticated,
31328
31727
  limit: 25,
31329
31728
  mode: queryExecutionMode,
31330
31729
  refetchIntervalMs: 5e3
31331
31730
  });
31332
- const pendingOpenOrdersQuery = (0, import_hooks78.useExecutionOrders)({
31731
+ const pendingOpenOrdersQuery = (0, import_hooks79.useExecutionOrders)({
31333
31732
  enabled: shouldUseHookData && isAuthenticated && !openOrders,
31334
31733
  status: OPEN_ORDER_QUERY_STATUSES[0],
31335
31734
  limit: 25,
31336
31735
  mode: queryExecutionMode
31337
31736
  });
31338
- const signingOpenOrdersQuery = (0, import_hooks78.useExecutionOrders)({
31737
+ const signingOpenOrdersQuery = (0, import_hooks79.useExecutionOrders)({
31339
31738
  enabled: shouldUseHookData && isAuthenticated && !openOrders,
31340
31739
  status: OPEN_ORDER_QUERY_STATUSES[1],
31341
31740
  limit: 25,
31342
31741
  mode: queryExecutionMode
31343
31742
  });
31344
- const pendingBridgeOpenOrdersQuery = (0, import_hooks78.useExecutionOrders)({
31743
+ const pendingBridgeOpenOrdersQuery = (0, import_hooks79.useExecutionOrders)({
31345
31744
  enabled: shouldUseHookData && isAuthenticated && !openOrders,
31346
31745
  status: OPEN_ORDER_QUERY_STATUSES[2],
31347
31746
  limit: 25,
31348
31747
  mode: queryExecutionMode
31349
31748
  });
31350
- const submittingOpenOrdersQuery = (0, import_hooks78.useExecutionOrders)({
31749
+ const submittingOpenOrdersQuery = (0, import_hooks79.useExecutionOrders)({
31351
31750
  enabled: shouldUseHookData && isAuthenticated && !openOrders,
31352
31751
  status: OPEN_ORDER_QUERY_STATUSES[3],
31353
31752
  limit: 25,
31354
31753
  mode: queryExecutionMode
31355
31754
  });
31356
- const submittedOpenOrdersQuery = (0, import_hooks78.useExecutionOrders)({
31755
+ const submittedOpenOrdersQuery = (0, import_hooks79.useExecutionOrders)({
31357
31756
  enabled: shouldUseHookData && isAuthenticated && !openOrders,
31358
31757
  status: OPEN_ORDER_QUERY_STATUSES[4],
31359
31758
  limit: 25,
31360
31759
  mode: queryExecutionMode
31361
31760
  });
31362
- const openOpenOrdersQuery = (0, import_hooks78.useExecutionOrders)({
31761
+ const openOpenOrdersQuery = (0, import_hooks79.useExecutionOrders)({
31363
31762
  enabled: shouldUseHookData && isAuthenticated && !openOrders,
31364
31763
  status: OPEN_ORDER_QUERY_STATUSES[5],
31365
31764
  limit: 25,
31366
31765
  mode: queryExecutionMode
31367
31766
  });
31368
- const partiallyFilledOpenOrdersQuery = (0, import_hooks78.useExecutionOrders)({
31767
+ const partiallyFilledOpenOrdersQuery = (0, import_hooks79.useExecutionOrders)({
31369
31768
  enabled: shouldUseHookData && isAuthenticated && !openOrders,
31370
31769
  status: OPEN_ORDER_QUERY_STATUSES[6],
31371
31770
  limit: 25,
31372
31771
  mode: queryExecutionMode
31373
31772
  });
31374
- const cancelPendingOpenOrdersQuery = (0, import_hooks78.useExecutionOrders)({
31773
+ const cancelPendingOpenOrdersQuery = (0, import_hooks79.useExecutionOrders)({
31375
31774
  enabled: shouldUseHookData && isAuthenticated && !openOrders,
31376
31775
  status: OPEN_ORDER_QUERY_STATUSES[7],
31377
31776
  limit: 25,
@@ -31399,7 +31798,7 @@ var UserProfilePage = ({
31399
31798
  submittingOpenOrdersQuery
31400
31799
  ]
31401
31800
  );
31402
- const activityQuery = (0, import_hooks78.useUserActivity)({
31801
+ const activityQuery = (0, import_hooks79.useUserActivity)({
31403
31802
  enabled: shouldUseHookData && isAuthenticated,
31404
31803
  limit: 25
31405
31804
  });
@@ -31486,7 +31885,7 @@ var UserProfilePage = ({
31486
31885
  var _a2, _b2, _c, _d, _e, _f;
31487
31886
  if (user) return user;
31488
31887
  const fullUser = profileUser != null ? profileUser : currentUser;
31489
- const walletAddress = (0, import_hooks78.getWalletAddressFromUserProfile)(fullUser);
31888
+ const walletAddress = (0, import_hooks79.getWalletAddressFromUserProfile)(fullUser);
31490
31889
  const fallbackUsername = walletAddress && shortenAddress(walletAddress) || "username";
31491
31890
  const twitterAccount = (_a2 = fullUser == null ? void 0 : fullUser.accounts) == null ? void 0 : _a2.find(
31492
31891
  (account) => String(account.provider).toLowerCase() === "twitter"
@@ -31541,8 +31940,8 @@ var UserProfilePage = ({
31541
31940
  const reserved = (_a2 = balanceState.reservedBalance) != null ? _a2 : 0;
31542
31941
  return reserved > 0 ? formatUsd2(reserved) : void 0;
31543
31942
  }, [balanceState.reservedBalance]);
31544
- const { disabledVenues, isLoading: isAppConfigLoading } = (0, import_hooks78.useAppConfig)();
31545
- const isKalshiAvailable = (0, import_hooks78.getVenueAvailabilityState)({
31943
+ const { disabledVenues, isLoading: isAppConfigLoading } = (0, import_hooks79.useAppConfig)();
31944
+ const isKalshiAvailable = (0, import_hooks79.getVenueAvailabilityState)({
31546
31945
  venueId: import_sdk26.Venue.kalshi,
31547
31946
  disabledVenues,
31548
31947
  isConfigLoading: isAppConfigLoading
@@ -31768,7 +32167,7 @@ var UserProfilePage = ({
31768
32167
  (groups) => {
31769
32168
  return groups.flatMap((group) => {
31770
32169
  var _a2, _b2, _c, _d;
31771
- const closedTotals = (0, import_hooks78.computeClosedPositionTotals)(group);
32170
+ const closedTotals = (0, import_hooks79.computeClosedPositionTotals)(group);
31772
32171
  const winningOutcome = group.venueMarket.venueMarketOutcomes.find(
31773
32172
  (outcome) => outcome.winner === true
31774
32173
  );
@@ -32008,7 +32407,7 @@ var UserProfilePage = ({
32008
32407
  UserProfilePage.displayName = "UserProfilePage";
32009
32408
 
32010
32409
  // src/deposit/index.tsx
32011
- var import_hooks89 = require("@agg-build/hooks");
32410
+ var import_hooks90 = require("@agg-build/hooks");
32012
32411
  var import_deposit = require("@agg-build/hooks/deposit");
32013
32412
  var import_react54 = require("react");
32014
32413
 
@@ -32241,7 +32640,7 @@ var NETWORK_TO_CURRENCY_CODE = {
32241
32640
  };
32242
32641
 
32243
32642
  // src/deposit/steps/card-deposit.tsx
32244
- var import_hooks79 = require("@agg-build/hooks");
32643
+ var import_hooks80 = require("@agg-build/hooks");
32245
32644
  var import_react52 = require("react");
32246
32645
  var import_jsx_runtime184 = require("react/jsx-runtime");
32247
32646
  var CardDepositStep = ({
@@ -32259,7 +32658,7 @@ var CardDepositStep = ({
32259
32658
  onNetworkChange,
32260
32659
  onContinue
32261
32660
  }) => {
32262
- const labels = (0, import_hooks79.useLabels)();
32661
+ const labels = (0, import_hooks80.useLabels)();
32263
32662
  const [localAmount, setLocalAmount] = (0, import_react52.useState)(amount);
32264
32663
  (0, import_react52.useEffect)(() => {
32265
32664
  setLocalAmount(amount);
@@ -32376,7 +32775,7 @@ var CardDepositStep = ({
32376
32775
  };
32377
32776
 
32378
32777
  // src/deposit/steps/card-payment-pending.tsx
32379
- var import_hooks80 = require("@agg-build/hooks");
32778
+ var import_hooks81 = require("@agg-build/hooks");
32380
32779
  var import_jsx_runtime185 = require("react/jsx-runtime");
32381
32780
  var CardPaymentPendingStep = ({
32382
32781
  providerName,
@@ -32385,7 +32784,7 @@ var CardPaymentPendingStep = ({
32385
32784
  onViewActivity,
32386
32785
  onChooseAnotherProvider
32387
32786
  }) => {
32388
- const labels = (0, import_hooks80.useLabels)();
32787
+ const labels = (0, import_hooks81.useLabels)();
32389
32788
  return /* @__PURE__ */ (0, import_jsx_runtime185.jsx)("div", { className: "relative", children: /* @__PURE__ */ (0, import_jsx_runtime185.jsxs)(Modal.Body, { classNames: { root: "px-5 py-8 sm:px-8 sm:py-10" }, children: [
32390
32789
  /* @__PURE__ */ (0, import_jsx_runtime185.jsx)(
32391
32790
  "button",
@@ -32435,10 +32834,10 @@ var CardPaymentPendingStep = ({
32435
32834
  };
32436
32835
 
32437
32836
  // src/deposit/steps/card-provider.tsx
32438
- var import_hooks81 = require("@agg-build/hooks");
32837
+ var import_hooks82 = require("@agg-build/hooks");
32439
32838
  var import_jsx_runtime186 = require("react/jsx-runtime");
32440
32839
  var CardProviderItem = ({ provider, onSelect }) => {
32441
- const labels = (0, import_hooks81.useLabels)();
32840
+ const labels = (0, import_hooks82.useLabels)();
32442
32841
  const badgeText = provider.badge === "best" ? labels.deposit.cardFlow.providerBadges.best : provider.badge === "low-kyc" ? labels.deposit.cardFlow.providerBadges.lowKyc : void 0;
32443
32842
  return /* @__PURE__ */ (0, import_jsx_runtime186.jsx)(
32444
32843
  "button",
@@ -32484,7 +32883,7 @@ var CardProviderStep = ({
32484
32883
  onSelectProvider,
32485
32884
  onRetry
32486
32885
  }) => {
32487
- const labels = (0, import_hooks81.useLabels)();
32886
+ const labels = (0, import_hooks82.useLabels)();
32488
32887
  return /* @__PURE__ */ (0, import_jsx_runtime186.jsxs)(import_jsx_runtime186.Fragment, { children: [
32489
32888
  /* @__PURE__ */ (0, import_jsx_runtime186.jsx)(
32490
32889
  Modal.Header,
@@ -32548,7 +32947,7 @@ var CardProviderStep = ({
32548
32947
  };
32549
32948
 
32550
32949
  // src/deposit/steps/card-purchase-success.tsx
32551
- var import_hooks82 = require("@agg-build/hooks");
32950
+ var import_hooks83 = require("@agg-build/hooks");
32552
32951
  var import_jsx_runtime187 = require("react/jsx-runtime");
32553
32952
  var SummaryRow = ({ label: label2, value }) => /* @__PURE__ */ (0, import_jsx_runtime187.jsxs)("div", { className: "flex items-center justify-between border-b border-agg-separator py-2 last:border-b-0", children: [
32554
32953
  /* @__PURE__ */ (0, import_jsx_runtime187.jsx)("p", { className: "text-[12px] leading-4 font-agg-bold uppercase text-agg-muted-foreground", children: label2 }),
@@ -32559,7 +32958,7 @@ var CardPurchaseSuccessStep = ({
32559
32958
  onDone,
32560
32959
  onClose
32561
32960
  }) => {
32562
- const labels = (0, import_hooks82.useLabels)();
32961
+ const labels = (0, import_hooks83.useLabels)();
32563
32962
  return /* @__PURE__ */ (0, import_jsx_runtime187.jsx)("div", { className: "relative", children: /* @__PURE__ */ (0, import_jsx_runtime187.jsxs)(Modal.Body, { classNames: { root: "px-5 py-8 sm:px-8 sm:py-10" }, children: [
32564
32963
  /* @__PURE__ */ (0, import_jsx_runtime187.jsx)(
32565
32964
  "button",
@@ -32594,10 +32993,10 @@ var CardPurchaseSuccessStep = ({
32594
32993
  };
32595
32994
 
32596
32995
  // src/deposit/steps/crypto-transfer.tsx
32597
- var import_hooks84 = require("@agg-build/hooks");
32996
+ var import_hooks85 = require("@agg-build/hooks");
32598
32997
 
32599
32998
  // src/shared/transfer-fee-summary.tsx
32600
- var import_hooks83 = require("@agg-build/hooks");
32999
+ var import_hooks84 = require("@agg-build/hooks");
32601
33000
  var import_jsx_runtime188 = require("react/jsx-runtime");
32602
33001
  var separator = /* @__PURE__ */ (0, import_jsx_runtime188.jsx)("span", { className: "text-agg-muted-foreground", "aria-hidden": "true", children: "\xB7" });
32603
33002
  var normalizeFeeLabel = (label2) => label2.replace(/\s*~\s*$/, "");
@@ -32607,7 +33006,7 @@ var TransferFeeSummary = ({
32607
33006
  minDeposit,
32608
33007
  eta
32609
33008
  }) => {
32610
- const labels = (0, import_hooks83.useLabels)();
33009
+ const labels = (0, import_hooks84.useLabels)();
32611
33010
  if (!estimate) return null;
32612
33011
  if (view === "deposit") {
32613
33012
  return /* @__PURE__ */ (0, import_jsx_runtime188.jsxs)("p", { className: "agg-type-label flex flex-wrap items-center gap-x-2 gap-y-1 text-agg-foreground", children: [
@@ -32713,7 +33112,7 @@ DepositQRCode.displayName = "DepositQRCode";
32713
33112
  // src/deposit/steps/crypto-transfer.tsx
32714
33113
  var import_jsx_runtime190 = require("react/jsx-runtime");
32715
33114
  var CryptoAddressLoadingState = () => {
32716
- const labels = (0, import_hooks84.useLabels)();
33115
+ const labels = (0, import_hooks85.useLabels)();
32717
33116
  const sendCryptoLabels = labels.deposit.sendCrypto;
32718
33117
  return /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(
32719
33118
  "div",
@@ -32758,11 +33157,11 @@ var CryptoTransferStep = ({
32758
33157
  onDone
32759
33158
  }) => {
32760
33159
  var _a;
32761
- const labels = (0, import_hooks84.useLabels)();
33160
+ const labels = (0, import_hooks85.useLabels)();
32762
33161
  const selectedNetworkOption = networkOptions.find((n) => n.value === selectedNetwork);
32763
33162
  const networkLogoUrl = (_a = selectedNetworkOption == null ? void 0 : selectedNetworkOption.iconUrl) != null ? _a : "";
32764
33163
  const networkLogo = selectedNetworkOption == null ? void 0 : selectedNetworkOption.icon;
32765
- const transferFeeEstimate = (0, import_hooks84.useWithdrawEstimate)({
33164
+ const transferFeeEstimate = (0, import_hooks85.useWithdrawEstimate)({
32766
33165
  amount: getEstimateAmountFromMinDeposit(minDeposit),
32767
33166
  selectedToken,
32768
33167
  selectedNetwork
@@ -32865,7 +33264,7 @@ var CryptoTransferStep = ({
32865
33264
  };
32866
33265
 
32867
33266
  // src/deposit/steps/deposit-method.tsx
32868
- var import_hooks85 = require("@agg-build/hooks");
33267
+ var import_hooks86 = require("@agg-build/hooks");
32869
33268
  var import_jsx_runtime191 = require("react/jsx-runtime");
32870
33269
  var DepositMethodCard = ({
32871
33270
  icon,
@@ -32918,7 +33317,7 @@ var DepositMethodStep = ({
32918
33317
  depositAddressesReady = true,
32919
33318
  onSelectMethod
32920
33319
  }) => {
32921
- const labels = (0, import_hooks85.useLabels)();
33320
+ const labels = (0, import_hooks86.useLabels)();
32922
33321
  return /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(import_jsx_runtime191.Fragment, { children: [
32923
33322
  /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(Modal.Header, { title: labels.deposit.title, hideBorder: true }),
32924
33323
  /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(Modal.Body, { classNames: { root: "px-5 pt-0 pb-6 sm:px-8 sm:pt-0 sm:pb-8" }, children: /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "flex flex-col gap-5", children: [
@@ -32967,7 +33366,7 @@ var DepositMethodStep = ({
32967
33366
  };
32968
33367
 
32969
33368
  // src/deposit/steps/wallet-form.tsx
32970
- var import_hooks86 = require("@agg-build/hooks");
33369
+ var import_hooks87 = require("@agg-build/hooks");
32971
33370
  var import_jsx_runtime192 = require("react/jsx-runtime");
32972
33371
  var WalletFormStep = ({
32973
33372
  walletLabel,
@@ -32991,7 +33390,7 @@ var WalletFormStep = ({
32991
33390
  onMax,
32992
33391
  onConfirm
32993
33392
  }) => {
32994
- const labels = (0, import_hooks86.useLabels)();
33393
+ const labels = (0, import_hooks87.useLabels)();
32995
33394
  const isConfirmEnabled = !isSubmitting && !isBalanceLoading && Number(amount) > 0 && Number(amount) <= walletBalance;
32996
33395
  return /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)(import_jsx_runtime192.Fragment, { children: [
32997
33396
  /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(
@@ -33117,7 +33516,7 @@ var WalletFormStep = ({
33117
33516
  };
33118
33517
 
33119
33518
  // src/deposit/steps/wallet-processing.tsx
33120
- var import_hooks87 = require("@agg-build/hooks");
33519
+ var import_hooks88 = require("@agg-build/hooks");
33121
33520
  var import_react53 = require("react");
33122
33521
  var import_jsx_runtime193 = require("react/jsx-runtime");
33123
33522
  var WalletProcessingStep = ({
@@ -33125,7 +33524,7 @@ var WalletProcessingStep = ({
33125
33524
  errorMessage,
33126
33525
  onComplete
33127
33526
  }) => {
33128
- const labels = (0, import_hooks87.useLabels)();
33527
+ const labels = (0, import_hooks88.useLabels)();
33129
33528
  (0, import_react53.useEffect)(() => {
33130
33529
  const allDone = steps.length > 0 && steps.every((s) => s.status === "complete");
33131
33530
  if (allDone) {
@@ -33164,7 +33563,7 @@ var WalletProcessingStep = ({
33164
33563
  };
33165
33564
 
33166
33565
  // src/deposit/steps/wallet-success.tsx
33167
- var import_hooks88 = require("@agg-build/hooks");
33566
+ var import_hooks89 = require("@agg-build/hooks");
33168
33567
  var import_jsx_runtime194 = require("react/jsx-runtime");
33169
33568
  var SummaryRow2 = ({ label: label2, value }) => /* @__PURE__ */ (0, import_jsx_runtime194.jsxs)("div", { className: "flex items-center justify-between border-b border-agg-separator py-2 last:border-b-0", children: [
33170
33569
  /* @__PURE__ */ (0, import_jsx_runtime194.jsx)("p", { className: "text-[12px] leading-4 font-agg-bold uppercase text-agg-muted-foreground", children: label2 }),
@@ -33175,7 +33574,7 @@ var WalletSuccessStep = ({
33175
33574
  onDone,
33176
33575
  onClose
33177
33576
  }) => {
33178
- const labels = (0, import_hooks88.useLabels)();
33577
+ const labels = (0, import_hooks89.useLabels)();
33179
33578
  return /* @__PURE__ */ (0, import_jsx_runtime194.jsx)("div", { className: "relative", children: /* @__PURE__ */ (0, import_jsx_runtime194.jsxs)(Modal.Body, { classNames: { root: "px-5 py-8 sm:px-8 sm:py-10" }, children: [
33180
33579
  /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(
33181
33580
  "button",
@@ -33295,9 +33694,9 @@ function DepositModalControlled({
33295
33694
  pendingCardPurchaseSummary
33296
33695
  }) {
33297
33696
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
33298
- const { isWeb3User } = (0, import_hooks89.useAggAuthState)();
33299
- const { walletActions } = (0, import_hooks89.useAggUiConfig)();
33300
- const labels = (0, import_hooks89.useLabels)();
33697
+ const { isWeb3User } = (0, import_hooks90.useAggAuthState)();
33698
+ const { walletActions } = (0, import_hooks90.useAggUiConfig)();
33699
+ const labels = (0, import_hooks90.useLabels)();
33301
33700
  const defaultMethod = isWeb3User ? "wallet" : "crypto";
33302
33701
  const [step, setStep] = (0, import_react54.useState)(
33303
33702
  () => pendingCardPurchaseSummary ? "card-success" : "method"
@@ -33329,7 +33728,7 @@ function DepositModalControlled({
33329
33728
  error: addrError,
33330
33729
  supportedChains,
33331
33730
  getAddress
33332
- } = (0, import_hooks89.useDepositAddresses)({ enabled: open });
33731
+ } = (0, import_hooks90.useDepositAddresses)({ enabled: open });
33333
33732
  const fallbackNetworkOptions = (0, import_react54.useMemo)(() => mapNetworksToOptions(), []);
33334
33733
  const networkOptions = (0, import_react54.useMemo)(() => {
33335
33734
  if (!(supportedChains == null ? void 0 : supportedChains.length)) return fallbackNetworkOptions;
@@ -33775,13 +34174,13 @@ var import_react55 = require("react");
33775
34174
  var import_withdraw = require("@agg-build/hooks/withdraw");
33776
34175
 
33777
34176
  // src/withdraw/steps/withdraw-method.tsx
33778
- var import_hooks90 = require("@agg-build/hooks");
34177
+ var import_hooks91 = require("@agg-build/hooks");
33779
34178
  var import_jsx_runtime196 = require("react/jsx-runtime");
33780
34179
  var WithdrawMethodStep = ({
33781
34180
  balance,
33782
34181
  onSelectMethod
33783
34182
  }) => {
33784
- const labels = (0, import_hooks90.useLabels)();
34183
+ const labels = (0, import_hooks91.useLabels)();
33785
34184
  return /* @__PURE__ */ (0, import_jsx_runtime196.jsxs)(import_jsx_runtime196.Fragment, { children: [
33786
34185
  /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(Modal.Header, { title: labels.withdraw.title, hideBorder: true }),
33787
34186
  /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(Modal.Body, { classNames: { root: "px-5 pt-0 pb-6 sm:px-8 sm:pt-0 sm:pb-8" }, children: /* @__PURE__ */ (0, import_jsx_runtime196.jsxs)("div", { className: "flex flex-col gap-5", children: [
@@ -33821,7 +34220,7 @@ var WithdrawMethodStep = ({
33821
34220
  };
33822
34221
 
33823
34222
  // src/withdraw/steps/withdraw-amount.tsx
33824
- var import_hooks91 = require("@agg-build/hooks");
34223
+ var import_hooks92 = require("@agg-build/hooks");
33825
34224
  var import_jsx_runtime197 = require("react/jsx-runtime");
33826
34225
  var formatRawTokenAmount = (rawAmount, decimals) => {
33827
34226
  if (!rawAmount) return "0";
@@ -33866,7 +34265,7 @@ var WithdrawAmountStep = ({
33866
34265
  onContinue
33867
34266
  }) => {
33868
34267
  var _a, _b, _c, _d;
33869
- const labels = (0, import_hooks91.useLabels)();
34268
+ const labels = (0, import_hooks92.useLabels)();
33870
34269
  const SOLANA_CHAIN_ID = "792703809";
33871
34270
  const isSolanaDest = selectedNetwork === SOLANA_CHAIN_ID;
33872
34271
  const trimmedDestination = destinationWallet.trim();
@@ -33874,7 +34273,7 @@ var WithdrawAmountStep = ({
33874
34273
  const isValid = Number(amount) > 0 && isValidAddress;
33875
34274
  const amountRaw = amount && Number(amount) > 0 ? parseTokenAmountToRaw(amount, destDecimals) : null;
33876
34275
  const destinationChainId = Number(selectedNetwork) || null;
33877
- const preview = (0, import_hooks91.useWithdrawPreview)({
34276
+ const preview = (0, import_hooks92.useWithdrawPreview)({
33878
34277
  amountRaw,
33879
34278
  tokenSymbol: selectedToken || null,
33880
34279
  destinationChainId,
@@ -34013,7 +34412,7 @@ var WithdrawAmountStep = ({
34013
34412
  };
34014
34413
 
34015
34414
  // src/withdraw/steps/withdraw-success.tsx
34016
- var import_hooks92 = require("@agg-build/hooks");
34415
+ var import_hooks93 = require("@agg-build/hooks");
34017
34416
  var import_jsx_runtime198 = require("react/jsx-runtime");
34018
34417
  var SummaryRow3 = ({ label: label2, value }) => /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("div", { className: "flex items-center justify-between gap-4 border-b border-agg-separator py-2 last:border-b-0", children: [
34019
34418
  /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("p", { className: "min-w-0 text-[12px] leading-4 font-agg-bold uppercase text-agg-muted-foreground", children: label2 }),
@@ -34058,10 +34457,10 @@ var WithdrawLoadingStep = ({
34058
34457
  lifecycleState,
34059
34458
  onClose
34060
34459
  }) => {
34061
- const labels = (0, import_hooks92.useLabels)();
34460
+ const labels = (0, import_hooks93.useLabels)();
34062
34461
  const {
34063
34462
  features: { enableAnimations }
34064
- } = (0, import_hooks92.useSdkUiConfig)();
34463
+ } = (0, import_hooks93.useSdkUiConfig)();
34065
34464
  const walletFlowLabels = labels.withdraw.walletFlow;
34066
34465
  const activeIndex = loadingActiveIndexFor(lifecycleState);
34067
34466
  const loadingSteps = getLoadingSteps(walletFlowLabels);
@@ -34145,7 +34544,7 @@ var WithdrawSuccessStep = ({
34145
34544
  onRetry,
34146
34545
  onClose
34147
34546
  }) => {
34148
- const labels = (0, import_hooks92.useLabels)();
34547
+ const labels = (0, import_hooks93.useLabels)();
34149
34548
  const walletFlowLabels = labels.withdraw.walletFlow;
34150
34549
  const { title: title2, description } = resultCopyFor({
34151
34550
  status: resultStatus,
@@ -34452,27 +34851,33 @@ var WithdrawModal = (props) => {
34452
34851
  WithdrawModal.displayName = "WithdrawModal";
34453
34852
 
34454
34853
  // src/profile/index.tsx
34455
- var import_react58 = require("react");
34456
- var import_hooks95 = require("@agg-build/hooks");
34854
+ var import_react59 = require("react");
34855
+ var import_hooks97 = require("@agg-build/hooks");
34457
34856
  var import_sdk27 = require("@agg-build/sdk");
34458
34857
 
34459
34858
  // src/profile/profile-modal.constants.ts
34460
34859
  var PROFILE_TAB_KEYS = {
34461
34860
  PROFILE_ACCOUNTS: "profile-accounts",
34462
- TRADING_ACCESS: "trading-access"
34861
+ TRADING_ACCESS: "trading-access",
34862
+ BALANCE_MANAGEMENT: "balance-management"
34463
34863
  };
34464
- var PROFILE_TAB_ITEMS = [
34864
+ var getProfileTabItems = (balanceManagementLabel) => [
34465
34865
  {
34466
34866
  value: PROFILE_TAB_KEYS.PROFILE_ACCOUNTS,
34467
34867
  label: "Profile & accounts",
34468
34868
  icon: "profile-about-tab"
34469
34869
  },
34470
- { value: PROFILE_TAB_KEYS.TRADING_ACCESS, label: "Trading access", icon: "shield-trust" }
34870
+ { value: PROFILE_TAB_KEYS.TRADING_ACCESS, label: "Trading access", icon: "shield-trust" },
34871
+ {
34872
+ value: PROFILE_TAB_KEYS.BALANCE_MANAGEMENT,
34873
+ label: balanceManagementLabel,
34874
+ icon: "bolt"
34875
+ }
34471
34876
  ];
34472
34877
 
34473
34878
  // src/profile/tabs/about-tab.tsx
34474
34879
  var import_react56 = require("react");
34475
- var import_hooks93 = require("@agg-build/hooks");
34880
+ var import_hooks94 = require("@agg-build/hooks");
34476
34881
  var import_jsx_runtime200 = require("react/jsx-runtime");
34477
34882
  var AboutTab = ({
34478
34883
  avatarPreview,
@@ -34483,7 +34888,7 @@ var AboutTab = ({
34483
34888
  draftAvatarPreview,
34484
34889
  avatarError: _avatarError
34485
34890
  }) => {
34486
- const labels = (0, import_hooks93.useLabels)();
34891
+ const labels = (0, import_hooks94.useLabels)();
34487
34892
  const fileInputRef = (0, import_react56.useRef)(null);
34488
34893
  const handleAvatarClick = (0, import_react56.useCallback)(() => {
34489
34894
  var _a;
@@ -34758,7 +35163,7 @@ var AccountsWalletsTab = ({
34758
35163
  AccountsWalletsTab.displayName = "AccountsWalletsTab";
34759
35164
 
34760
35165
  // src/profile/tabs/trading-access-tab.tsx
34761
- var import_hooks94 = require("@agg-build/hooks");
35166
+ var import_hooks95 = require("@agg-build/hooks");
34762
35167
  var import_react57 = require("react");
34763
35168
  var import_jsx_runtime202 = require("react/jsx-runtime");
34764
35169
  var TRADING_ACCESS_VENUES = [
@@ -34785,14 +35190,14 @@ var AccessRow = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime202.jsx)
34785
35190
  }
34786
35191
  );
34787
35192
  var AvailableStatus = () => {
34788
- const labels = (0, import_hooks94.useLabels)();
35193
+ const labels = (0, import_hooks95.useLabels)();
34789
35194
  return /* @__PURE__ */ (0, import_jsx_runtime202.jsxs)("div", { className: "flex items-center gap-2", children: [
34790
35195
  /* @__PURE__ */ (0, import_jsx_runtime202.jsx)(Icon, { name: "check-badge", size: "small", className: "text-agg-primary" }),
34791
35196
  /* @__PURE__ */ (0, import_jsx_runtime202.jsx)("span", { className: "text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground whitespace-nowrap", children: labels.trading.tradingAccessAvailable })
34792
35197
  ] });
34793
35198
  };
34794
35199
  var GeoblockedStatus = () => {
34795
- const labels = (0, import_hooks94.useLabels)();
35200
+ const labels = (0, import_hooks95.useLabels)();
34796
35201
  return /* @__PURE__ */ (0, import_jsx_runtime202.jsxs)("div", { className: "flex items-center gap-2 text-agg-muted-foreground", children: [
34797
35202
  /* @__PURE__ */ (0, import_jsx_runtime202.jsx)(Icon, { name: "warning-filled", size: "small", color: "currentColor" }),
34798
35203
  /* @__PURE__ */ (0, import_jsx_runtime202.jsx)("span", { className: "text-agg-sm font-agg-normal leading-agg-5 whitespace-nowrap", children: labels.trading.venueUnavailableInRegion })
@@ -34804,12 +35209,12 @@ var TradingAccessTab = ({
34804
35209
  onDisconnectKalshi
34805
35210
  }) => {
34806
35211
  var _a, _b, _c, _d;
34807
- const labels = (0, import_hooks94.useLabels)();
35212
+ const labels = (0, import_hooks95.useLabels)();
34808
35213
  const verifyConnectionLabel = (_d = (_c = (_b = (_a = labels.onboarding) == null ? void 0 : _a.connectKalshiModal) == null ? void 0 : _b.actions) == null ? void 0 : _c.verifyConnection) != null ? _d : labels.trading.kycVerify;
34809
- const { disabledVenues, isLoading: isAppConfigLoading } = (0, import_hooks94.useAppConfig)();
34810
- const { isLocationBlocked } = (0, import_hooks94.useGeoBlock)();
35214
+ const { disabledVenues, isLoading: isAppConfigLoading } = (0, import_hooks95.useAppConfig)();
35215
+ const { isLocationBlocked } = (0, import_hooks95.useGeoBlock)();
34811
35216
  const visibleVenues = (0, import_react57.useMemo)(
34812
- () => (0, import_hooks94.getVisibleVenuesByConfig)(TRADING_ACCESS_VENUE_ITEMS, disabledVenues),
35217
+ () => (0, import_hooks95.getVisibleVenuesByConfig)(TRADING_ACCESS_VENUE_ITEMS, disabledVenues),
34813
35218
  [disabledVenues]
34814
35219
  );
34815
35220
  return /* @__PURE__ */ (0, import_jsx_runtime202.jsxs)("div", { className: "agg-trading-access-section flex flex-col gap-4", children: [
@@ -34820,7 +35225,7 @@ var TradingAccessTab = ({
34820
35225
  const isKalshi = venue === "kalshi";
34821
35226
  const isConnected = (venueAccount == null ? void 0 : venueAccount.status) === "active";
34822
35227
  const isVerified = (venueAccount == null ? void 0 : venueAccount.kycStatus) === "verified";
34823
- const availabilityState = (0, import_hooks94.getVenueAvailabilityState)({
35228
+ const availabilityState = (0, import_hooks95.getVenueAvailabilityState)({
34824
35229
  venueId: venue,
34825
35230
  disabledVenues,
34826
35231
  isConfigLoading: isKalshi && isAppConfigLoading,
@@ -34873,8 +35278,187 @@ var TradingAccessTab = ({
34873
35278
  };
34874
35279
  TradingAccessTab.displayName = "TradingAccessTab";
34875
35280
 
34876
- // src/profile/index.tsx
35281
+ // src/profile/tabs/balance-management-tab.tsx
35282
+ var import_react58 = require("react");
35283
+ var import_hooks96 = require("@agg-build/hooks");
34877
35284
  var import_jsx_runtime203 = require("react/jsx-runtime");
35285
+ var CHAIN_IDS_BY_NETWORK = {
35286
+ mainnet: 1,
35287
+ bnb: 56,
35288
+ polygon: 137,
35289
+ base: 8453,
35290
+ arbitrum: 42161,
35291
+ solana: 792703809,
35292
+ hyperliquid: 1337
35293
+ };
35294
+ var NETWORK_BY_CHAIN_ID = Object.fromEntries(
35295
+ Object.entries(CHAIN_IDS_BY_NETWORK).map(([network, chainId]) => [chainId, network])
35296
+ );
35297
+ var networkItems = SUPPORTED_NETWORKS.filter(
35298
+ (network) => network.value in CHAIN_IDS_BY_NETWORK
35299
+ ).map((network) => ({
35300
+ value: network.value,
35301
+ label: network.label,
35302
+ iconUrl: network.iconUrl
35303
+ }));
35304
+ var dollarsToRaw = (amount) => String(Math.round(amount * 1e6));
35305
+ var rawToDollars = (amount) => Number(amount) / 1e6;
35306
+ var BalanceManagementTab = ({ enabled }) => {
35307
+ const labels = (0, import_hooks96.useAggLabels)().balanceRefill;
35308
+ const { policies, isLoading, isError, createPolicy, updatePolicy } = (0, import_hooks96.useBalanceRefillPolicies)({
35309
+ enabled
35310
+ });
35311
+ const policy = policies[0];
35312
+ const [network, setNetwork] = (0, import_react58.useState)("polygon");
35313
+ const [minimum, setMinimum] = (0, import_react58.useState)(100);
35314
+ const [refillAmount, setRefillAmount] = (0, import_react58.useState)(50);
35315
+ const [dailyCap, setDailyCap] = (0, import_react58.useState)(200);
35316
+ const [maximumFee, setMaximumFee] = (0, import_react58.useState)(2);
35317
+ const [feedback, setFeedback] = (0, import_react58.useState)(null);
35318
+ (0, import_react58.useEffect)(() => {
35319
+ var _a;
35320
+ if (!policy) return;
35321
+ setNetwork((_a = NETWORK_BY_CHAIN_ID[policy.targetChainId]) != null ? _a : "polygon");
35322
+ setMinimum(rawToDollars(policy.minimumRaw));
35323
+ setRefillAmount(rawToDollars(policy.refillAmountRaw));
35324
+ setDailyCap(rawToDollars(policy.dailyCapRaw));
35325
+ setMaximumFee(rawToDollars(policy.maxFeeRaw));
35326
+ }, [policy]);
35327
+ const validationError = (0, import_react58.useMemo)(() => {
35328
+ if (minimum <= 0 || refillAmount <= 0 || dailyCap <= 0 || maximumFee <= 0) {
35329
+ return labels.saveError;
35330
+ }
35331
+ if (dailyCap < Math.max(minimum, refillAmount) + maximumFee) {
35332
+ return labels.saveError;
35333
+ }
35334
+ return null;
35335
+ }, [dailyCap, labels.saveError, maximumFee, minimum, refillAmount]);
35336
+ const isPending = createPolicy.isPending || updatePolicy.isPending;
35337
+ const handleSave = () => __async(null, null, function* () {
35338
+ if (validationError) {
35339
+ setFeedback(validationError);
35340
+ return;
35341
+ }
35342
+ setFeedback(null);
35343
+ const params = {
35344
+ minimumRaw: dollarsToRaw(minimum),
35345
+ refillAmountRaw: dollarsToRaw(refillAmount),
35346
+ dailyCapRaw: dollarsToRaw(dailyCap),
35347
+ maxFeeRaw: dollarsToRaw(maximumFee)
35348
+ };
35349
+ try {
35350
+ if (policy) {
35351
+ yield updatePolicy.mutateAsync({ policyId: policy.id, params });
35352
+ } else {
35353
+ yield createPolicy.mutateAsync(__spreadProps(__spreadValues({}, params), {
35354
+ targetChainId: CHAIN_IDS_BY_NETWORK[network],
35355
+ targetTokenSymbol: "USDC"
35356
+ }));
35357
+ }
35358
+ setFeedback(labels.saved);
35359
+ } catch (e) {
35360
+ setFeedback(labels.saveError);
35361
+ }
35362
+ });
35363
+ const handleStatus = () => __async(null, null, function* () {
35364
+ if (!policy) return;
35365
+ try {
35366
+ yield updatePolicy.mutateAsync({
35367
+ policyId: policy.id,
35368
+ params: { status: policy.status === "enabled" ? "paused" : "enabled" }
35369
+ });
35370
+ setFeedback(labels.saved);
35371
+ } catch (e) {
35372
+ setFeedback(labels.saveError);
35373
+ }
35374
+ });
35375
+ if (isLoading)
35376
+ return /* @__PURE__ */ (0, import_jsx_runtime203.jsx)("p", { className: "text-agg-sm text-agg-secondary-foreground", children: labels.loading });
35377
+ if (isError)
35378
+ return /* @__PURE__ */ (0, import_jsx_runtime203.jsx)("p", { role: "alert", className: "text-agg-sm text-agg-error", children: labels.loadError });
35379
+ const latestAttempt = policy == null ? void 0 : policy.latestAttempt;
35380
+ return /* @__PURE__ */ (0, import_jsx_runtime203.jsxs)("section", { className: "agg-balance-management-tab flex flex-col gap-6", children: [
35381
+ /* @__PURE__ */ (0, import_jsx_runtime203.jsxs)("div", { className: "flex flex-col gap-2", children: [
35382
+ /* @__PURE__ */ (0, import_jsx_runtime203.jsx)("h2", { className: "text-agg-lg font-agg-semibold text-agg-foreground", children: labels.title }),
35383
+ /* @__PURE__ */ (0, import_jsx_runtime203.jsx)("p", { className: "text-agg-sm text-agg-secondary-foreground", children: labels.description })
35384
+ ] }),
35385
+ /* @__PURE__ */ (0, import_jsx_runtime203.jsxs)("div", { className: "rounded-agg-lg border border-agg-separator p-5 flex flex-col gap-5", children: [
35386
+ /* @__PURE__ */ (0, import_jsx_runtime203.jsxs)("label", { className: "flex flex-col gap-2 text-agg-sm text-agg-foreground", children: [
35387
+ /* @__PURE__ */ (0, import_jsx_runtime203.jsx)("span", { children: labels.networkLabel }),
35388
+ /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(
35389
+ Select,
35390
+ {
35391
+ items: networkItems,
35392
+ value: network,
35393
+ onChange: (value) => setNetwork(value),
35394
+ ariaLabel: labels.networkLabel,
35395
+ disabled: Boolean(policy)
35396
+ }
35397
+ )
35398
+ ] }),
35399
+ /* @__PURE__ */ (0, import_jsx_runtime203.jsx)("div", { className: "grid grid-cols-1 gap-4 sm:grid-cols-2", children: [
35400
+ [labels.minimumLabel, minimum, setMinimum],
35401
+ [labels.refillAmountLabel, refillAmount, setRefillAmount],
35402
+ [labels.dailyCapLabel, dailyCap, setDailyCap],
35403
+ [labels.maximumFeeLabel, maximumFee, setMaximumFee]
35404
+ ].map(([label2, value, onChange]) => /* @__PURE__ */ (0, import_jsx_runtime203.jsxs)(
35405
+ "label",
35406
+ {
35407
+ className: "flex flex-col gap-2 rounded-agg-md bg-agg-secondary px-4 py-3 text-agg-sm text-agg-foreground",
35408
+ children: [
35409
+ /* @__PURE__ */ (0, import_jsx_runtime203.jsx)("span", { children: label2 }),
35410
+ /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(
35411
+ CurrencyInput,
35412
+ {
35413
+ value,
35414
+ onChange,
35415
+ min: 0.01,
35416
+ decimalPlaces: 2,
35417
+ ariaLabel: label2,
35418
+ classNames: { input: "w-full text-agg-base font-agg-semibold" }
35419
+ }
35420
+ )
35421
+ ]
35422
+ },
35423
+ label2
35424
+ )) }),
35425
+ /* @__PURE__ */ (0, import_jsx_runtime203.jsx)("p", { className: "text-agg-xs text-agg-secondary-foreground", children: labels.consent }),
35426
+ policy ? /* @__PURE__ */ (0, import_jsx_runtime203.jsx)("p", { className: "text-agg-sm text-agg-secondary-foreground", children: policy.status === "enabled" ? labels.activeLabel : labels.pausedLabel }) : null,
35427
+ latestAttempt ? /* @__PURE__ */ (0, import_jsx_runtime203.jsxs)("p", { className: "text-agg-sm text-agg-secondary-foreground", children: [
35428
+ labels.lastRefill,
35429
+ ": ",
35430
+ labels.statuses[latestAttempt.status]
35431
+ ] }) : null,
35432
+ feedback ? /* @__PURE__ */ (0, import_jsx_runtime203.jsx)("p", { role: feedback === labels.saveError ? "alert" : "status", className: "text-agg-sm", children: feedback }) : null,
35433
+ /* @__PURE__ */ (0, import_jsx_runtime203.jsxs)("div", { className: "flex flex-wrap gap-3", children: [
35434
+ /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(
35435
+ Button,
35436
+ {
35437
+ variant: "primary",
35438
+ size: "large",
35439
+ isLoading: isPending,
35440
+ disabled: Boolean(validationError),
35441
+ onClick: () => void handleSave(),
35442
+ children: policy ? labels.saveAction : labels.enableAction
35443
+ }
35444
+ ),
35445
+ policy ? /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(
35446
+ Button,
35447
+ {
35448
+ variant: "secondary",
35449
+ size: "large",
35450
+ isLoading: isPending,
35451
+ onClick: () => void handleStatus(),
35452
+ children: policy.status === "enabled" ? labels.pauseAction : labels.resumeAction
35453
+ }
35454
+ ) : null
35455
+ ] })
35456
+ ] })
35457
+ ] });
35458
+ };
35459
+
35460
+ // src/profile/index.tsx
35461
+ var import_jsx_runtime204 = require("react/jsx-runtime");
34878
35462
  var ProfileModal = ({
34879
35463
  open,
34880
35464
  onOpenChange,
@@ -34898,30 +35482,35 @@ var ProfileModal = ({
34898
35482
  onDisconnectExchange
34899
35483
  }) => {
34900
35484
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
34901
- const client = (0, import_hooks95.useAggClient)();
34902
- const { user } = (0, import_hooks95.useAggAuthState)();
35485
+ const client = (0, import_hooks97.useAggClient)();
35486
+ const labels = (0, import_hooks97.useAggLabels)();
35487
+ const { user } = (0, import_hooks97.useAggAuthState)();
34903
35488
  const toastCtx = useOptionalToast();
34904
- const [activeTab, setActiveTab] = (0, import_react58.useState)(PROFILE_TAB_KEYS.PROFILE_ACCOUNTS);
35489
+ const [activeTab, setActiveTab] = (0, import_react59.useState)(PROFILE_TAB_KEYS.PROFILE_ACCOUNTS);
35490
+ const profileTabItems = (0, import_react59.useMemo)(
35491
+ () => getProfileTabItems(labels.balanceRefill.tabLabel),
35492
+ [labels.balanceRefill.tabLabel]
35493
+ );
34905
35494
  const resolvedInitialUsername = (_a = username != null ? username : user == null ? void 0 : user.username) != null ? _a : "";
34906
- const [draftUsername, setDraftUsername] = (0, import_react58.useState)(resolvedInitialUsername);
34907
- const [draftAvatarFile, setDraftAvatarFile] = (0, import_react58.useState)();
34908
- const [draftAvatarPreview, setDraftAvatarPreview] = (0, import_react58.useState)();
34909
- const [isSaving, setIsSaving] = (0, import_react58.useState)(false);
34910
- const [avatarTypeError, setAvatarTypeError] = (0, import_react58.useState)(null);
34911
- const [isConnectKalshiModalOpen, setIsConnectKalshiModalOpen] = (0, import_react58.useState)(false);
34912
- const { data: kalshiStatus, refetch: refetchKalshiStatus } = (0, import_hooks95.useVenueKeyStatus)(
35495
+ const [draftUsername, setDraftUsername] = (0, import_react59.useState)(resolvedInitialUsername);
35496
+ const [draftAvatarFile, setDraftAvatarFile] = (0, import_react59.useState)();
35497
+ const [draftAvatarPreview, setDraftAvatarPreview] = (0, import_react59.useState)();
35498
+ const [isSaving, setIsSaving] = (0, import_react59.useState)(false);
35499
+ const [avatarTypeError, setAvatarTypeError] = (0, import_react59.useState)(null);
35500
+ const [isConnectKalshiModalOpen, setIsConnectKalshiModalOpen] = (0, import_react59.useState)(false);
35501
+ const { data: kalshiStatus, refetch: refetchKalshiStatus } = (0, import_hooks97.useVenueKeyStatus)(
34913
35502
  import_sdk27.Venue.kalshi,
34914
35503
  open
34915
35504
  );
34916
- (0, import_react58.useEffect)(() => {
35505
+ (0, import_react59.useEffect)(() => {
34917
35506
  var _a2;
34918
35507
  setDraftUsername((_a2 = username != null ? username : user == null ? void 0 : user.username) != null ? _a2 : "");
34919
35508
  }, [username, user == null ? void 0 : user.username]);
34920
- (0, import_react58.useEffect)(() => {
35509
+ (0, import_react59.useEffect)(() => {
34921
35510
  if (open) return;
34922
35511
  setIsConnectKalshiModalOpen(false);
34923
35512
  }, [open]);
34924
- const handleOpenChange = (0, import_react58.useCallback)(
35513
+ const handleOpenChange = (0, import_react59.useCallback)(
34925
35514
  (isOpen) => {
34926
35515
  var _a2;
34927
35516
  if (!isOpen) {
@@ -34945,7 +35534,7 @@ var ProfileModal = ({
34945
35534
  setDraftAvatarPreview
34946
35535
  ]
34947
35536
  );
34948
- const handleDraftAvatarChange = (0, import_react58.useCallback)(
35537
+ const handleDraftAvatarChange = (0, import_react59.useCallback)(
34949
35538
  (file, preview) => {
34950
35539
  const ACCEPTED_AVATAR_TYPES = ["image/jpeg", "image/png", "image/gif", "image/webp"];
34951
35540
  if (file && !ACCEPTED_AVATAR_TYPES.includes(file.type)) {
@@ -34960,7 +35549,7 @@ var ProfileModal = ({
34960
35549
  );
34961
35550
  const originalUsername = (_b = username != null ? username : user == null ? void 0 : user.username) != null ? _b : "";
34962
35551
  const hasChanges = draftUsername !== originalUsername || draftAvatarFile !== void 0;
34963
- const handleSave = (0, import_react58.useCallback)(() => __async(null, null, function* () {
35552
+ const handleSave = (0, import_react59.useCallback)(() => __async(null, null, function* () {
34964
35553
  var _a2, _b2, _c2;
34965
35554
  setIsSaving(true);
34966
35555
  try {
@@ -35015,10 +35604,10 @@ var ProfileModal = ({
35015
35604
  originalUsername,
35016
35605
  toastCtx
35017
35606
  ]);
35018
- const handleCancel = (0, import_react58.useCallback)(() => {
35607
+ const handleCancel = (0, import_react59.useCallback)(() => {
35019
35608
  handleOpenChange(false);
35020
35609
  }, [handleOpenChange]);
35021
- const handleVerifyKalshi = (0, import_react58.useCallback)(
35610
+ const handleVerifyKalshi = (0, import_react59.useCallback)(
35022
35611
  (credentials) => __async(null, null, function* () {
35023
35612
  if (onConnectKalshi) {
35024
35613
  yield onConnectKalshi(credentials);
@@ -35036,12 +35625,12 @@ var ProfileModal = ({
35036
35625
  }),
35037
35626
  [client, onConnectKalshi, refetchKalshiStatus]
35038
35627
  );
35039
- const handleDisconnectKalshi = (0, import_react58.useCallback)(() => __async(null, null, function* () {
35628
+ const handleDisconnectKalshi = (0, import_react59.useCallback)(() => __async(null, null, function* () {
35040
35629
  yield client.deleteVenueKey(import_sdk27.Venue.kalshi);
35041
35630
  yield refetchKalshiStatus();
35042
35631
  onDisconnectExchange == null ? void 0 : onDisconnectExchange(import_sdk27.Venue.kalshi);
35043
35632
  }), [client, onDisconnectExchange, refetchKalshiStatus]);
35044
- const resolvedVenueAccounts = (0, import_react58.useMemo)(() => {
35633
+ const resolvedVenueAccounts = (0, import_react59.useMemo)(() => {
35045
35634
  var _a2;
35046
35635
  const nonKalshiAccounts = (_a2 = user == null ? void 0 : user.venueAccounts) == null ? void 0 : _a2.filter((account) => account.venue !== "kalshi");
35047
35636
  if (!kalshiStatus) return user == null ? void 0 : user.venueAccounts;
@@ -35097,7 +35686,7 @@ var ProfileModal = ({
35097
35686
  if (typeof window === "undefined") return;
35098
35687
  ((_a2 = window.top) != null ? _a2 : window).location.assign(url);
35099
35688
  };
35100
- const surfaceError = (0, import_react58.useCallback)(
35689
+ const surfaceError = (0, import_react59.useCallback)(
35101
35690
  (err, title2) => {
35102
35691
  const message = (err == null ? void 0 : err.message) || "Something went wrong. Please try again.";
35103
35692
  if (toastCtx) {
@@ -35108,7 +35697,7 @@ var ProfileModal = ({
35108
35697
  },
35109
35698
  [toastCtx]
35110
35699
  );
35111
- const handleConnectTwitter = (0, import_react58.useCallback)(() => __async(null, null, function* () {
35700
+ const handleConnectTwitter = (0, import_react59.useCallback)(() => __async(null, null, function* () {
35112
35701
  try {
35113
35702
  const result = yield client.linkAccount({
35114
35703
  provider: "twitter",
@@ -35122,7 +35711,7 @@ var ProfileModal = ({
35122
35711
  surfaceError(err, "Could not connect X (Twitter)");
35123
35712
  }
35124
35713
  }), [client, onConnectTwitter, surfaceError]);
35125
- const handleConnectGoogle = (0, import_react58.useCallback)(() => __async(null, null, function* () {
35714
+ const handleConnectGoogle = (0, import_react59.useCallback)(() => __async(null, null, function* () {
35126
35715
  try {
35127
35716
  const result = yield client.linkAccount({
35128
35717
  provider: "google",
@@ -35136,7 +35725,7 @@ var ProfileModal = ({
35136
35725
  surfaceError(err, "Could not connect Google");
35137
35726
  }
35138
35727
  }), [client, onConnectGoogle, surfaceError]);
35139
- const handleConnectApple = (0, import_react58.useCallback)(() => __async(null, null, function* () {
35728
+ const handleConnectApple = (0, import_react59.useCallback)(() => __async(null, null, function* () {
35140
35729
  try {
35141
35730
  const result = yield client.linkAccount({
35142
35731
  provider: "apple",
@@ -35150,7 +35739,7 @@ var ProfileModal = ({
35150
35739
  surfaceError(err, "Could not connect Apple");
35151
35740
  }
35152
35741
  }), [client, onConnectApple, surfaceError]);
35153
- const handleDisconnectTwitter = (0, import_react58.useCallback)(() => __async(null, null, function* () {
35742
+ const handleDisconnectTwitter = (0, import_react59.useCallback)(() => __async(null, null, function* () {
35154
35743
  try {
35155
35744
  yield client.disconnectAccount("twitter");
35156
35745
  yield client.getCurrentUser();
@@ -35159,7 +35748,7 @@ var ProfileModal = ({
35159
35748
  surfaceError(err, "Could not disconnect X (Twitter)");
35160
35749
  }
35161
35750
  }), [client, onDisconnectTwitter, surfaceError]);
35162
- const handleDisconnectGoogle = (0, import_react58.useCallback)(() => __async(null, null, function* () {
35751
+ const handleDisconnectGoogle = (0, import_react59.useCallback)(() => __async(null, null, function* () {
35163
35752
  try {
35164
35753
  yield client.disconnectAccount("google");
35165
35754
  yield client.getCurrentUser();
@@ -35168,7 +35757,7 @@ var ProfileModal = ({
35168
35757
  surfaceError(err, "Could not disconnect Google");
35169
35758
  }
35170
35759
  }), [client, onDisconnectGoogle, surfaceError]);
35171
- const handleDisconnectApple = (0, import_react58.useCallback)(() => __async(null, null, function* () {
35760
+ const handleDisconnectApple = (0, import_react59.useCallback)(() => __async(null, null, function* () {
35172
35761
  try {
35173
35762
  yield client.disconnectAccount("apple");
35174
35763
  yield client.getCurrentUser();
@@ -35177,7 +35766,7 @@ var ProfileModal = ({
35177
35766
  surfaceError(err, "Could not disconnect Apple");
35178
35767
  }
35179
35768
  }), [client, onDisconnectApple, surfaceError]);
35180
- const handleConnectEmail = (0, import_react58.useCallback)(() => __async(null, null, function* () {
35769
+ const handleConnectEmail = (0, import_react59.useCallback)(() => __async(null, null, function* () {
35181
35770
  var _a2;
35182
35771
  const typedEmail = typeof window !== "undefined" ? (_a2 = window.prompt("Enter your email to receive a magic link")) == null ? void 0 : _a2.trim() : void 0;
35183
35772
  if (!typedEmail) return;
@@ -35196,7 +35785,7 @@ var ProfileModal = ({
35196
35785
  surfaceError(err, "Could not connect email");
35197
35786
  }
35198
35787
  }), [client, onConnectEmail, surfaceError, toastCtx]);
35199
- const handleDisconnectWallet = (0, import_react58.useCallback)(
35788
+ const handleDisconnectWallet = (0, import_react59.useCallback)(
35200
35789
  (wallet) => __async(null, null, function* () {
35201
35790
  const normalizedChain = wallet.chain.toLowerCase();
35202
35791
  const provider = normalizedChain === "solana" || normalizedChain === "svm" ? "solana_wallet" : "wallet";
@@ -35210,7 +35799,7 @@ var ProfileModal = ({
35210
35799
  }),
35211
35800
  [client, onDisconnectWallet, surfaceError]
35212
35801
  );
35213
- const providerActionMap = (0, import_react58.useMemo)(
35802
+ const providerActionMap = (0, import_react59.useMemo)(
35214
35803
  () => ({
35215
35804
  twitter: {
35216
35805
  connect: () => {
@@ -35252,7 +35841,7 @@ var ProfileModal = ({
35252
35841
  handleDisconnectTwitter
35253
35842
  ]
35254
35843
  );
35255
- const resolvedWallets = (0, import_react58.useMemo)(() => {
35844
+ const resolvedWallets = (0, import_react59.useMemo)(() => {
35256
35845
  var _a2, _b2;
35257
35846
  if (wallets) return wallets;
35258
35847
  const walletAccounts = (_b2 = (_a2 = user == null ? void 0 : user.accounts) == null ? void 0 : _a2.filter((account) => {
@@ -35271,8 +35860,8 @@ var ProfileModal = ({
35271
35860
  };
35272
35861
  });
35273
35862
  }, [user == null ? void 0 : user.accounts, wallets]);
35274
- return /* @__PURE__ */ (0, import_jsx_runtime203.jsxs)(Modal, { open: open && !isConnectKalshiModalOpen, onOpenChange: handleOpenChange, children: [
35275
- /* @__PURE__ */ (0, import_jsx_runtime203.jsxs)(
35863
+ return /* @__PURE__ */ (0, import_jsx_runtime204.jsxs)(Modal, { open: open && !isConnectKalshiModalOpen, onOpenChange: handleOpenChange, children: [
35864
+ /* @__PURE__ */ (0, import_jsx_runtime204.jsxs)(
35276
35865
  Modal.Container,
35277
35866
  {
35278
35867
  maxWidth: "800px",
@@ -35281,24 +35870,24 @@ var ProfileModal = ({
35281
35870
  container: cn("agg-profile-modal", "min-h-[37.5rem]")
35282
35871
  },
35283
35872
  children: [
35284
- /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(Modal.Header, { title: "Edit Profile", classNames: { root: "agg-profile-modal-header" } }),
35285
- /* @__PURE__ */ (0, import_jsx_runtime203.jsx)("div", { className: "agg-profile-tabs sm:hidden w-full", children: /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(
35873
+ /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(Modal.Header, { title: "Edit Profile", classNames: { root: "agg-profile-modal-header" } }),
35874
+ /* @__PURE__ */ (0, import_jsx_runtime204.jsx)("div", { className: "agg-profile-tabs sm:hidden w-full", children: /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(
35286
35875
  Tabs,
35287
35876
  {
35288
35877
  className: "w-full [&>div]:w-full",
35289
35878
  variant: "underline",
35290
35879
  classNames: { tabList: "w-full" },
35291
- items: PROFILE_TAB_ITEMS.map((tab) => ({
35880
+ items: profileTabItems.map((tab) => ({
35292
35881
  value: tab.value,
35293
35882
  label: tab.label,
35294
- icon: /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(Icon, { name: tab.icon, size: "small" })
35883
+ icon: /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(Icon, { name: tab.icon, size: "small" })
35295
35884
  })),
35296
35885
  value: activeTab,
35297
35886
  onChange: (val) => setActiveTab(val)
35298
35887
  }
35299
35888
  ) }),
35300
- /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(Modal.Body, { classNames: { root: cn("agg-profile-modal-body", "overflow-x-visible") }, children: /* @__PURE__ */ (0, import_jsx_runtime203.jsxs)("div", { className: "agg-profile-layout flex flex-col sm:flex-row sm:gap-10", children: [
35301
- /* @__PURE__ */ (0, import_jsx_runtime203.jsx)("div", { className: "shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(
35889
+ /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(Modal.Body, { classNames: { root: cn("agg-profile-modal-body", "overflow-x-visible") }, children: /* @__PURE__ */ (0, import_jsx_runtime204.jsxs)("div", { className: "agg-profile-layout flex flex-col sm:flex-row sm:gap-10", children: [
35890
+ /* @__PURE__ */ (0, import_jsx_runtime204.jsx)("div", { className: "shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(
35302
35891
  "nav",
35303
35892
  {
35304
35893
  className: cn(
@@ -35312,9 +35901,9 @@ var ProfileModal = ({
35312
35901
  ),
35313
35902
  role: "tablist",
35314
35903
  "aria-label": "Profile sections",
35315
- children: PROFILE_TAB_ITEMS.map((tab) => {
35904
+ children: profileTabItems.map((tab) => {
35316
35905
  const isActive = activeTab === tab.value;
35317
- return /* @__PURE__ */ (0, import_jsx_runtime203.jsxs)(
35906
+ return /* @__PURE__ */ (0, import_jsx_runtime204.jsxs)(
35318
35907
  "button",
35319
35908
  {
35320
35909
  type: "button",
@@ -35330,9 +35919,9 @@ var ProfileModal = ({
35330
35919
  isActive ? "font-agg-normal text-agg-foreground bg-agg-secondary-hover" : "font-agg-normal text-agg-foreground"
35331
35920
  ),
35332
35921
  children: [
35333
- isActive ? /* @__PURE__ */ (0, import_jsx_runtime203.jsx)("div", { className: "absolute left-0 top-0 bottom-0 w-1 bg-agg-primary" }) : null,
35334
- /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(Icon, { name: tab.icon, size: "small", color: "currentColor" }),
35335
- /* @__PURE__ */ (0, import_jsx_runtime203.jsx)("span", { className: "shrink-0 whitespace-nowrap", children: tab.label })
35922
+ isActive ? /* @__PURE__ */ (0, import_jsx_runtime204.jsx)("div", { className: "absolute left-0 top-0 bottom-0 w-1 bg-agg-primary" }) : null,
35923
+ /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(Icon, { name: tab.icon, size: "small", color: "currentColor" }),
35924
+ /* @__PURE__ */ (0, import_jsx_runtime204.jsx)("span", { className: "shrink-0 whitespace-nowrap", children: tab.label })
35336
35925
  ]
35337
35926
  },
35338
35927
  tab.value
@@ -35340,9 +35929,9 @@ var ProfileModal = ({
35340
35929
  })
35341
35930
  }
35342
35931
  ) }),
35343
- /* @__PURE__ */ (0, import_jsx_runtime203.jsxs)("div", { className: "agg-profile-content min-w-0 flex-1", children: [
35344
- activeTab === PROFILE_TAB_KEYS.PROFILE_ACCOUNTS ? /* @__PURE__ */ (0, import_jsx_runtime203.jsxs)("div", { className: "agg-profile-accounts-tab flex flex-col gap-8", children: [
35345
- /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(
35932
+ /* @__PURE__ */ (0, import_jsx_runtime204.jsxs)("div", { className: "agg-profile-content min-w-0 flex-1", children: [
35933
+ activeTab === PROFILE_TAB_KEYS.PROFILE_ACCOUNTS ? /* @__PURE__ */ (0, import_jsx_runtime204.jsxs)("div", { className: "agg-profile-accounts-tab flex flex-col gap-8", children: [
35934
+ /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(
35346
35935
  AboutTab,
35347
35936
  {
35348
35937
  username: username != null ? username : user == null ? void 0 : user.username,
@@ -35356,7 +35945,7 @@ var ProfileModal = ({
35356
35945
  avatarError: avatarTypeError
35357
35946
  }
35358
35947
  ),
35359
- /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(
35948
+ /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(
35360
35949
  AccountsWalletsTab,
35361
35950
  {
35362
35951
  socialAccounts: resolvedSocialAccounts,
@@ -35375,7 +35964,7 @@ var ProfileModal = ({
35375
35964
  }
35376
35965
  )
35377
35966
  ] }) : null,
35378
- activeTab === PROFILE_TAB_KEYS.TRADING_ACCESS ? /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(
35967
+ activeTab === PROFILE_TAB_KEYS.TRADING_ACCESS ? /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(
35379
35968
  TradingAccessTab,
35380
35969
  {
35381
35970
  venueAccounts: resolvedVenueAccounts,
@@ -35383,12 +35972,22 @@ var ProfileModal = ({
35383
35972
  onDisconnectKalshi: handleDisconnectKalshi,
35384
35973
  onKycError
35385
35974
  }
35386
- ) : null
35975
+ ) : null,
35976
+ activeTab === PROFILE_TAB_KEYS.BALANCE_MANAGEMENT ? /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(BalanceManagementTab, { enabled: open }) : null
35387
35977
  ] })
35388
35978
  ] }) }),
35389
- /* @__PURE__ */ (0, import_jsx_runtime203.jsxs)(Modal.Footer, { classNames: { root: "agg-profile-modal-footer" }, children: [
35390
- /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(Button, { variant: "secondary", size: "large", onClick: handleCancel, className: "min-w-[120px]", children: "Cancel" }),
35391
- /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(
35979
+ activeTab === PROFILE_TAB_KEYS.BALANCE_MANAGEMENT ? null : /* @__PURE__ */ (0, import_jsx_runtime204.jsxs)(Modal.Footer, { classNames: { root: "agg-profile-modal-footer" }, children: [
35980
+ /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(
35981
+ Button,
35982
+ {
35983
+ variant: "secondary",
35984
+ size: "large",
35985
+ onClick: handleCancel,
35986
+ className: "min-w-[120px]",
35987
+ children: "Cancel"
35988
+ }
35989
+ ),
35990
+ /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(
35392
35991
  Button,
35393
35992
  {
35394
35993
  variant: "primary",
@@ -35403,7 +36002,7 @@ var ProfileModal = ({
35403
36002
  ]
35404
36003
  }
35405
36004
  ),
35406
- /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(
36005
+ /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(
35407
36006
  ConnectKalshiModal,
35408
36007
  {
35409
36008
  open: open && isConnectKalshiModalOpen,
@@ -35416,33 +36015,33 @@ var ProfileModal = ({
35416
36015
  ProfileModal.displayName = "ProfileModal";
35417
36016
 
35418
36017
  // src/geo-block-modal/index.tsx
35419
- var import_hooks96 = require("@agg-build/hooks");
35420
- var import_react59 = require("react");
35421
- var import_jsx_runtime204 = require("react/jsx-runtime");
36018
+ var import_hooks98 = require("@agg-build/hooks");
36019
+ var import_react60 = require("react");
36020
+ var import_jsx_runtime205 = require("react/jsx-runtime");
35422
36021
  var GeoBlockModal = ({
35423
36022
  open,
35424
36023
  onOpenChange,
35425
36024
  onConfirm,
35426
36025
  classNames
35427
36026
  }) => {
35428
- const labels = (0, import_hooks96.useLabels)();
35429
- const handleConfirm = (0, import_react59.useCallback)(() => {
36027
+ const labels = (0, import_hooks98.useLabels)();
36028
+ const handleConfirm = (0, import_react60.useCallback)(() => {
35430
36029
  onConfirm == null ? void 0 : onConfirm();
35431
36030
  onOpenChange(false);
35432
36031
  }, [onConfirm, onOpenChange]);
35433
- return /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(
36032
+ return /* @__PURE__ */ (0, import_jsx_runtime205.jsx)(
35434
36033
  Modal,
35435
36034
  {
35436
36035
  open,
35437
36036
  onOpenChange,
35438
36037
  "aria-label": labels.trading.geoBlockModalAriaLabel,
35439
- children: /* @__PURE__ */ (0, import_jsx_runtime204.jsxs)(
36038
+ children: /* @__PURE__ */ (0, import_jsx_runtime205.jsxs)(
35440
36039
  Modal.Container,
35441
36040
  {
35442
36041
  maxWidth: "480px",
35443
36042
  classNames: { container: cn("!rounded-agg-2xl", classNames == null ? void 0 : classNames.container) },
35444
36043
  children: [
35445
- /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(
36044
+ /* @__PURE__ */ (0, import_jsx_runtime205.jsx)(
35446
36045
  Modal.Header,
35447
36046
  {
35448
36047
  title: "",
@@ -35454,19 +36053,19 @@ var GeoBlockModal = ({
35454
36053
  }
35455
36054
  }
35456
36055
  ),
35457
- /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(Modal.Body, { classNames: { root: cn("!px-10 !pt-0 !pb-12", classNames == null ? void 0 : classNames.body) }, children: /* @__PURE__ */ (0, import_jsx_runtime204.jsxs)("div", { className: "flex flex-col items-center gap-8", children: [
35458
- /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(
36056
+ /* @__PURE__ */ (0, import_jsx_runtime205.jsx)(Modal.Body, { classNames: { root: cn("!px-10 !pt-0 !pb-12", classNames == null ? void 0 : classNames.body) }, children: /* @__PURE__ */ (0, import_jsx_runtime205.jsxs)("div", { className: "flex flex-col items-center gap-8", children: [
36057
+ /* @__PURE__ */ (0, import_jsx_runtime205.jsx)(
35459
36058
  Icon,
35460
36059
  {
35461
36060
  name: "internet-security",
35462
36061
  className: "h-[60px] w-[60px] text-agg-muted-foreground"
35463
36062
  }
35464
36063
  ),
35465
- /* @__PURE__ */ (0, import_jsx_runtime204.jsxs)("div", { className: "flex flex-col items-center gap-3 text-center", children: [
35466
- /* @__PURE__ */ (0, import_jsx_runtime204.jsx)("h2", { className: "text-agg-2xl font-agg-bold leading-agg-8 text-agg-foreground", children: labels.trading.geoBlockModalTitle }),
35467
- /* @__PURE__ */ (0, import_jsx_runtime204.jsx)("p", { className: "text-agg-base font-agg-normal leading-agg-6 text-agg-foreground", children: labels.trading.geoBlockModalDescription })
36064
+ /* @__PURE__ */ (0, import_jsx_runtime205.jsxs)("div", { className: "flex flex-col items-center gap-3 text-center", children: [
36065
+ /* @__PURE__ */ (0, import_jsx_runtime205.jsx)("h2", { className: "text-agg-2xl font-agg-bold leading-agg-8 text-agg-foreground", children: labels.trading.geoBlockModalTitle }),
36066
+ /* @__PURE__ */ (0, import_jsx_runtime205.jsx)("p", { className: "text-agg-base font-agg-normal leading-agg-6 text-agg-foreground", children: labels.trading.geoBlockModalDescription })
35468
36067
  ] }),
35469
- /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(
36068
+ /* @__PURE__ */ (0, import_jsx_runtime205.jsx)(
35470
36069
  Button,
35471
36070
  {
35472
36071
  variant: "secondary",