@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/pages.js CHANGED
@@ -98,7 +98,7 @@ __export(pages_exports, {
98
98
  module.exports = __toCommonJS(pages_exports);
99
99
 
100
100
  // src/pages/home/index.tsx
101
- var import_hooks68 = require("@agg-build/hooks");
101
+ var import_hooks69 = require("@agg-build/hooks");
102
102
  var import_sdk23 = require("@agg-build/sdk");
103
103
  var import_react46 = require("react");
104
104
 
@@ -7960,7 +7960,11 @@ var Select = ({
7960
7960
  triggerClassName,
7961
7961
  contentClassName,
7962
7962
  itemClassName,
7963
- disabled = SELECT_DEFAULT_IS_DISABLED
7963
+ disabled = SELECT_DEFAULT_IS_DISABLED,
7964
+ variant = "default",
7965
+ openOnHover = false,
7966
+ contentAlign = "start",
7967
+ contentSideOffset = 8
7964
7968
  }) => {
7965
7969
  var _a;
7966
7970
  const labels = (0, import_hooks31.useLabels)();
@@ -7971,17 +7975,30 @@ var Select = ({
7971
7975
  const isDisabled = resolveIsSelectDisabled({ disabled, items });
7972
7976
  const selectedItem = resolveSelectedItem(items, value);
7973
7977
  const [isOpen, setIsOpen] = (0, import_react8.useState)(false);
7974
- const [menuRect, setMenuRect] = (0, import_react8.useState)(
7975
- null
7976
- );
7978
+ const [menuRect, setMenuRect] = (0, import_react8.useState)(null);
7977
7979
  const containerRef = (0, import_react8.useRef)(null);
7978
7980
  const portalRef = (0, import_react8.useRef)(null);
7979
- const handleClose = (0, import_react8.useCallback)(() => setIsOpen(false), []);
7981
+ const closeTimerRef = (0, import_react8.useRef)(null);
7982
+ const openedByHoverRef = (0, import_react8.useRef)(false);
7983
+ const handleClose = (0, import_react8.useCallback)(() => {
7984
+ setIsOpen(false);
7985
+ openedByHoverRef.current = false;
7986
+ }, []);
7980
7987
  const updateMenuRect = (0, import_react8.useCallback)(() => {
7981
7988
  const el = containerRef.current;
7982
7989
  if (!el) return;
7983
7990
  const r = el.getBoundingClientRect();
7984
- setMenuRect({ top: r.bottom + 8, left: r.left, width: r.width });
7991
+ setMenuRect({
7992
+ top: r.bottom + contentSideOffset,
7993
+ left: r.left,
7994
+ right: r.right,
7995
+ width: r.width
7996
+ });
7997
+ }, [contentSideOffset]);
7998
+ (0, import_react8.useEffect)(() => {
7999
+ return () => {
8000
+ if (closeTimerRef.current) clearTimeout(closeTimerRef.current);
8001
+ };
7985
8002
  }, []);
7986
8003
  (0, import_react8.useLayoutEffect)(() => {
7987
8004
  if (!isOpen) {
@@ -8019,7 +8036,33 @@ var Select = ({
8019
8036
  document.addEventListener("keydown", handleKeyDown);
8020
8037
  return () => document.removeEventListener("keydown", handleKeyDown);
8021
8038
  }, [isOpen, handleClose]);
8022
- const triggerRadiusClass = triggerClassName != null ? triggerClassName : "rounded-agg-md";
8039
+ const handlePointerEnter = (event) => {
8040
+ if (!openOnHover || isDisabled || event.pointerType === "touch") return;
8041
+ if (closeTimerRef.current) {
8042
+ clearTimeout(closeTimerRef.current);
8043
+ closeTimerRef.current = null;
8044
+ }
8045
+ if (isOpen) return;
8046
+ openedByHoverRef.current = true;
8047
+ setIsOpen(true);
8048
+ };
8049
+ const handlePointerLeave = (event) => {
8050
+ if (!openOnHover || event.pointerType === "touch") return;
8051
+ if (closeTimerRef.current) clearTimeout(closeTimerRef.current);
8052
+ closeTimerRef.current = setTimeout(() => {
8053
+ handleClose();
8054
+ closeTimerRef.current = null;
8055
+ }, 120);
8056
+ };
8057
+ const handleTriggerClick = () => {
8058
+ if (openedByHoverRef.current && isOpen) {
8059
+ openedByHoverRef.current = false;
8060
+ return;
8061
+ }
8062
+ setIsOpen((previousValue) => !previousValue);
8063
+ };
8064
+ const isInline = variant === "inline";
8065
+ const triggerRadiusClass = triggerClassName != null ? triggerClassName : isInline ? "rounded-agg-sm" : "rounded-agg-md";
8023
8066
  const listbox = menuRect ? /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
8024
8067
  "div",
8025
8068
  {
@@ -8030,16 +8073,20 @@ var Select = ({
8030
8073
  style: {
8031
8074
  position: "fixed",
8032
8075
  top: menuRect.top,
8033
- left: menuRect.left,
8076
+ left: contentAlign === "start" ? menuRect.left : void 0,
8077
+ right: contentAlign === "end" ? window.innerWidth - menuRect.right : void 0,
8034
8078
  width: menuRect.width,
8035
8079
  zIndex: SELECT_DROPDOWN_Z
8036
8080
  },
8037
8081
  className: cn(
8038
8082
  AGG_ROOT_CLASS_NAME,
8039
8083
  rootClassName,
8040
- "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",
8084
+ "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",
8085
+ 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)]",
8041
8086
  contentClassName
8042
8087
  ),
8088
+ onPointerEnter: handlePointerEnter,
8089
+ onPointerLeave: handlePointerLeave,
8043
8090
  children: items.map((item) => {
8044
8091
  const isSelected = item.value === value;
8045
8092
  const isHidden = item.hidden === true;
@@ -8053,9 +8100,10 @@ var Select = ({
8053
8100
  disabled: item.disabled,
8054
8101
  className: cn(
8055
8102
  "agg-select-item",
8056
- "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",
8103
+ "relative flex w-full items-center text-left text-agg-sm leading-agg-5 outline-none",
8104
+ isInline ? "gap-2 px-4 py-2" : "gap-3 rounded-[6px] py-3 pl-3 pr-5",
8057
8105
  "hover:bg-agg-secondary-hover focus-visible:bg-agg-secondary-hover",
8058
- isSelected ? "bg-agg-primary/10 font-agg-normal text-agg-primary" : "font-agg-normal text-agg-foreground",
8106
+ isSelected ? isInline ? "font-agg-bold text-agg-foreground" : "bg-agg-primary/10 font-agg-normal text-agg-primary" : "font-agg-normal text-agg-foreground",
8059
8107
  item.disabled && "cursor-not-allowed opacity-60",
8060
8108
  itemClassName
8061
8109
  ),
@@ -8067,6 +8115,13 @@ var Select = ({
8067
8115
  handleClose();
8068
8116
  },
8069
8117
  children: [
8118
+ isInline && isSelected ? /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
8119
+ "span",
8120
+ {
8121
+ className: "agg-select-item-indicator absolute bottom-2 left-0 top-2 w-1 bg-agg-primary",
8122
+ "aria-hidden": true
8123
+ }
8124
+ ) : null,
8070
8125
  item.icon ? /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
8071
8126
  "span",
8072
8127
  {
@@ -8096,7 +8151,11 @@ var Select = ({
8096
8151
  "div",
8097
8152
  {
8098
8153
  ref: containerRef,
8099
- className: cn("group/agg-select", "relative inline-flex w-full", className),
8154
+ className: cn(
8155
+ "group/agg-select relative inline-flex",
8156
+ isInline ? "w-auto" : "w-full",
8157
+ className
8158
+ ),
8100
8159
  children: [
8101
8160
  /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)(
8102
8161
  "button",
@@ -8108,19 +8167,19 @@ var Select = ({
8108
8167
  disabled: isDisabled,
8109
8168
  className: cn(
8110
8169
  "agg-select-trigger",
8111
- "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",
8112
- "flex items-center gap-2 text-left",
8170
+ "flex cursor-pointer items-center gap-2 font-agg-sans text-agg-foreground outline-none disabled:cursor-not-allowed disabled:opacity-60",
8171
+ 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",
8113
8172
  triggerRadiusClass,
8114
- getMotionClassName(
8173
+ !isInline && getMotionClassName(
8115
8174
  enableAnimations,
8116
8175
  "transition-[border-color,box-shadow] duration-200 ease-in-out"
8117
8176
  ),
8118
- isOpen && "border-2 border-agg-primary px-[11px] py-2 ring-0",
8119
- "hover:border-agg-primary",
8120
- "focus:border-agg-primary focus:ring-0",
8121
- "disabled:cursor-not-allowed disabled:opacity-60"
8177
+ !isInline && isOpen && "border-2 border-agg-primary px-[11px] py-2 ring-0",
8178
+ !isInline && "hover:border-agg-primary focus:border-agg-primary focus:ring-0"
8122
8179
  ),
8123
- onClick: () => setIsOpen((previousValue) => !previousValue),
8180
+ onClick: handleTriggerClick,
8181
+ onPointerEnter: handlePointerEnter,
8182
+ onPointerLeave: handlePointerLeave,
8124
8183
  children: [
8125
8184
  (selectedItem == null ? void 0 : selectedItem.icon) ? /* @__PURE__ */ (0, import_jsx_runtime125.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_runtime125.jsx)(
8126
8185
  RemoteImage,
@@ -8134,14 +8193,23 @@ var Select = ({
8134
8193
  ]
8135
8194
  }
8136
8195
  ),
8137
- /* @__PURE__ */ (0, import_jsx_runtime125.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_runtime125.jsx)(
8138
- Icon,
8196
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
8197
+ "span",
8139
8198
  {
8140
- name: isOpen ? "chevron-up" : "chevron-down-thin",
8141
- size: "small",
8142
- color: "currentColor"
8199
+ className: cn(
8200
+ "agg-select-chevron pointer-events-none absolute inset-y-0 inline-flex items-center justify-center",
8201
+ isInline ? "right-2 text-agg-foreground" : "right-3 text-agg-muted-foreground"
8202
+ ),
8203
+ children: /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
8204
+ Icon,
8205
+ {
8206
+ name: isOpen ? "chevron-up" : "chevron-down-thin",
8207
+ size: "small",
8208
+ color: "currentColor"
8209
+ }
8210
+ )
8143
8211
  }
8144
- ) }),
8212
+ ),
8145
8213
  isOpen && typeof document !== "undefined" && listbox ? (0, import_react_dom.createPortal)(listbox, resolveSelectPortalContainer(containerRef.current)) : null
8146
8214
  ]
8147
8215
  }
@@ -10857,7 +10925,7 @@ var EventList = ({
10857
10925
  EventList.displayName = "EventList";
10858
10926
 
10859
10927
  // src/pages/event-market/index.tsx
10860
- var import_hooks67 = require("@agg-build/hooks");
10928
+ var import_hooks68 = require("@agg-build/hooks");
10861
10929
  var import_react43 = require("react");
10862
10930
 
10863
10931
  // src/events/item-details/index.tsx
@@ -11323,8 +11391,9 @@ var resolveMarketChartLiveState = ({
11323
11391
 
11324
11392
  // src/events/orderbook/orderbook.utils.ts
11325
11393
  var import_sdk15 = require("@agg-build/sdk");
11326
- var formatProbabilityCents = (value) => {
11394
+ var formatProbabilityCents = (value, formatPrice) => {
11327
11395
  if (value == null) return "-";
11396
+ if (formatPrice) return formatPrice(value);
11328
11397
  const cents = (value * 100).toFixed(1).replace(/\.0$/, "");
11329
11398
  return `${cents}\xA2`;
11330
11399
  };
@@ -11722,6 +11791,17 @@ var matchesSelectedOutcomeLabel = (outcome, selectedOutcomeLabel) => {
11722
11791
  return normalizedCandidate === normalizedSelectedLabel || toSemanticOutcomeLabel(candidate) === semanticSelectedLabel;
11723
11792
  });
11724
11793
  };
11794
+ var isTeamFramedMarket = (market) => {
11795
+ var _a;
11796
+ const outcomes = (_a = market.venueMarketOutcomes) != null ? _a : [];
11797
+ if (outcomes.length < 2) return false;
11798
+ return outcomes.every(
11799
+ (outcome) => getOutcomeLabelCandidates(outcome).some((candidate) => {
11800
+ const semanticCandidate = toSemanticOutcomeLabel(candidate);
11801
+ return semanticCandidate !== "" && semanticCandidate !== "yes" && semanticCandidate !== "no";
11802
+ })
11803
+ );
11804
+ };
11725
11805
  var isValidLevel = (level) => {
11726
11806
  return level != null && Number.isFinite(level.price) && Number.isFinite(level.size) && level.price >= 0 && level.price <= 1 && level.size > 0;
11727
11807
  };
@@ -11866,6 +11946,7 @@ var collectEligibleVenueOutcomes = ({
11866
11946
  const seenMarketIds = /* @__PURE__ */ new Set();
11867
11947
  const seenOutcomeIds = /* @__PURE__ */ new Set();
11868
11948
  const result = [];
11949
+ let selectedAnchorMarket = null;
11869
11950
  if (selectedOutcomeId) {
11870
11951
  for (const market of venueMarkets) {
11871
11952
  const outcome = market.venueMarketOutcomes.find((o) => o.id === selectedOutcomeId);
@@ -11919,6 +12000,16 @@ var collectEligibleVenueOutcomes = ({
11919
12000
  });
11920
12001
  return result;
11921
12002
  }
12003
+ selectedAnchorMarket = market;
12004
+ seenMarketIds.add(market.id);
12005
+ seenOutcomeIds.add(outcome.id);
12006
+ result.push({
12007
+ venue: market.venue,
12008
+ market,
12009
+ outcome,
12010
+ outcomeId: outcome.id,
12011
+ semanticLabel
12012
+ });
11922
12013
  break;
11923
12014
  }
11924
12015
  }
@@ -11961,10 +12052,18 @@ var collectEligibleVenueOutcomes = ({
11961
12052
  }
11962
12053
  for (const market of venueMarkets) {
11963
12054
  if (seenMarketIds.has(market.id)) continue;
12055
+ if (selectedAnchorMarket && result.some(
12056
+ (entry) => entry.venue === market.venue && entry.market.question.trim() !== market.question.trim()
12057
+ )) {
12058
+ continue;
12059
+ }
11964
12060
  const matchedOutcome = sortOutcomes(market.venueMarketOutcomes).find(
11965
12061
  (outcome) => matchesSelectedOutcomeLabel(outcome, selectedOutcomeLabel)
11966
12062
  );
11967
12063
  if (!matchedOutcome || seenOutcomeIds.has(matchedOutcome.id)) continue;
12064
+ if (selectedAnchorMarket && isTeamFramedMarket(market) !== isTeamFramedMarket(selectedAnchorMarket)) {
12065
+ continue;
12066
+ }
11968
12067
  const candidateRefs = (_c = matchedOutcome.matchedVenueMarketOutcomes) != null ? _c : [];
11969
12068
  if (candidateRefs.length > 0) {
11970
12069
  const sharesAnchor = candidateRefs.some(
@@ -13535,7 +13634,7 @@ var EventListItemDetailsGraphSection = ({
13535
13634
  }, [chartOutcomeLabel, (_d = tradingContext == null ? void 0 : tradingContext.selectedOutcome) == null ? void 0 : _d.label]);
13536
13635
  const {
13537
13636
  chart: { selectedChartTimeRange },
13538
- formatting: { formatPercent },
13637
+ formatting: { formatPercent, formatPrice },
13539
13638
  general: { theme }
13540
13639
  } = (0, import_hooks46.useSdkUiConfig)();
13541
13640
  const isDarkTheme = theme === "dark";
@@ -13810,8 +13909,8 @@ var EventListItemDetailsGraphSection = ({
13810
13909
  });
13811
13910
  return {
13812
13911
  value: outcome.id,
13813
- label: `${(_d3 = outcome.title) != null ? _d3 : outcome.label} ${formatProbabilityCents(price)}`,
13814
- ariaLabel: `${(_e2 = outcome.title) != null ? _e2 : outcome.label} ${formatProbabilityCents(price)}`
13912
+ label: `${(_d3 = outcome.title) != null ? _d3 : outcome.label} ${formatProbabilityCents(price, formatPrice)}`,
13913
+ ariaLabel: `${(_e2 = outcome.title) != null ? _e2 : outcome.label} ${formatProbabilityCents(price, formatPrice)}`
13815
13914
  };
13816
13915
  })
13817
13916
  }
@@ -14233,7 +14332,7 @@ var EventListItemDetails = (props) => {
14233
14332
  EventListItemDetails.displayName = "EventListItemDetails";
14234
14333
 
14235
14334
  // src/events/market-details/index.tsx
14236
- var import_hooks49 = require("@agg-build/hooks");
14335
+ var import_hooks50 = require("@agg-build/hooks");
14237
14336
  var import_react27 = require("react");
14238
14337
 
14239
14338
  // src/events/orderbook/index.tsx
@@ -14481,6 +14580,7 @@ var OrderbookRow = ({
14481
14580
  entry,
14482
14581
  formatNumber,
14483
14582
  formatCurrency: formatCurrency2,
14583
+ formatPrice,
14484
14584
  enableAnimations,
14485
14585
  showBadge,
14486
14586
  badgeLabel
@@ -14549,7 +14649,7 @@ var OrderbookRow = ({
14549
14649
  "w-9 min-w-9 md:min-w-10 md:w-10 text-agg-sm font-agg-bold leading-agg-5",
14550
14650
  priceClassName
14551
14651
  ),
14552
- children: formatProbabilityCents(entry.row.price)
14652
+ children: formatProbabilityCents(entry.row.price, formatPrice)
14553
14653
  }
14554
14654
  ),
14555
14655
  /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(OrderbookVenueLogos, { venues })
@@ -14571,7 +14671,10 @@ var Orderbook = ({
14571
14671
  className
14572
14672
  }) => {
14573
14673
  var _a, _b, _c, _d, _e;
14574
- const { enableWebsocketsLogs } = (0, import_hooks47.useAggUiConfig)();
14674
+ const {
14675
+ enableWebsocketsLogs,
14676
+ formatting: { formatPrice }
14677
+ } = (0, import_hooks47.useAggUiConfig)();
14575
14678
  const labels = __spreadValues(__spreadValues({}, orderbookDefaultLabels), labelsProp);
14576
14679
  const scrollContainerRef = (0, import_react25.useRef)(null);
14577
14680
  const spreadRowRef = (0, import_react25.useRef)(null);
@@ -14636,6 +14739,7 @@ var Orderbook = ({
14636
14739
  entry,
14637
14740
  formatNumber,
14638
14741
  formatCurrency: formatCurrency2,
14742
+ formatPrice,
14639
14743
  enableAnimations,
14640
14744
  showBadge: index === askEntries.length - 1,
14641
14745
  badgeLabel: labels.asks
@@ -14648,7 +14752,7 @@ var Orderbook = ({
14648
14752
  ref: spreadRowRef,
14649
14753
  className: "agg-orderbook-spread flex items-center border-y border-agg-separator h-9 px-5 py-2 gap-3 md:gap-10",
14650
14754
  role: "separator",
14651
- "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)}`,
14755
+ "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)}`,
14652
14756
  children: [
14653
14757
  /* @__PURE__ */ (0, import_jsx_runtime142.jsxs)(
14654
14758
  Typography,
@@ -14658,7 +14762,7 @@ var Orderbook = ({
14658
14762
  children: [
14659
14763
  "Last: ",
14660
14764
  labels.lastOutcome ? `${labels.lastOutcome} ` : "",
14661
- formatProbabilityCents((_d = spreadEntry == null ? void 0 : spreadEntry.midPrice) != null ? _d : null)
14765
+ formatProbabilityCents((_d = spreadEntry == null ? void 0 : spreadEntry.midPrice) != null ? _d : null, formatPrice)
14662
14766
  ]
14663
14767
  }
14664
14768
  ),
@@ -14685,6 +14789,7 @@ var Orderbook = ({
14685
14789
  entry,
14686
14790
  formatNumber,
14687
14791
  formatCurrency: formatCurrency2,
14792
+ formatPrice,
14688
14793
  enableAnimations,
14689
14794
  showBadge: index === 0,
14690
14795
  badgeLabel: labels.bids
@@ -14880,6 +14985,7 @@ var resolveOrderEligibilityMessage = (labels, reason) => {
14880
14985
  };
14881
14986
 
14882
14987
  // src/events/market-details/market-details-outcome-button.tsx
14988
+ var import_hooks48 = require("@agg-build/hooks");
14883
14989
  var import_jsx_runtime143 = require("react/jsx-runtime");
14884
14990
  var marketDetailsOutcomeButtonToneClasses = {
14885
14991
  positive: {
@@ -14930,6 +15036,7 @@ var OutcomePriceContent = ({
14930
15036
  value,
14931
15037
  textClassName
14932
15038
  }) => {
15039
+ const { formatPrice } = (0, import_hooks48.useAggUiConfig)().formatting;
14933
15040
  if (isLoading) {
14934
15041
  return /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(
14935
15042
  "span",
@@ -14948,7 +15055,7 @@ var OutcomePriceContent = ({
14948
15055
  as: "span",
14949
15056
  variant: isSelected ? "body-strong" : "body",
14950
15057
  className: cn("shrink-0 whitespace-nowrap", textClassName),
14951
- children: formatProbabilityCents(value)
15058
+ children: formatProbabilityCents(value, formatPrice)
14952
15059
  }
14953
15060
  );
14954
15061
  };
@@ -15042,7 +15149,7 @@ var MarketDetailsOutcomeButton = ({
15042
15149
  MarketDetailsOutcomeButton.displayName = "MarketDetailsOutcomeButton";
15043
15150
 
15044
15151
  // src/events/market-details/market-details-graph-panel.tsx
15045
- var import_hooks48 = require("@agg-build/hooks");
15152
+ var import_hooks49 = require("@agg-build/hooks");
15046
15153
  var import_react26 = require("react");
15047
15154
  var import_jsx_runtime144 = require("react/jsx-runtime");
15048
15155
  var MarketDetailsGraphPanel = ({
@@ -15059,13 +15166,13 @@ var MarketDetailsGraphPanel = ({
15059
15166
  classNames
15060
15167
  }) => {
15061
15168
  var _a, _b, _c;
15062
- const config = (0, import_hooks48.useSdkUiConfig)();
15169
+ const config = (0, import_hooks49.useSdkUiConfig)();
15063
15170
  const {
15064
- formatting: { formatPercent, formatCompactCurrency },
15171
+ formatting: { formatPercent, formatCompactCurrency, formatPrice },
15065
15172
  general: { theme }
15066
15173
  } = config;
15067
15174
  const isDarkTheme = theme === "dark";
15068
- const labels = (0, import_hooks48.useLabels)();
15175
+ const labels = (0, import_hooks49.useLabels)();
15069
15176
  const selectedTimeRange = config.chart.selectedChartTimeRange;
15070
15177
  const setSelectedTimeRange = config.chart.setSelectedChartTimeRange;
15071
15178
  const [chartRangeOverride, setChartRangeOverride] = (0, import_react26.useState)(null);
@@ -15085,7 +15192,7 @@ var MarketDetailsGraphPanel = ({
15085
15192
  livePrices
15086
15193
  });
15087
15194
  }, [livePrices, venueMarkets, resolvedChartOutcomeLabel, chartSelectedOutcomeId]);
15088
- const rollingWindow = (0, import_hooks48.useRollingChartWindow)({ range: effectiveChartTimeRange });
15195
+ const rollingWindow = (0, import_hooks49.useRollingChartWindow)({ range: effectiveChartTimeRange });
15089
15196
  const chartPrimaryOutcomeId = (_b = (_a = chartOutcomesByVenue[0]) == null ? void 0 : _a.outcome.id) != null ? _b : null;
15090
15197
  const chartVenueOutcomeIds = (0, import_react26.useMemo)(() => {
15091
15198
  return chartOutcomesByVenue.map((item) => item.outcome.id);
@@ -15095,7 +15202,7 @@ var MarketDetailsGraphPanel = ({
15095
15202
  isLoading: isMarketChartLoading,
15096
15203
  error: marketChartError,
15097
15204
  refetch: refetchMarketChart
15098
- } = (0, import_hooks48.useMarketChart)({
15205
+ } = (0, import_hooks49.useMarketChart)({
15099
15206
  marketId: chartPrimaryOutcomeId,
15100
15207
  venueMarketIds: chartVenueOutcomeIds,
15101
15208
  interval: rollingWindow.interval,
@@ -15275,8 +15382,8 @@ var MarketDetailsGraphPanel = ({
15275
15382
  const price = outcome.probability;
15276
15383
  return {
15277
15384
  value: outcome.id,
15278
- label: `${(_a3 = outcome == null ? void 0 : outcome.title) != null ? _a3 : outcome.label} ${formatProbabilityCents(price)}`,
15279
- ariaLabel: `${(_b3 = outcome == null ? void 0 : outcome.title) != null ? _b3 : outcome.label} ${formatProbabilityCents(price)}`
15385
+ label: `${(_a3 = outcome == null ? void 0 : outcome.title) != null ? _a3 : outcome.label} ${formatProbabilityCents(price, formatPrice)}`,
15386
+ ariaLabel: `${(_b3 = outcome == null ? void 0 : outcome.title) != null ? _b3 : outcome.label} ${formatProbabilityCents(price, formatPrice)}`
15280
15387
  };
15281
15388
  })
15282
15389
  }
@@ -15305,7 +15412,7 @@ var MarketDetailsGraphPanel = ({
15305
15412
  }
15306
15413
  ),
15307
15414
  /* @__PURE__ */ (0, import_jsx_runtime144.jsx)("span", { "aria-hidden": "true", className: "hidden h-4 w-px bg-agg-separator md:block" }),
15308
- import_hooks48.CHART_TIME_RANGES.map((timeRange) => {
15415
+ import_hooks49.CHART_TIME_RANGES.map((timeRange) => {
15309
15416
  const isActive = effectiveChartTimeRange === timeRange;
15310
15417
  const isDisabled = isResolvedMarket && timeRange !== "ALL";
15311
15418
  return /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(
@@ -15348,7 +15455,7 @@ var MarketDetailsUnavailableState = ({
15348
15455
  ariaLabel,
15349
15456
  classNames
15350
15457
  }) => {
15351
- const labels = (0, import_hooks49.useLabels)();
15458
+ const labels = (0, import_hooks50.useLabels)();
15352
15459
  return /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(
15353
15460
  Card,
15354
15461
  {
@@ -15372,7 +15479,7 @@ var MarketDetailsNotFoundState = ({
15372
15479
  ariaLabel: _ariaLabel,
15373
15480
  classNames: _classNames
15374
15481
  }) => {
15375
- const labels = (0, import_hooks49.useLabels)();
15482
+ const labels = (0, import_hooks50.useLabels)();
15376
15483
  return /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(
15377
15484
  StateMessage,
15378
15485
  {
@@ -15410,33 +15517,33 @@ var MarketDetailsContent = ({
15410
15517
  midpointsResult
15411
15518
  }) => {
15412
15519
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
15413
- const config = (0, import_hooks49.useSdkUiConfig)();
15520
+ const config = (0, import_hooks50.useSdkUiConfig)();
15414
15521
  const {
15415
15522
  features: { enableAnimations },
15416
15523
  formatting: { formatPercent }
15417
15524
  } = config;
15418
- const labels = (0, import_hooks49.useLabels)();
15419
- const tradingContext = (0, import_hooks49.useEventTradingContext)();
15525
+ const labels = (0, import_hooks50.useLabels)();
15526
+ const tradingContext = (0, import_hooks50.useEventTradingContext)();
15420
15527
  const detailsContentId = (0, import_react27.useId)();
15421
15528
  const tradeSide = (_a = tradingContext == null ? void 0 : tradingContext.tradeSide) != null ? _a : "buy";
15422
15529
  const resolvedMarket = (0, import_react27.useMemo)(() => {
15423
15530
  return resolveMarketFromVenueMarkets(venueMarkets, marketId);
15424
15531
  }, [venueMarkets, marketId]);
15425
15532
  const clusterVenueMarkets = resolvedMarket == null ? void 0 : resolvedMarket.venueMarkets;
15426
- const wsLivePrices = (0, import_hooks49.useLiveOutcomePrices)(clusterVenueMarkets);
15427
- const wsBestPrices = (0, import_hooks49.useLiveBestPrices)(clusterVenueMarkets);
15428
- const wsBestCandidates = (0, import_hooks49.useLiveBestPriceCandidates)(clusterVenueMarkets);
15533
+ const wsLivePrices = (0, import_hooks50.useLiveOutcomePrices)(clusterVenueMarkets);
15534
+ const wsBestPrices = (0, import_hooks50.useLiveBestPrices)(clusterVenueMarkets);
15535
+ const wsBestCandidates = (0, import_hooks50.useLiveBestPriceCandidates)(clusterVenueMarkets);
15429
15536
  const scopedResolvedMarket = (0, import_react27.useMemo)(() => {
15430
15537
  var _a2, _b2;
15431
15538
  if (!resolvedMarket) return null;
15432
15539
  return (_b2 = (_a2 = resolvedMarket.venueMarkets.find((venueMarket) => venueMarket.id === resolvedMarket.id)) != null ? _a2 : resolvedMarket.venueMarkets[0]) != null ? _b2 : null;
15433
15540
  }, [resolvedMarket]);
15434
- const isResolvedMarket = (0, import_hooks49.resolveMarketTradingState)(scopedResolvedMarket).kind === "resolved";
15435
- (0, import_hooks49.useEventOrderbookData)(
15541
+ const isResolvedMarket = (0, import_hooks50.resolveMarketTradingState)(scopedResolvedMarket).kind === "resolved";
15542
+ (0, import_hooks50.useEventOrderbookData)(
15436
15543
  isResolvedMarket ? [] : resolvedMarket == null ? void 0 : resolvedMarket.venueMarkets,
15437
15544
  (_b = scopedResolvedMarket == null ? void 0 : scopedResolvedMarket.id) != null ? _b : null
15438
15545
  );
15439
- const fetchedClusterMidpointResult = (0, import_hooks49.useMidpoints)(midpointsResult ? [] : clusterVenueMarkets);
15546
+ const fetchedClusterMidpointResult = (0, import_hooks50.useMidpoints)(midpointsResult ? [] : clusterVenueMarkets);
15440
15547
  const clusterMidpointResult = midpointsResult != null ? midpointsResult : fetchedClusterMidpointResult;
15441
15548
  const clusterMidpoints = (_c = clusterMidpointResult.bestMidpointsByOutcomeId) != null ? _c : clusterMidpointResult.prices;
15442
15549
  const clusterBestMidpointsByOutcomeId = clusterMidpoints;
@@ -15445,7 +15552,7 @@ var MarketDetailsContent = ({
15445
15552
  const clusterBestMidpointVenue = clusterMidpointResult.bestMidpointVenue;
15446
15553
  const clusterBestPricesRest = clusterMidpointResult.bestPrices;
15447
15554
  const clusterBestPrices = (0, import_react27.useMemo)(
15448
- () => (0, import_hooks49.mergeBestPricesPreferringLive)(clusterBestPricesRest, wsBestPrices),
15555
+ () => (0, import_hooks50.mergeBestPricesPreferringLive)(clusterBestPricesRest, wsBestPrices),
15449
15556
  [clusterBestPricesRest, wsBestPrices]
15450
15557
  );
15451
15558
  const clusterBestPriceVenuesByOutcomeId = clusterMidpointResult.bestPriceVenuesByOutcomeId;
@@ -15500,7 +15607,7 @@ var MarketDetailsContent = ({
15500
15607
  return (_a2 = model.market.venueMarkets.find((venueMarket) => venueMarket.id === model.market.id)) != null ? _a2 : model.primaryVenueMarket;
15501
15608
  }, [model]);
15502
15609
  const marketTradingState = (0, import_react27.useMemo)(() => {
15503
- return (0, import_hooks49.resolveMarketTradingState)(scopedMarketForCard);
15610
+ return (0, import_hooks50.resolveMarketTradingState)(scopedMarketForCard);
15504
15611
  }, [scopedMarketForCard]);
15505
15612
  const isOutcomeSelectionLocked = marketTradingState.isTradingDisabled;
15506
15613
  const isUpcomingMarket = marketTradingState.kind === "unopened";
@@ -15661,7 +15768,7 @@ var MarketDetailsContent = ({
15661
15768
  fallbackPrice: midpointsFallback == null ? void 0 : midpointsFallback.get(displayOutcome.id)
15662
15769
  });
15663
15770
  if (referencePrice != null) return referencePrice;
15664
- return (0, import_hooks49.findLivePriceById)(wsLivePrices, displayOutcome.id);
15771
+ return (0, import_hooks50.findLivePriceById)(wsLivePrices, displayOutcome.id);
15665
15772
  }, [
15666
15773
  clusterBestMidpoint,
15667
15774
  clusterBestMidpointsByOutcomeId,
@@ -15687,7 +15794,7 @@ var MarketDetailsContent = ({
15687
15794
  const orderBookEnabled = isOpened && effectiveSelectedTab === "order-book" && !marketTradingState.isTradingDisabled;
15688
15795
  const primaryVenueMarketId = (_g = (_f = selectedOutcomesByVenue[0]) == null ? void 0 : _f.market.id) != null ? _g : null;
15689
15796
  const primaryOutcomeId = (_i = (_h = selectedOutcomesByVenue[0]) == null ? void 0 : _h.outcome.id) != null ? _i : null;
15690
- const marketOrderbookResult = (0, import_hooks49.useMarketOrderbook)({
15797
+ const marketOrderbookResult = (0, import_hooks50.useMarketOrderbook)({
15691
15798
  marketId: primaryVenueMarketId,
15692
15799
  enabled: orderBookEnabled && !!primaryVenueMarketId,
15693
15800
  venueOutcomes: selectedOutcomesByVenue.map((item) => ({
@@ -15868,7 +15975,7 @@ var MarketDetailsContent = ({
15868
15975
  !compactHeader ? /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(
15869
15976
  RemoteImage,
15870
15977
  {
15871
- src: (0, import_hooks49.optimizedImageUrl)(model.image, 60),
15978
+ src: (0, import_hooks50.optimizedImageUrl)(model.image, 60),
15872
15979
  alt: "",
15873
15980
  className: "agg-market-image size-12 rounded-agg-lg object-cover md:size-[60px]"
15874
15981
  }
@@ -16119,7 +16226,7 @@ var MarketDetailsContent = ({
16119
16226
  };
16120
16227
  var MarketDetails = (_a) => {
16121
16228
  var _b = _a, { isOpened } = _b, props = __objRest(_b, ["isOpened"]);
16122
- const labels = (0, import_hooks49.useLabels)();
16229
+ const labels = (0, import_hooks50.useLabels)();
16123
16230
  if (props.isLoading) {
16124
16231
  return /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(
16125
16232
  Skeleton,
@@ -16174,13 +16281,13 @@ var resolveIsResolvedEvent = (sourceMarkets, eventTradingState) => {
16174
16281
  return eventTradingState.kind === "resolved";
16175
16282
  }
16176
16283
  if (sourceMarkets.length === 0) return false;
16177
- return sourceMarkets.every((market) => (0, import_hooks49.resolveMarketTradingState)(market).kind === "resolved");
16284
+ return sourceMarkets.every((market) => (0, import_hooks50.resolveMarketTradingState)(market).kind === "resolved");
16178
16285
  };
16179
16286
  var resolveResolvedWinnerMarketId = (sourceMarkets, eventTradingState) => {
16180
16287
  var _a, _b, _c, _d, _e;
16181
16288
  const preferredMarket = (_a = eventTradingState == null ? void 0 : eventTradingState.primaryMarket) != null ? _a : null;
16182
16289
  if (preferredMarket && sourceMarkets.some((market) => market.id === preferredMarket.id)) {
16183
- if ((0, import_hooks49.resolveMarketTradingState)(preferredMarket).kind === "resolved") {
16290
+ if ((0, import_hooks50.resolveMarketTradingState)(preferredMarket).kind === "resolved") {
16184
16291
  return preferredMarket.id;
16185
16292
  }
16186
16293
  }
@@ -16200,8 +16307,8 @@ var MarketDetailsList = ({
16200
16307
  midpointsResult
16201
16308
  }) => {
16202
16309
  var _a, _b;
16203
- const labels = (0, import_hooks49.useLabels)();
16204
- const tradingContext = (0, import_hooks49.useEventTradingContext)();
16310
+ const labels = (0, import_hooks50.useLabels)();
16311
+ const tradingContext = (0, import_hooks50.useEventTradingContext)();
16205
16312
  const selectedMarketId = (_a = tradingContext == null ? void 0 : tradingContext.selectedMarketId) != null ? _a : null;
16206
16313
  const [expandedMarketId, setExpandedMarketId] = (0, import_react27.useState)(null);
16207
16314
  const [areResolvedMarketsVisible, setAreResolvedMarketsVisible] = (0, import_react27.useState)(false);
@@ -16210,10 +16317,10 @@ var MarketDetailsList = ({
16210
16317
  markets: rawMarkets,
16211
16318
  isLoading,
16212
16319
  error
16213
- } = (0, import_hooks49.useVenueMarkets)({
16320
+ } = (0, import_hooks50.useVenueMarkets)({
16214
16321
  venueEventId: resolvedEventId,
16215
16322
  enabled: !providedMarkets && !!resolvedEventId,
16216
- status: import_hooks49.MarketStatus.open,
16323
+ status: import_hooks50.MarketStatus.open,
16217
16324
  // Keep in lockstep with useEnrichedVenueEvent: limit is part of the React
16218
16325
  // Query key, so a mismatch would fork the shared cache into two requests.
16219
16326
  // fetchAll drains every page — events can exceed any single-page limit
@@ -16257,7 +16364,7 @@ var MarketDetailsList = ({
16257
16364
  const resolved = [];
16258
16365
  const closed = [];
16259
16366
  sourceMarkets.forEach((market) => {
16260
- const marketStateKind = (0, import_hooks49.resolveMarketTradingState)(market).kind;
16367
+ const marketStateKind = (0, import_hooks50.resolveMarketTradingState)(market).kind;
16261
16368
  if (marketStateKind === "resolved") {
16262
16369
  resolved.push(market);
16263
16370
  return;
@@ -16285,10 +16392,10 @@ var MarketDetailsList = ({
16285
16392
  const hasPrefetchedMarkets = !!providedMarkets || !!((_b = eventTradingState == null ? void 0 : eventTradingState.marketStates) == null ? void 0 : _b.length);
16286
16393
  const midpointEligibleMarkets = (0, import_react27.useMemo)(() => {
16287
16394
  return displayedMarkets.filter(
16288
- (market) => (0, import_hooks49.resolveMarketTradingState)(market).kind !== "resolved"
16395
+ (market) => (0, import_hooks50.resolveMarketTradingState)(market).kind !== "resolved"
16289
16396
  );
16290
16397
  }, [displayedMarkets]);
16291
- const { prices: midpointsFallback, venueByOutcomeId: midpointsFallbackVenues } = (0, import_hooks49.useViewportMidpoints)(midpointEligibleMarkets);
16398
+ const { prices: midpointsFallback, venueByOutcomeId: midpointsFallbackVenues } = (0, import_hooks50.useViewportMidpoints)(midpointEligibleMarkets);
16292
16399
  (0, import_react27.useEffect)(() => {
16293
16400
  if (isResolvedEvent) {
16294
16401
  setAreResolvedMarketsVisible(false);
@@ -16307,7 +16414,7 @@ var MarketDetailsList = ({
16307
16414
  return;
16308
16415
  }
16309
16416
  const fallbackSelectableMarket = displayedMarkets.find(
16310
- (market) => !(0, import_hooks49.resolveMarketTradingState)(market).isTradingDisabled
16417
+ (market) => !(0, import_hooks50.resolveMarketTradingState)(market).isTradingDisabled
16311
16418
  );
16312
16419
  if (!fallbackSelectableMarket) {
16313
16420
  return;
@@ -16329,7 +16436,7 @@ var MarketDetailsList = ({
16329
16436
  setExpandedMarketId(marketId);
16330
16437
  onExpandedMarketChange == null ? void 0 : onExpandedMarketChange(marketId);
16331
16438
  if (marketId === selectedMarketId) return;
16332
- if ((0, import_hooks49.resolveMarketTradingState)(market).isTradingDisabled) return;
16439
+ if ((0, import_hooks50.resolveMarketTradingState)(market).isTradingDisabled) return;
16333
16440
  tradingContext == null ? void 0 : tradingContext.selectMarket(market.id, market);
16334
16441
  };
16335
16442
  if (!hasPrefetchedMarkets && isLoading) {
@@ -16427,7 +16534,7 @@ var isVenue = (0, import_sdk17.enumGuard)(import_sdk17.Venue);
16427
16534
  var parseVenue = (v) => (0, import_sdk17.safeParse)(v, isVenue);
16428
16535
 
16429
16536
  // src/trading/settlement/settlement-details.tsx
16430
- var import_hooks50 = require("@agg-build/hooks");
16537
+ var import_hooks51 = require("@agg-build/hooks");
16431
16538
  var import_jsx_runtime146 = require("react/jsx-runtime");
16432
16539
  var hasContent = (value) => {
16433
16540
  return typeof value === "string" && value.trim().length > 0;
@@ -16451,11 +16558,11 @@ var buildVenueSettlementRules = (venueMarkets) => {
16451
16558
  };
16452
16559
  var SettlementDetails = ({ className }) => {
16453
16560
  var _a, _b, _c, _d, _e, _f;
16454
- const tradingContext = (0, import_hooks50.useEventTradingContext)();
16561
+ const tradingContext = (0, import_hooks51.useEventTradingContext)();
16455
16562
  const selectedEvent = (_a = tradingContext == null ? void 0 : tradingContext.selectedEvent) != null ? _a : null;
16456
16563
  const selectedMarket = (_b = tradingContext == null ? void 0 : tradingContext.selectedMarket) != null ? _b : null;
16457
16564
  if (!selectedEvent) return null;
16458
- const activeMarket = selectedMarket != null ? selectedMarket : (0, import_hooks50.resolveDefaultTradingMarket)(selectedEvent);
16565
+ const activeMarket = selectedMarket != null ? selectedMarket : (0, import_hooks51.resolveDefaultTradingMarket)(selectedEvent);
16459
16566
  if (!activeMarket) return null;
16460
16567
  const allVenueMarkets = normalizeVenueMarketCluster(selectedEvent.venueMarkets);
16461
16568
  const activeMarketCluster = normalizeVenueMarketCluster(
@@ -16496,10 +16603,9 @@ var SettlementDetails = ({ className }) => {
16496
16603
  SettlementDetails.displayName = "SettlementDetails";
16497
16604
 
16498
16605
  // src/trading/place-order/index.tsx
16499
- var import_hooks60 = require("@agg-build/hooks");
16606
+ var import_hooks61 = require("@agg-build/hooks");
16500
16607
  var import_sdk22 = require("@agg-build/sdk");
16501
16608
  var import_react35 = __toESM(require("@number-flow/react"));
16502
- var DropdownMenu = __toESM(require("@radix-ui/react-dropdown-menu"));
16503
16609
  var Popover = __toESM(require("@radix-ui/react-popover"));
16504
16610
  var import_dayjs8 = __toESM(require("dayjs"));
16505
16611
  var import_timezone2 = __toESM(require("dayjs/plugin/timezone"));
@@ -16507,14 +16613,14 @@ var import_utc2 = __toESM(require("dayjs/plugin/utc"));
16507
16613
  var import_react36 = require("react");
16508
16614
 
16509
16615
  // src/geo-block-banner/index.tsx
16510
- var import_hooks51 = require("@agg-build/hooks");
16616
+ var import_hooks52 = require("@agg-build/hooks");
16511
16617
  var import_jsx_runtime147 = require("react/jsx-runtime");
16512
16618
  var GeoBlockBanner = ({
16513
16619
  venue,
16514
16620
  termsUrl = AGG_TERMS_OF_SERVICE_URL,
16515
16621
  className
16516
16622
  }) => {
16517
- const labels = (0, import_hooks51.useLabels)();
16623
+ const labels = (0, import_hooks52.useLabels)();
16518
16624
  const message = venue ? labels.trading.geoBlockVenueMessage(venue) : labels.trading.geoBlockGenericMessage;
16519
16625
  return /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)(
16520
16626
  "div",
@@ -16536,7 +16642,7 @@ GeoBlockBanner.displayName = "GeoBlockBanner";
16536
16642
 
16537
16643
  // src/onboarding/index.tsx
16538
16644
  var import_react32 = require("react");
16539
- var import_hooks57 = require("@agg-build/hooks");
16645
+ var import_hooks58 = require("@agg-build/hooks");
16540
16646
  var Dialog5 = __toESM(require("@radix-ui/react-dialog"));
16541
16647
 
16542
16648
  // src/onboarding/onboarding-modal.constants.ts
@@ -16560,7 +16666,7 @@ var ONCHAIN_VENUES = [
16560
16666
 
16561
16667
  // src/onboarding/steps/how-it-works.tsx
16562
16668
  var import_react28 = require("react");
16563
- var import_hooks52 = require("@agg-build/hooks");
16669
+ var import_hooks53 = require("@agg-build/hooks");
16564
16670
  var import_jsx_runtime148 = require("react/jsx-runtime");
16565
16671
  var defaultIcons = {
16566
16672
  createAccount: /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(CreateAccountIcon, { className: "h-[28px] w-[28px] text-agg-muted-foreground" }),
@@ -16569,7 +16675,7 @@ var defaultIcons = {
16569
16675
  stayInControl: /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(StayInControlIcon, { className: "h-[28px] w-[28px] text-agg-muted-foreground" })
16570
16676
  };
16571
16677
  var HowItWorksStep = ({ onContinue, icons }) => {
16572
- const labels = (0, import_hooks52.useLabels)();
16678
+ const labels = (0, import_hooks53.useLabels)();
16573
16679
  const scrollRef = (0, import_react28.useRef)(null);
16574
16680
  const [showTopGradient, setShowTopGradient] = (0, import_react28.useState)(false);
16575
16681
  const [showBottomGradient, setShowBottomGradient] = (0, import_react28.useState)(true);
@@ -16643,10 +16749,10 @@ HowItWorksStep.displayName = "HowItWorksStep";
16643
16749
 
16644
16750
  // src/onboarding/steps/profile-setup.tsx
16645
16751
  var import_react29 = require("react");
16646
- var import_hooks53 = require("@agg-build/hooks");
16752
+ var import_hooks54 = require("@agg-build/hooks");
16647
16753
  var import_jsx_runtime149 = require("react/jsx-runtime");
16648
16754
  var ProfileSetupStep = ({ onContinue }) => {
16649
- const labels = (0, import_hooks53.useLabels)();
16755
+ const labels = (0, import_hooks54.useLabels)();
16650
16756
  const [username, setUsername] = (0, import_react29.useState)("");
16651
16757
  const [avatarFile, setAvatarFile] = (0, import_react29.useState)();
16652
16758
  const [avatarPreview, setAvatarPreview] = (0, import_react29.useState)();
@@ -16776,7 +16882,7 @@ var ProfileSetupStep = ({ onContinue }) => {
16776
16882
  ProfileSetupStep.displayName = "ProfileSetupStep";
16777
16883
 
16778
16884
  // src/onboarding/steps/connect-accounts.tsx
16779
- var import_hooks54 = require("@agg-build/hooks");
16885
+ var import_hooks55 = require("@agg-build/hooks");
16780
16886
  var import_jsx_runtime150 = require("react/jsx-runtime");
16781
16887
  var OnchainVenueLogos = () => {
16782
16888
  return /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("div", { className: "flex gap-1 sm:gap-0 sm:-space-x-5", children: ONCHAIN_VENUES.map((venue, index) => /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("div", { style: { zIndex: ONCHAIN_VENUES.length - index }, children: /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(VenueLogo, { venue, variant: "logo", size: "medium", className: "sm:h-8 sm:w-8" }) }, venue)) });
@@ -16790,7 +16896,7 @@ var VenueCard = ({
16790
16896
  onConnect,
16791
16897
  connected = false
16792
16898
  }) => {
16793
- const labels = (0, import_hooks54.useLabels)();
16899
+ const labels = (0, import_hooks55.useLabels)();
16794
16900
  const action = connected ? /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(CheckCircleIcon, { className: "h-6 w-6 text-agg-success" }) : /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(
16795
16901
  Button,
16796
16902
  {
@@ -16849,7 +16955,7 @@ var ConnectAccountsStep = ({
16849
16955
  onContinue,
16850
16956
  connectedOnchain = false
16851
16957
  }) => {
16852
- const labels = (0, import_hooks54.useLabels)();
16958
+ const labels = (0, import_hooks55.useLabels)();
16853
16959
  const canContinue = connectedOnchain;
16854
16960
  return /* @__PURE__ */ (0, import_jsx_runtime150.jsxs)("div", { className: "flex flex-col gap-6", children: [
16855
16961
  /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("h2", { className: "text-center text-agg-2xl font-agg-bold text-agg-foreground", children: labels.onboarding.connectAccounts.title }),
@@ -16884,7 +16990,7 @@ ConnectAccountsStep.displayName = "ConnectAccountsStep";
16884
16990
 
16885
16991
  // src/onboarding/steps/connect-onchain-modal.tsx
16886
16992
  var import_react30 = require("react");
16887
- var import_hooks55 = require("@agg-build/hooks");
16993
+ var import_hooks56 = require("@agg-build/hooks");
16888
16994
  var Dialog3 = __toESM(require("@radix-ui/react-dialog"));
16889
16995
  var import_jsx_runtime151 = require("react/jsx-runtime");
16890
16996
  var ConnectOnchainModal = ({
@@ -16892,7 +16998,7 @@ var ConnectOnchainModal = ({
16892
16998
  onOpenChange,
16893
16999
  onConnect
16894
17000
  }) => {
16895
- const labels = (0, import_hooks55.useLabels)();
17001
+ const labels = (0, import_hooks56.useLabels)();
16896
17002
  const [connecting, setConnecting] = (0, import_react30.useState)(false);
16897
17003
  const [error, setError] = (0, import_react30.useState)();
16898
17004
  const handleCancel = (0, import_react30.useCallback)(() => {
@@ -16991,7 +17097,7 @@ var ConnectOnchainModal = ({
16991
17097
  ConnectOnchainModal.displayName = "ConnectOnchainModal";
16992
17098
 
16993
17099
  // src/onboarding/steps/connect-kalshi-modal.tsx
16994
- var import_hooks56 = require("@agg-build/hooks");
17100
+ var import_hooks57 = require("@agg-build/hooks");
16995
17101
  var import_sdk19 = require("@agg-build/sdk");
16996
17102
  var Dialog4 = __toESM(require("@radix-ui/react-dialog"));
16997
17103
  var import_react31 = require("react");
@@ -17018,8 +17124,8 @@ var ConnectKalshiModal = ({
17018
17124
  onOpenChange,
17019
17125
  onVerify
17020
17126
  }) => {
17021
- const labels = (0, import_hooks56.useLabels)();
17022
- const { disabledVenues, isLoading: isAppConfigLoading } = (0, import_hooks56.useAppConfig)();
17127
+ const labels = (0, import_hooks57.useLabels)();
17128
+ const { disabledVenues, isLoading: isAppConfigLoading } = (0, import_hooks57.useAppConfig)();
17023
17129
  const apiKeyInputRef = (0, import_react31.useRef)(null);
17024
17130
  const errorId = (0, import_react31.useId)();
17025
17131
  const [apiKeyId, setApiKeyId] = (0, import_react31.useState)("");
@@ -17027,7 +17133,7 @@ var ConnectKalshiModal = ({
17027
17133
  const [isVerifying, setIsVerifying] = (0, import_react31.useState)(false);
17028
17134
  const [isConnected, setIsConnected] = (0, import_react31.useState)(false);
17029
17135
  const [error, setError] = (0, import_react31.useState)();
17030
- const availabilityState = (0, import_hooks56.getVenueAvailabilityState)({
17136
+ const availabilityState = (0, import_hooks57.getVenueAvailabilityState)({
17031
17137
  venueId: import_sdk19.Venue.kalshi,
17032
17138
  disabledVenues,
17033
17139
  isConfigLoading: isAppConfigLoading
@@ -17329,7 +17435,7 @@ var OnboardingModal = ({
17329
17435
  connectedOnchain = false
17330
17436
  }) => {
17331
17437
  var _a;
17332
- const labels = (0, import_hooks57.useLabels)();
17438
+ const labels = (0, import_hooks58.useLabels)();
17333
17439
  const [step, setStep] = (0, import_react32.useState)(ONBOARDING_STEPS.HOW_IT_WORKS);
17334
17440
  const stepLabels = {
17335
17441
  [ONBOARDING_STEPS.HOW_IT_WORKS]: labels.onboarding.modal.stepHowItWorks,
@@ -17402,7 +17508,7 @@ var OnboardingModal = ({
17402
17508
  OnboardingModal.displayName = "OnboardingModal";
17403
17509
 
17404
17510
  // src/notifications/agg-notification-events-provider.tsx
17405
- var import_hooks58 = require("@agg-build/hooks");
17511
+ var import_hooks59 = require("@agg-build/hooks");
17406
17512
  var import_react33 = require("react");
17407
17513
  var import_jsx_runtime154 = require("react/jsx-runtime");
17408
17514
  var firedOrderNotificationKeys = /* @__PURE__ */ new Set();
@@ -17506,12 +17612,12 @@ var requestAggWithdrawModalOpen = () => {
17506
17612
  };
17507
17613
 
17508
17614
  // src/trading/fund-kalshi-modal.tsx
17509
- var import_hooks59 = require("@agg-build/hooks");
17615
+ var import_hooks60 = require("@agg-build/hooks");
17510
17616
  var import_sdk20 = require("@agg-build/sdk");
17511
17617
  var Dialog6 = __toESM(require("@radix-ui/react-dialog"));
17512
17618
  var import_jsx_runtime155 = require("react/jsx-runtime");
17513
17619
  var FundKalshiModal = ({ open, onOpenChange }) => {
17514
- const labels = (0, import_hooks59.useLabels)();
17620
+ const labels = (0, import_hooks60.useLabels)();
17515
17621
  const modalLabels = labels.trading.fundKalshiModal;
17516
17622
  return /* @__PURE__ */ (0, import_jsx_runtime155.jsx)(Modal, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime155.jsxs)(
17517
17623
  Modal.Container,
@@ -17583,11 +17689,12 @@ var MIN_SELL_ORDER_SHARES = 1;
17583
17689
  var DEFAULT_SLIPPAGE_VALUE = "0.5";
17584
17690
  var HIGH_SLIPPAGE_THRESHOLD = 10;
17585
17691
  var PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT = 3;
17692
+ 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";
17586
17693
  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";
17587
17694
  var PLACE_ORDER_OUTCOME_BUTTON_CLASS_NAMES = {
17588
17695
  activeNegative: "border-agg-error/50 bg-agg-error/15 font-agg-bold text-agg-error",
17589
17696
  activePositive: "border-agg-success/50 bg-agg-success/15 font-agg-bold text-agg-success",
17590
- base: "flex h-10 flex-1 items-center justify-center rounded-agg-full border px-6 text-agg-base leading-agg-6",
17697
+ base: "flex h-11 flex-1 items-center justify-center rounded-agg-full border px-6 text-agg-base leading-agg-6",
17591
17698
  inactive: "border-transparent bg-agg-secondary-hover font-agg-normal text-agg-foreground hover:bg-agg-tertiary"
17592
17699
  };
17593
17700
 
@@ -18056,6 +18163,93 @@ var routePriceLabelFormatter = new Intl.NumberFormat("en-US", {
18056
18163
  maximumFractionDigits: 1
18057
18164
  });
18058
18165
  var GEO_BLOCK_WARNING_PREFIX = "Venue not available in your region";
18166
+ var normalizeOutcomeName = (value) => {
18167
+ var _a;
18168
+ return (_a = value == null ? void 0 : value.trim().toLowerCase()) != null ? _a : "";
18169
+ };
18170
+ var findMatchingVenueOutcome = (market, selectedOutcome) => {
18171
+ var _a, _b;
18172
+ const selectedNames = new Set(
18173
+ [selectedOutcome.label, selectedOutcome.title].map(normalizeOutcomeName).filter(Boolean)
18174
+ );
18175
+ return (_b = (_a = market.venueMarketOutcomes) == null ? void 0 : _a.find((outcome) => {
18176
+ const normalizedLabel = normalizeOutcomeName(outcome.label);
18177
+ return normalizedLabel !== "" && selectedNames.has(normalizedLabel);
18178
+ })) != null ? _b : null;
18179
+ };
18180
+ var buildLimitOrderVenueOptions = ({
18181
+ currentPrices,
18182
+ livePrices,
18183
+ market,
18184
+ selectedOutcomeId
18185
+ }) => {
18186
+ var _a, _b, _c, _d;
18187
+ if (!market || !selectedOutcomeId) return [];
18188
+ const selectedOutcome = market.venueMarketOutcomes.find(
18189
+ (outcome) => outcome.id === selectedOutcomeId
18190
+ );
18191
+ if (!selectedOutcome) return [];
18192
+ const options = /* @__PURE__ */ new Map();
18193
+ const addOption = ({
18194
+ outcomeId,
18195
+ venue,
18196
+ venueMarketId
18197
+ }) => {
18198
+ var _a2;
18199
+ const parsedVenue = parseVenue(venue);
18200
+ if (!parsedVenue.success || options.has(parsedVenue.data)) return;
18201
+ options.set(parsedVenue.data, {
18202
+ currentPrice: (_a2 = livePrices == null ? void 0 : livePrices.get(outcomeId)) != null ? _a2 : currentPrices.get(outcomeId),
18203
+ venue: parsedVenue.data,
18204
+ venueMarketId,
18205
+ venueMarketOutcomeId: outcomeId
18206
+ });
18207
+ };
18208
+ addOption({
18209
+ outcomeId: selectedOutcome.id,
18210
+ venue: market.venue,
18211
+ venueMarketId: market.id
18212
+ });
18213
+ const matchedMarketsById = new Map(
18214
+ ((_a = market.matchedVenueMarkets) != null ? _a : []).map((matchedMarket) => [matchedMarket.id, matchedMarket])
18215
+ );
18216
+ const matchedOutcomeRefs = (_b = selectedOutcome.matchedVenueMarketOutcomes) != null ? _b : [];
18217
+ for (const ref of matchedOutcomeRefs) {
18218
+ const matchedMarket = matchedMarketsById.get(ref.venueMarketId);
18219
+ const matchedOutcome = (_c = matchedMarket == null ? void 0 : matchedMarket.venueMarketOutcomes) == null ? void 0 : _c.find(
18220
+ (outcome) => outcome.id === ref.venueMarketOutcomeId
18221
+ );
18222
+ if (!matchedMarket || !matchedOutcome) continue;
18223
+ addOption({
18224
+ outcomeId: matchedOutcome.id,
18225
+ venue: matchedMarket.venue,
18226
+ venueMarketId: matchedMarket.id
18227
+ });
18228
+ }
18229
+ if (matchedOutcomeRefs.length === 0) {
18230
+ for (const matchedMarket of (_d = market.matchedVenueMarkets) != null ? _d : []) {
18231
+ const matchedOutcome = findMatchingVenueOutcome(matchedMarket, selectedOutcome);
18232
+ if (!matchedOutcome) continue;
18233
+ addOption({
18234
+ outcomeId: matchedOutcome.id,
18235
+ venue: matchedMarket.venue,
18236
+ venueMarketId: matchedMarket.id
18237
+ });
18238
+ }
18239
+ }
18240
+ return [...options.values()];
18241
+ };
18242
+ var resolveAutomaticLimitOrderVenueOption = (options, side) => {
18243
+ if (options.length === 0) return null;
18244
+ return [...options].sort((left, right) => {
18245
+ if (left.currentPrice == null && right.currentPrice == null) {
18246
+ return left.venue.localeCompare(right.venue);
18247
+ }
18248
+ if (left.currentPrice == null) return 1;
18249
+ if (right.currentPrice == null) return -1;
18250
+ return side === "buy" ? left.currentPrice - right.currentPrice : right.currentPrice - left.currentPrice;
18251
+ })[0];
18252
+ };
18059
18253
  var isGeoBlockWarningReason = (reason) => reason.startsWith(GEO_BLOCK_WARNING_PREFIX);
18060
18254
  var extractGeoBlockedVenues = (warnings) => {
18061
18255
  if (!(warnings == null ? void 0 : warnings.length)) return /* @__PURE__ */ new Set();
@@ -18063,6 +18257,12 @@ var extractGeoBlockedVenues = (warnings) => {
18063
18257
  warnings.filter((w) => w.venue && isGeoBlockWarningReason(w.reason)).map((w) => w.venue)
18064
18258
  );
18065
18259
  };
18260
+ var getSmartRouteTotalFees = (feeBreakdown) => {
18261
+ if (!feeBreakdown) return null;
18262
+ const feeParts = [feeBreakdown.venueFees, feeBreakdown.bridgeFees, feeBreakdown.executionGas];
18263
+ if (!feeParts.every(Number.isFinite)) return null;
18264
+ return feeParts.reduce((total, fee) => total + fee, 0);
18265
+ };
18066
18266
  var hasLowLiquidityWarning = (warnings) => {
18067
18267
  if (!(warnings == null ? void 0 : warnings.length)) return false;
18068
18268
  return warnings.some((warning) => (warning == null ? void 0 : warning.reason) === "low_liquidity");
@@ -19714,7 +19914,7 @@ var PlaceOrderSlippageControl = ({
19714
19914
  minimumValue: slippageMinimumValue
19715
19915
  }) => {
19716
19916
  var _a, _b;
19717
- const labels = (0, import_hooks60.useLabels)();
19917
+ const labels = (0, import_hooks61.useLabels)();
19718
19918
  const containerRef = (0, import_react36.useRef)(null);
19719
19919
  const triggerRef = (0, import_react36.useRef)(null);
19720
19920
  const inputRef = (0, import_react36.useRef)(null);
@@ -19987,7 +20187,7 @@ var PlaceOrderResolvedView = ({
19987
20187
  isSportsEvent = false
19988
20188
  }) => {
19989
20189
  var _a, _b;
19990
- const labels = (0, import_hooks60.useLabels)();
20190
+ const labels = (0, import_hooks61.useLabels)();
19991
20191
  const tradingLabels = labels.trading;
19992
20192
  const resolvingTimestamp = (_a = resolutionTimestamp != null ? resolutionTimestamp : tradingState.resolvesAt) != null ? _a : tradingState.endsAt;
19993
20193
  const isResolvingMarket = false;
@@ -20351,23 +20551,24 @@ var PlaceOrder = ({
20351
20551
  resolvedClaim,
20352
20552
  midpointsResult
20353
20553
  }) => {
20354
- 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;
20554
+ 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, __, _$;
20355
20555
  const {
20356
20556
  enableDebug: isExecutionDebugEnabled,
20357
20557
  features: { enableAnimations, showFeesBreakdown, showLimitOrders },
20558
+ formatting: { formatPrice },
20358
20559
  general: { locale },
20359
20560
  trading: { executionMode: configuredExecutionMode = "live" } = { executionMode: "live" }
20360
- } = (0, import_hooks60.useSdkUiConfig)();
20361
- const labels = (0, import_hooks60.useLabels)();
20561
+ } = (0, import_hooks61.useSdkUiConfig)();
20562
+ const labels = (0, import_hooks61.useLabels)();
20362
20563
  const tradingLabels = labels.trading;
20363
20564
  const toastCtx = useOptionalToast();
20364
- const { isTradingBlocked } = (0, import_hooks60.useGeoBlock)();
20365
- const tradingContext = (0, import_hooks60.useEventTradingContext)();
20565
+ const { isTradingBlocked } = (0, import_hooks61.useGeoBlock)();
20566
+ const tradingContext = (0, import_hooks61.useEventTradingContext)();
20366
20567
  const selectedEvent = (_a = tradingContext == null ? void 0 : tradingContext.selectedEvent) != null ? _a : null;
20367
20568
  const selectedMarket = (_b = tradingContext == null ? void 0 : tradingContext.selectedMarket) != null ? _b : null;
20368
20569
  const selectedOutcomeId = (_c = tradingContext == null ? void 0 : tradingContext.selectedOutcomeId) != null ? _c : null;
20369
20570
  const resolvedEventTradingState = (0, import_react36.useMemo)(() => {
20370
- return eventTradingState != null ? eventTradingState : (0, import_hooks60.resolveEventTradingState)(selectedEvent);
20571
+ return eventTradingState != null ? eventTradingState : (0, import_hooks61.resolveEventTradingState)(selectedEvent);
20371
20572
  }, [eventTradingState, selectedEvent]);
20372
20573
  const scopedSelectedEvent = (0, import_react36.useMemo)(() => {
20373
20574
  var _a2;
@@ -20395,7 +20596,7 @@ var PlaceOrder = ({
20395
20596
  )) != null ? _f : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venueMarketOutcomes[0]) != null ? _g : null;
20396
20597
  const scopedSelectedOutcomeId = (_h = scopedSelectedOutcome == null ? void 0 : scopedSelectedOutcome.id) != null ? _h : null;
20397
20598
  const resolvedTradingState = (0, import_react36.useMemo)(() => {
20398
- return (0, import_hooks60.resolveMarketTradingState)(scopedSelectedMarket);
20599
+ return (0, import_hooks61.resolveMarketTradingState)(scopedSelectedMarket);
20399
20600
  }, [scopedSelectedMarket]);
20400
20601
  const resolvedReadOnlyMarket = (0, import_react36.useMemo)(() => {
20401
20602
  var _a2;
@@ -20409,11 +20610,11 @@ var PlaceOrder = ({
20409
20610
  scopedSelectedMarket
20410
20611
  ]);
20411
20612
  const resolvedReadOnlyTradingState = (0, import_react36.useMemo)(() => {
20412
- return (0, import_hooks60.resolveMarketTradingState)(resolvedReadOnlyMarket);
20613
+ return (0, import_hooks61.resolveMarketTradingState)(resolvedReadOnlyMarket);
20413
20614
  }, [resolvedReadOnlyMarket]);
20414
20615
  const isEndedWithoutKnownWinner = false;
20415
20616
  const orderEligibility = (0, import_react36.useMemo)(
20416
- () => (0, import_hooks60.resolveOrderEligibility)({
20617
+ () => (0, import_hooks61.resolveOrderEligibility)({
20417
20618
  event: scopedSelectedEvent,
20418
20619
  market: scopedSelectedMarket,
20419
20620
  outcome: scopedSelectedOutcome,
@@ -20422,11 +20623,11 @@ var PlaceOrder = ({
20422
20623
  [scopedSelectedEvent, scopedSelectedMarket, scopedSelectedOutcome, resolvedEventTradingState]
20423
20624
  );
20424
20625
  const isResolvedOutcomeCtaLocked = resolvedEventTradingState.kind === "resolved" || resolvedTradingState.kind === "resolved";
20425
- const { isAuthenticated, user } = (0, import_hooks60.useAggAuthContext)();
20626
+ const { isAuthenticated, user } = (0, import_hooks61.useAggAuthContext)();
20426
20627
  const resolvedExecutionMode = executionMode != null ? executionMode : configuredExecutionMode;
20427
20628
  const isPaperMode = resolvedExecutionMode === "paper";
20428
- const liveBalanceState = (0, import_hooks60.useAggBalanceState)();
20429
- const paperBalancesQuery = (0, import_hooks60.useManagedBalances)({
20629
+ const liveBalanceState = (0, import_hooks61.useAggBalanceState)();
20630
+ const paperBalancesQuery = (0, import_hooks61.useManagedBalances)({
20430
20631
  enabled: Boolean(isAuthenticated && isPaperMode),
20431
20632
  mode: "paper"
20432
20633
  });
@@ -20446,22 +20647,22 @@ var PlaceOrder = ({
20446
20647
  const liveAvailableBalance = (_i = liveBalanceState.availableBalance) != null ? _i : liveBalanceState.totalBalance;
20447
20648
  const totalBalance = isPaperMode ? paperTotalBalance : liveAvailableBalance;
20448
20649
  const isBalanceLoading = isPaperMode ? paperBalancesQuery.isLoading : liveBalanceState.isLoading;
20449
- const executeManaged = (0, import_hooks60.useExecuteManaged)();
20450
- const placeLimitOrder = (0, import_hooks60.usePlaceLimitOrder)();
20451
- const aggClient = (0, import_hooks60.useAggClient)();
20452
- const queryClient = (0, import_hooks60.useQueryClient)();
20453
- const { disabledVenues, isLoading: isAppConfigLoading } = (0, import_hooks60.useAppConfig)();
20454
- const { data: kalshiKeyStatus, refetch: refetchKalshiKeyStatus } = (0, import_hooks60.useVenueKeyStatus)(
20650
+ const executeManaged = (0, import_hooks61.useExecuteManaged)();
20651
+ const placeLimitOrder = (0, import_hooks61.usePlaceLimitOrder)();
20652
+ const aggClient = (0, import_hooks61.useAggClient)();
20653
+ const queryClient = (0, import_hooks61.useQueryClient)();
20654
+ const { disabledVenues, isLoading: isAppConfigLoading } = (0, import_hooks61.useAppConfig)();
20655
+ const { data: kalshiKeyStatus, refetch: refetchKalshiKeyStatus } = (0, import_hooks61.useVenueKeyStatus)(
20455
20656
  import_sdk22.Venue.kalshi,
20456
20657
  isAuthenticated
20457
20658
  );
20458
20659
  const [isConnectKalshiModalOpen, setIsConnectKalshiModalOpen] = (0, import_react36.useState)(false);
20459
20660
  const [isFundKalshiModalOpen, setIsFundKalshiModalOpen] = (0, import_react36.useState)(false);
20460
- const livePrices = (0, import_hooks60.useLiveOutcomePrices)(
20661
+ const livePrices = (0, import_hooks61.useLiveOutcomePrices)(
20461
20662
  scopedSelectedMarket ? [scopedSelectedMarket] : void 0
20462
20663
  );
20463
- const wsBestPrices = (0, import_hooks60.useLiveBestPrices)(scopedSelectedMarket ? [scopedSelectedMarket] : void 0);
20464
- const fetchedClusterMidpointResult = (0, import_hooks60.useMidpoints)(
20664
+ const wsBestPrices = (0, import_hooks61.useLiveBestPrices)(scopedSelectedMarket ? [scopedSelectedMarket] : void 0);
20665
+ const fetchedClusterMidpointResult = (0, import_hooks61.useMidpoints)(
20465
20666
  midpointsResult ? [] : scopedSelectedMarket ? [scopedSelectedMarket] : []
20466
20667
  );
20467
20668
  const clusterMidpointResult = midpointsResult != null ? midpointsResult : fetchedClusterMidpointResult;
@@ -20469,12 +20670,12 @@ var PlaceOrder = ({
20469
20670
  const clusterBestMidpoint = clusterMidpointResult.bestMidpoint;
20470
20671
  const clusterBestPricesRest = clusterMidpointResult.bestPrices;
20471
20672
  const clusterBestPrices = (0, import_react36.useMemo)(
20472
- () => (0, import_hooks60.mergeBestPricesPreferringLive)(clusterBestPricesRest, wsBestPrices),
20673
+ () => (0, import_hooks61.mergeBestPricesPreferringLive)(clusterBestPricesRest, wsBestPrices),
20473
20674
  [clusterBestPricesRest, wsBestPrices]
20474
20675
  );
20475
20676
  const [internalTab, setInternalTab] = (0, import_react36.useState)("buy");
20476
20677
  const [executionType, setExecutionType] = (0, import_react36.useState)("market");
20477
- const [isExecutionTypeMenuOpen, setIsExecutionTypeMenuOpen] = (0, import_react36.useState)(false);
20678
+ const [selectedLimitVenue, setSelectedLimitVenue] = (0, import_react36.useState)(null);
20478
20679
  const [limitPrice, setLimitPrice] = (0, import_react36.useState)(0.5);
20479
20680
  const [limitPriceInputValue, setLimitPriceInputValue] = (0, import_react36.useState)(formatLimitPriceInputValue(0.5));
20480
20681
  const [limitPriceInputError, setLimitPriceInputError] = (0, import_react36.useState)(null);
@@ -20524,7 +20725,6 @@ var PlaceOrder = ({
20524
20725
  ]);
20525
20726
  const buyTabRef = (0, import_react36.useRef)(null);
20526
20727
  const sellTabRef = (0, import_react36.useRef)(null);
20527
- const executionTypeTriggerRef = (0, import_react36.useRef)(null);
20528
20728
  const expirationTriggerRef = (0, import_react36.useRef)(null);
20529
20729
  const limitPriceInitializedForOutcomeRef = (0, import_react36.useRef)(void 0);
20530
20730
  const expirationOptionRefs = (0, import_react36.useRef)([]);
@@ -20560,16 +20760,37 @@ var PlaceOrder = ({
20560
20760
  scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.id,
20561
20761
  scopedSelectedOutcomeId
20562
20762
  ]);
20563
- const debouncedAmount = (0, import_hooks60.useDebouncedValue)(internalAmount, 300);
20763
+ const debouncedAmount = (0, import_hooks61.useDebouncedValue)(internalAmount, 300);
20564
20764
  const isQuoteInputEditing = internalAmount !== debouncedAmount;
20565
20765
  const isLimitOrder = showLimitOrders && executionType === "limit";
20566
20766
  const isSell = (0, import_react36.useMemo)(() => internalTab === "sell", [internalTab]);
20767
+ const limitVenueOptions = (0, import_react36.useMemo)(
20768
+ () => {
20769
+ var _a2;
20770
+ return buildLimitOrderVenueOptions({
20771
+ currentPrices: (_a2 = clusterMidpointResult.currentMidpointsByOutcomeId) != null ? _a2 : clusterMidpointResult.prices,
20772
+ livePrices,
20773
+ market: scopedSelectedMarket,
20774
+ selectedOutcomeId: scopedSelectedOutcomeId
20775
+ });
20776
+ },
20777
+ [clusterMidpointResult, livePrices, scopedSelectedMarket, scopedSelectedOutcomeId]
20778
+ );
20779
+ const visibleLimitVenueOptions = (0, import_react36.useMemo)(() => {
20780
+ return limitVenueOptions.filter((option) => {
20781
+ return (0, import_hooks61.getVenueAvailabilityState)({
20782
+ venueId: option.venue,
20783
+ disabledVenues,
20784
+ isConfigLoading: isAppConfigLoading
20785
+ }) !== "hidden";
20786
+ });
20787
+ }, [disabledVenues, isAppConfigLoading, limitVenueOptions]);
20567
20788
  const {
20568
20789
  positions: executionPositions,
20569
20790
  dataUpdatedAt: executionPositionsUpdatedAt,
20570
20791
  isLoading: isExecutionPositionsLoading,
20571
20792
  isFetching: isExecutionPositionsFetching
20572
- } = (0, import_hooks60.useExecutionPositions)({
20793
+ } = (0, import_hooks61.useExecutionPositions)({
20573
20794
  enabled: Boolean(isAuthenticated && isSell),
20574
20795
  mode: isPaperMode ? "paper" : void 0
20575
20796
  });
@@ -20584,9 +20805,70 @@ var PlaceOrder = ({
20584
20805
  isEditing: isQuoteInputEditing,
20585
20806
  isMarketOpen: resolvedTradingState.kind === "open" && !isEndedWithoutKnownWinner,
20586
20807
  isPanelActive: isQuotePanelActive,
20587
- isSubmitting: submissionProgressState != null || isBeforeActionPending || executeManaged.isPending
20808
+ isSubmitting: submissionProgressState != null || isBeforeActionPending || executeManaged.isPending || placeLimitOrder.isPending
20588
20809
  };
20589
- const smartRoute = (0, import_hooks60.useSmartRoute)(__spreadProps(__spreadValues({
20810
+ const limitVenueQuoteRequests = (0, import_react36.useMemo)(
20811
+ () => visibleLimitVenueOptions.map((option) => ({
20812
+ venue: option.venue,
20813
+ venueMarketOutcomeId: option.venueMarketOutcomeId
20814
+ })),
20815
+ [visibleLimitVenueOptions]
20816
+ );
20817
+ const hasValidLimitVenueQuoteAmount = debouncedAmount > 0;
20818
+ const isLimitVenueQuoteEnabled = isLimitOrder && isQuotePanelActive && !isEndedWithoutKnownWinner && !submissionProgressState && !isBeforeActionPending && !placeLimitOrder.isPending && hasValidLimitVenueQuoteAmount && orderEligibility.canPlaceOrder && (!isSell || sellFilledForOutcomeId === scopedSelectedOutcomeId && !isQuoteInputEditing);
20819
+ const limitVenueQuotes = (0, import_hooks61.useLimitOrderVenueQuotes)({
20820
+ requests: limitVenueQuoteRequests,
20821
+ tradeSide: internalTab,
20822
+ amount: debouncedAmount,
20823
+ marketId: scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.id,
20824
+ accountId: (_k = user == null ? void 0 : user.id) != null ? _k : null,
20825
+ chainBalances: chainBalancesOverride,
20826
+ mode: isPaperMode ? "paper" : void 0,
20827
+ slipCapBps: 1e6,
20828
+ enabled: isLimitVenueQuoteEnabled,
20829
+ refreshContext: smartRouteRefreshContext
20830
+ });
20831
+ const limitVenueQuoteByVenue = (0, import_react36.useMemo)(
20832
+ () => new Map(limitVenueQuotes.quotes.map((quote) => [quote.request.venue, quote])),
20833
+ [limitVenueQuotes.quotes]
20834
+ );
20835
+ const geoBlockedLimitVenues = (0, import_react36.useMemo)(() => {
20836
+ var _a2;
20837
+ const venues = /* @__PURE__ */ new Set();
20838
+ for (const quote of limitVenueQuotes.quotes) {
20839
+ if (extractGeoBlockedVenues((_a2 = quote.data) == null ? void 0 : _a2.warnings).has(quote.request.venue)) {
20840
+ venues.add(quote.request.venue);
20841
+ }
20842
+ }
20843
+ return venues;
20844
+ }, [limitVenueQuotes.quotes]);
20845
+ const availableLimitVenueOptions = (0, import_react36.useMemo)(() => {
20846
+ return visibleLimitVenueOptions.filter((option) => {
20847
+ return !geoBlockedLimitVenues.has(option.venue) && (0, import_hooks61.getVenueAvailabilityState)({
20848
+ venueId: option.venue,
20849
+ disabledVenues,
20850
+ isConfigLoading: isAppConfigLoading
20851
+ }) === "available";
20852
+ });
20853
+ }, [disabledVenues, geoBlockedLimitVenues, isAppConfigLoading, visibleLimitVenueOptions]);
20854
+ const automaticLimitVenueOption = (0, import_react36.useMemo)(
20855
+ () => resolveAutomaticLimitOrderVenueOption(availableLimitVenueOptions, internalTab),
20856
+ [availableLimitVenueOptions, internalTab]
20857
+ );
20858
+ const selectedLimitVenueOption = (0, import_react36.useMemo)(() => {
20859
+ if (selectedLimitVenue) {
20860
+ const selectedOption = availableLimitVenueOptions.find(
20861
+ (option) => option.venue === selectedLimitVenue
20862
+ );
20863
+ if (selectedOption) return selectedOption;
20864
+ }
20865
+ return automaticLimitVenueOption;
20866
+ }, [automaticLimitVenueOption, availableLimitVenueOptions, selectedLimitVenue]);
20867
+ (0, import_react36.useEffect)(() => {
20868
+ if (!selectedLimitVenue || !geoBlockedLimitVenues.has(selectedLimitVenue)) return;
20869
+ setSelectedLimitVenue(null);
20870
+ }, [geoBlockedLimitVenues, selectedLimitVenue]);
20871
+ const smartRoute = (0, import_hooks61.useSmartRoute)(__spreadProps(__spreadValues({
20590
20872
  venueMarketOutcomeId: scopedSelectedOutcomeId,
20591
20873
  maxSpend: isSell ? void 0 : debouncedAmount,
20592
20874
  sellShares: isSell ? debouncedAmount : void 0,
@@ -20601,7 +20883,7 @@ var PlaceOrder = ({
20601
20883
  enabled: isSmartRouteEnabled
20602
20884
  }, isSell ? {
20603
20885
  sellCacheScope: {
20604
- accountId: (_k = user == null ? void 0 : user.id) != null ? _k : null,
20886
+ accountId: (_l = user == null ? void 0 : user.id) != null ? _l : null,
20605
20887
  positionVersion: executionPositionsUpdatedAt
20606
20888
  }
20607
20889
  } : {}), {
@@ -20655,14 +20937,14 @@ var PlaceOrder = ({
20655
20937
  },
20656
20938
  [debouncedAmount, isSell, scopedSelectedOutcomeId, smartRoute.data, smartRoute.isLoading]
20657
20939
  );
20658
- const venueSellQuotes = (0, import_hooks60.useVenueSellQuotes)({
20940
+ const venueSellQuotes = (0, import_hooks61.useVenueSellQuotes)({
20659
20941
  venueMarketOutcomeId: scopedSelectedOutcomeId,
20660
- accountId: (_l = user == null ? void 0 : user.id) != null ? _l : null,
20942
+ accountId: (_m = user == null ? void 0 : user.id) != null ? _m : null,
20661
20943
  positionVersion: executionPositionsUpdatedAt,
20662
20944
  requests: venueSellQuoteRequests,
20663
20945
  mode: isPaperMode ? "paper" : void 0,
20664
20946
  slipCapBps: 1e6,
20665
- enabled: isSell && isSmartRouteEnabled && !smartRoute.isLoading && ((_m = smartRoute.data) == null ? void 0 : _m.venueMarketOutcomeId) === scopedSelectedOutcomeId,
20947
+ enabled: isSell && isSmartRouteEnabled && !smartRoute.isLoading && ((_n = smartRoute.data) == null ? void 0 : _n.venueMarketOutcomeId) === scopedSelectedOutcomeId,
20666
20948
  refreshContext: smartRouteRefreshContext
20667
20949
  });
20668
20950
  const currentSellableShares = (0, import_react36.useMemo)(() => {
@@ -20697,13 +20979,13 @@ var PlaceOrder = ({
20697
20979
  isSell,
20698
20980
  scopedSelectedMarket,
20699
20981
  scopedSelectedOutcome,
20700
- (_o = (_n = smartRoute.data) == null ? void 0 : _n.positionAvailability) == null ? void 0 : _o.totalSellableShares
20982
+ (_p = (_o = smartRoute.data) == null ? void 0 : _o.positionAvailability) == null ? void 0 : _p.totalSellableShares
20701
20983
  ]);
20702
20984
  const maxSellableShares = (0, import_react36.useMemo)(
20703
20985
  () => floorToDecimals(currentSellableShares, SELL_SHARE_INPUT_DECIMALS),
20704
20986
  [currentSellableShares]
20705
20987
  );
20706
- const isCurrentSellableSharesLoading = isSell && isAuthenticated && !(typeof ((_q = (_p = smartRoute.data) == null ? void 0 : _p.positionAvailability) == null ? void 0 : _q.totalSellableShares) === "number") && (isExecutionPositionsLoading || isExecutionPositionsFetching);
20988
+ const isCurrentSellableSharesLoading = isSell && isAuthenticated && !(typeof ((_r = (_q = smartRoute.data) == null ? void 0 : _q.positionAvailability) == null ? void 0 : _r.totalSellableShares) === "number") && (isExecutionPositionsLoading || isExecutionPositionsFetching);
20707
20989
  const displayedCurrentSellableShares = (0, import_react36.useMemo)(() => {
20708
20990
  if (!Number.isFinite(currentSellableShares) || currentSellableShares <= 0) return 0;
20709
20991
  return floorToDecimals(currentSellableShares, SELL_SHARE_DISPLAY_DECIMALS);
@@ -20713,7 +20995,7 @@ var PlaceOrder = ({
20713
20995
  [maxSellableShares]
20714
20996
  );
20715
20997
  const isAtMaxSellableShares = isSell && maxSellableShares > 0 && Math.abs(internalAmount - maxSellableShares) < 1e-9;
20716
- 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;
20998
+ 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;
20717
20999
  (0, import_react36.useEffect)(() => {
20718
21000
  if (submissionProgressState != null) return;
20719
21001
  if (!isSell || isCurrentSellableSharesLoading) return;
@@ -20749,8 +21031,8 @@ var PlaceOrder = ({
20749
21031
  isSell,
20750
21032
  onAmountChange,
20751
21033
  scopedSelectedOutcomeId,
20752
- (_u = (_t = smartRoute.data) == null ? void 0 : _t.positionAvailability) == null ? void 0 : _u.totalSellableShares,
20753
- (_v = smartRoute.data) == null ? void 0 : _v.venueMarketOutcomeId,
21034
+ (_v = (_u = smartRoute.data) == null ? void 0 : _u.positionAvailability) == null ? void 0 : _v.totalSellableShares,
21035
+ (_w = smartRoute.data) == null ? void 0 : _w.venueMarketOutcomeId,
20754
21036
  submissionProgressState
20755
21037
  ]);
20756
21038
  const routeCards = (0, import_react36.useMemo)(() => {
@@ -20788,7 +21070,7 @@ var PlaceOrder = ({
20788
21070
  return selectedRouteCardId;
20789
21071
  }
20790
21072
  return resolveDefaultRouteCardId(routeCards, isSell ? void 0 : (_a2 = smartRoute.data) == null ? void 0 : _a2.status);
20791
- }, [routeCards, selectedRouteCardId, isSell, (_w = smartRoute.data) == null ? void 0 : _w.status]);
21073
+ }, [routeCards, selectedRouteCardId, isSell, (_x = smartRoute.data) == null ? void 0 : _x.status]);
20792
21074
  (0, import_react36.useEffect)(() => {
20793
21075
  if (routeCards.length === 0) {
20794
21076
  setSelectedRouteCardId(null);
@@ -20811,7 +21093,6 @@ var PlaceOrder = ({
20811
21093
  (0, import_react36.useEffect)(() => {
20812
21094
  if (showLimitOrders || executionType !== "limit") return;
20813
21095
  setExecutionType("market");
20814
- setIsExecutionTypeMenuOpen(false);
20815
21096
  setIsLimitExpirationPickerOpen(false);
20816
21097
  }, [executionType, showLimitOrders]);
20817
21098
  (0, import_react36.useEffect)(() => {
@@ -20827,15 +21108,19 @@ var PlaceOrder = ({
20827
21108
  setLimitPriceInputValue(formatLimitPriceInputValue(nextLimitPrice));
20828
21109
  setLimitPriceInputError(null);
20829
21110
  }, [executionType, scopedSelectedOutcomeId, selectedOutcomeDisplayPrice]);
21111
+ (0, import_react36.useEffect)(() => {
21112
+ setSelectedLimitVenue(null);
21113
+ }, [scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.id, scopedSelectedOutcomeId]);
20830
21114
  const orderedRouteCards = routeCards;
20831
- const selectedRouteCard = (_y = (_x = orderedRouteCards.find((card) => card.id === resolvedSelectedRouteCardId)) != null ? _x : orderedRouteCards[0]) != null ? _y : null;
21115
+ const selectedRouteCard = (_z = (_y = orderedRouteCards.find((card) => card.id === resolvedSelectedRouteCardId)) != null ? _y : orderedRouteCards[0]) != null ? _z : null;
20832
21116
  const isKalshiRoute = (0, import_react36.useMemo)(() => {
21117
+ if (isLimitOrder) return (selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue) === import_sdk22.Venue.kalshi;
20833
21118
  if (selectedRouteCard) {
20834
21119
  return selectedRouteCard.venue === "kalshi" || selectedRouteCard.quoteData.fills.some((f) => f.venue === "kalshi");
20835
21120
  }
20836
21121
  return (scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venue) === "kalshi";
20837
- }, [selectedRouteCard, scopedSelectedMarket]);
20838
- const displayedBalance = isPaperMode ? paperTotalBalance : isKalshiRoute ? (_z = liveBalanceState.kalshiBalance) != null ? _z : 0 : liveAvailableBalance;
21122
+ }, [isLimitOrder, selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue, selectedRouteCard, scopedSelectedMarket]);
21123
+ const displayedBalance = isPaperMode ? paperTotalBalance : isKalshiRoute ? (_A = liveBalanceState.kalshiBalance) != null ? _A : 0 : liveAvailableBalance;
20839
21124
  const legacyKalshiAccount = (0, import_react36.useMemo)(
20840
21125
  () => {
20841
21126
  var _a2;
@@ -20843,10 +21128,10 @@ var PlaceOrder = ({
20843
21128
  },
20844
21129
  [user == null ? void 0 : user.venueAccounts]
20845
21130
  );
20846
- const isKalshiAccountActive = (_A = kalshiKeyStatus == null ? void 0 : kalshiKeyStatus.connected) != null ? _A : (legacyKalshiAccount == null ? void 0 : legacyKalshiAccount.status) === "active";
20847
- const isKalshiVerified = ((_B = kalshiKeyStatus == null ? void 0 : kalshiKeyStatus.kycStatus) != null ? _B : legacyKalshiAccount == null ? void 0 : legacyKalshiAccount.kycStatus) === "verified";
21131
+ const isKalshiAccountActive = (_B = kalshiKeyStatus == null ? void 0 : kalshiKeyStatus.connected) != null ? _B : (legacyKalshiAccount == null ? void 0 : legacyKalshiAccount.status) === "active";
21132
+ const isKalshiVerified = ((_C = kalshiKeyStatus == null ? void 0 : kalshiKeyStatus.kycStatus) != null ? _C : legacyKalshiAccount == null ? void 0 : legacyKalshiAccount.kycStatus) === "verified";
20848
21133
  const hasKalshiConnectionState = kalshiKeyStatus !== void 0 || (user == null ? void 0 : user.venueAccounts) != null;
20849
- const isKalshiAvailable = (0, import_hooks60.getVenueAvailabilityState)({
21134
+ const isKalshiAvailable = (0, import_hooks61.getVenueAvailabilityState)({
20850
21135
  venueId: "kalshi",
20851
21136
  disabledVenues,
20852
21137
  isConfigLoading: isAppConfigLoading
@@ -20871,7 +21156,7 @@ var PlaceOrder = ({
20871
21156
  [aggClient, onConnectKalshi, refetchKalshiKeyStatus]
20872
21157
  );
20873
21158
  const needsKycVerification = isAuthenticated && hasKalshiConnectionState && isKalshiRoute && isKalshiAccountActive && !isKalshiVerified;
20874
- 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;
21159
+ 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;
20875
21160
  const handleRouteCardSelect = (0, import_react36.useCallback)(
20876
21161
  (cardId) => {
20877
21162
  if (cardId === resolvedSelectedRouteCardId) {
@@ -20885,16 +21170,16 @@ var PlaceOrder = ({
20885
21170
  },
20886
21171
  [resolvedSelectedRouteCardId, routeCards]
20887
21172
  );
20888
- const executionProgress = (0, import_hooks60.useExecutionProgress)({
20889
- orderIds: (_G = submissionProgressState == null ? void 0 : submissionProgressState.orderIds) != null ? _G : null,
20890
- quoteId: (_H = submissionProgressState == null ? void 0 : submissionProgressState.quoteId) != null ? _H : null,
21173
+ const executionProgress = (0, import_hooks61.useExecutionProgress)({
21174
+ orderIds: (_H = submissionProgressState == null ? void 0 : submissionProgressState.orderIds) != null ? _H : null,
21175
+ quoteId: (_I = submissionProgressState == null ? void 0 : submissionProgressState.quoteId) != null ? _I : null,
20891
21176
  mode: isPaperMode ? "paper" : void 0,
20892
- 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)
21177
+ 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)
20893
21178
  });
20894
- 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 : "";
20895
- const headerImage = (_N = (_M = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.image) != null ? _M : scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.image) != null ? _N : null;
20896
- const headerTitle = (_P = (_O = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.title) != null ? _O : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question) != null ? _P : "";
20897
- const headerSubtitle = (_Q = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question) != null ? _Q : "";
21179
+ 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 : "";
21180
+ const headerImage = (_O = (_N = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.image) != null ? _N : scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.image) != null ? _O : null;
21181
+ const headerTitle = (_Q = (_P = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.title) != null ? _P : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question) != null ? _Q : "";
21182
+ const headerSubtitle = (_R = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question) != null ? _R : "";
20898
21183
  const buildExecutionSummary = (0, import_react36.useCallback)(
20899
21184
  (quoteData, executionVenue, orderId, partialFillSummary) => {
20900
21185
  var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
@@ -21160,8 +21445,8 @@ var PlaceOrder = ({
21160
21445
  }
21161
21446
  if (submissionProgressState.phase === "success" && submissionProgressState.summary) {
21162
21447
  emitTerminalOrderNotifications();
21163
- (0, import_hooks60.invalidateBalanceQueries)(queryClient);
21164
- (0, import_hooks60.invalidatePositionQueries)(queryClient);
21448
+ (0, import_hooks61.invalidateBalanceQueries)(queryClient);
21449
+ (0, import_hooks61.invalidatePositionQueries)(queryClient);
21165
21450
  if (debugStore && debugAttemptId) {
21166
21451
  debugStore.updateAttempt(debugAttemptId, {
21167
21452
  status: "succeeded",
@@ -21192,19 +21477,19 @@ var PlaceOrder = ({
21192
21477
  queryClient,
21193
21478
  submissionProgressState
21194
21479
  ]);
21195
- const activeQuoteData = (_S = (_R = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData) != null ? _R : smartRoute.data) != null ? _S : null;
21196
- const visibleRouteCards = orderedRouteCards.length > PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT && !isRoutesExpanded ? orderedRouteCards.slice(0, PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT) : orderedRouteCards;
21480
+ const activeQuoteData = isLimitOrder ? null : (_T = (_S = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData) != null ? _S : smartRoute.data) != null ? _T : null;
21481
+ const visibleMarketRouteCards = orderedRouteCards.length > PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT && !isRoutesExpanded ? orderedRouteCards.slice(0, PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT) : orderedRouteCards;
21197
21482
  const hasEnteredAmount = internalAmount > 0;
21198
21483
  const isQuoteLoading = !isLimitOrder && hasEnteredAmount && (smartRoute.isFetching || smartRoute.isLoading || isSell && (venueSellQuotes.isFetching || venueSellQuotes.isLoading));
21199
21484
  const routeLoadingMessage = isQuoteLoading ? smartRoute.loadingReason === "updating-route" ? tradingLabels.updatingRoute : smartRoute.loadingReason === "refreshing-quotes" ? tradingLabels.refreshingQuotes : tradingLabels.findingBestOdds : null;
21200
- const selectedRouteFills = (_T = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData.fills) != null ? _T : [];
21485
+ const selectedRouteFills = (_U = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData.fills) != null ? _U : [];
21201
21486
  const isKalshiOnlyRoute = isKalshiRoute && ((selectedRouteCard == null ? void 0 : selectedRouteCard.venue) === import_sdk22.Venue.kalshi || selectedRouteFills.length > 0 && selectedRouteFills.every((fill) => fill.venue === import_sdk22.Venue.kalshi));
21202
21487
  const isOnchainOnlyRoute = !isKalshiRoute || selectedRouteFills.length > 0 && selectedRouteFills.every((fill) => fill.venue !== import_sdk22.Venue.kalshi);
21203
21488
  const kalshiRequiredAmount = isSell ? 0 : selectedRouteFills.filter((fill) => fill.venue === import_sdk22.Venue.kalshi).reduce((total, fill) => total + fill.venueQty * fill.avgPrice, 0);
21204
21489
  const onchainRequiredAmount = isSell ? 0 : selectedRouteFills.filter((fill) => fill.venue !== import_sdk22.Venue.kalshi).reduce((total, fill) => total + fill.venueQty * fill.avgPrice, 0);
21205
21490
  const resolvedKalshiRequiredAmount = isKalshiOnlyRoute || isKalshiRoute && selectedRouteFills.length === 0 ? internalAmount : kalshiRequiredAmount;
21206
21491
  const resolvedOnchainRequiredAmount = isOnchainOnlyRoute || !isKalshiRoute && selectedRouteFills.length === 0 ? internalAmount : onchainRequiredAmount;
21207
- const isKalshiBalanceInsufficient = !isPaperMode && isKalshiRoute && resolvedKalshiRequiredAmount > ((_U = liveBalanceState.kalshiBalance) != null ? _U : 0);
21492
+ const isKalshiBalanceInsufficient = !isPaperMode && isKalshiRoute && resolvedKalshiRequiredAmount > ((_V = liveBalanceState.kalshiBalance) != null ? _V : 0);
21208
21493
  const isOnchainBalanceInsufficient = resolvedOnchainRequiredAmount > liveAvailableBalance;
21209
21494
  const isInsufficientBalance = !isSell && isAuthenticated && hasEnteredAmount && !isBalanceLoading && (isLimitOrder ? internalAmount > totalBalance : isPaperMode ? internalAmount > paperTotalBalance : isKalshiBalanceInsufficient || isOnchainBalanceInsufficient);
21210
21495
  const isQuoteInsufficientBalance = !isLimitOrder && (activeQuoteData == null ? void 0 : activeQuoteData.status) === "insufficient_balance";
@@ -21298,9 +21583,9 @@ var PlaceOrder = ({
21298
21583
  }
21299
21584
  return (_d2 = selectedRouteCard.hint) != null ? _d2 : "";
21300
21585
  }, [selectedRouteCard, tradingLabels]);
21301
- const displayedToWinValue = (_V = selectedRouteCard == null ? void 0 : selectedRouteCard.numericValue) != null ? _V : 0;
21586
+ const displayedToWinValue = (_W = selectedRouteCard == null ? void 0 : selectedRouteCard.numericValue) != null ? _W : 0;
21302
21587
  const limitOrderPayload = (0, import_react36.useMemo)(() => {
21303
- if (!scopedSelectedMarket || !scopedSelectedOutcomeId || internalAmount <= 0) return null;
21588
+ if (!selectedLimitVenueOption || internalAmount <= 0) return null;
21304
21589
  if (limitPriceInputError) return null;
21305
21590
  const expirationDate = resolveLimitExpirationDate({
21306
21591
  expirationType: limitExpirationType,
@@ -21316,8 +21601,8 @@ var PlaceOrder = ({
21316
21601
  });
21317
21602
  const expiresAt = expirationDate ? serializeLimitOrderExpiration(expirationDate) : void 0;
21318
21603
  return __spreadValues({
21319
- venue: scopedSelectedMarket.venue,
21320
- venueMarketOutcomeId: scopedSelectedOutcomeId,
21604
+ venue: selectedLimitVenueOption.venue,
21605
+ venueMarketOutcomeId: selectedLimitVenueOption.venueMarketOutcomeId,
21321
21606
  side: internalTab,
21322
21607
  limitPriceRaw,
21323
21608
  sizeRaw,
@@ -21331,8 +21616,7 @@ var PlaceOrder = ({
21331
21616
  limitExpirationType,
21332
21617
  limitPrice,
21333
21618
  limitPriceInputError,
21334
- scopedSelectedMarket,
21335
- scopedSelectedOutcomeId
21619
+ selectedLimitVenueOption
21336
21620
  ]);
21337
21621
  const resolvedLimitExpirationDraftDate = (0, import_react36.useMemo)(() => {
21338
21622
  return resolveLimitExpirationDate({
@@ -21375,11 +21659,70 @@ var PlaceOrder = ({
21375
21659
  )
21376
21660
  ) / Number(LIMIT_ORDER_RAW_SCALE);
21377
21661
  }, [internalTab, limitOrderPayload]);
21662
+ const limitRouteCards = (0, import_react36.useMemo)(() => {
21663
+ return visibleLimitVenueOptions.map((option) => {
21664
+ var _a2, _b2;
21665
+ const availabilityState = (0, import_hooks61.getVenueAvailabilityState)({
21666
+ venueId: option.venue,
21667
+ disabledVenues,
21668
+ isConfigLoading: isAppConfigLoading
21669
+ });
21670
+ const isGeoBlocked = geoBlockedLimitVenues.has(option.venue);
21671
+ const isUnavailable = isTradingBlocked || isGeoBlocked || availabilityState !== "available";
21672
+ const currentPriceLabel = option.currentPrice == null ? "\u2014" : formatProbabilityCents(option.currentPrice, formatPrice);
21673
+ const totalFees = getSmartRouteTotalFees(
21674
+ (_b2 = (_a2 = limitVenueQuoteByVenue.get(option.venue)) == null ? void 0 : _a2.data) == null ? void 0 : _b2.feeBreakdown
21675
+ );
21676
+ const feeLabel = totalFees == null ? void 0 : formatUsd(totalFees, { minimumFractionDigits: 2, maximumFractionDigits: 2 });
21677
+ return {
21678
+ id: `limit-venue-${option.venue}-${option.venueMarketOutcomeId}`,
21679
+ hint: isGeoBlocked ? tradingLabels.venueUnavailableInRegion : tradingLabels.limitRoutingCurrentPrice(currentPriceLabel, feeLabel),
21680
+ isUnavailable,
21681
+ kind: "venue",
21682
+ label: getTradingVenueLabel(option.venue),
21683
+ numericValue: displayedLimitToWinValue,
21684
+ value: formatUsd(displayedLimitToWinValue, {
21685
+ maximumFractionDigits: 2,
21686
+ minimumFractionDigits: 2
21687
+ }),
21688
+ venue: option.venue
21689
+ };
21690
+ });
21691
+ }, [
21692
+ disabledVenues,
21693
+ displayedLimitToWinValue,
21694
+ formatPrice,
21695
+ geoBlockedLimitVenues,
21696
+ isAppConfigLoading,
21697
+ isTradingBlocked,
21698
+ limitVenueQuoteByVenue,
21699
+ tradingLabels,
21700
+ visibleLimitVenueOptions
21701
+ ]);
21702
+ const limitVenueOptionByCardId = (0, import_react36.useMemo)(() => {
21703
+ return new Map(
21704
+ visibleLimitVenueOptions.map((option) => [
21705
+ `limit-venue-${option.venue}-${option.venueMarketOutcomeId}`,
21706
+ option
21707
+ ])
21708
+ );
21709
+ }, [visibleLimitVenueOptions]);
21710
+ const activeRouteCards = isLimitOrder ? limitRouteCards : visibleMarketRouteCards;
21711
+ const activeRouteCardCount = isLimitOrder ? limitRouteCards.length : orderedRouteCards.length;
21712
+ const handleActiveRouteCardSelect = (cardId) => {
21713
+ if (!isLimitOrder) {
21714
+ handleRouteCardSelect(cardId);
21715
+ return;
21716
+ }
21717
+ const option = limitVenueOptionByCardId.get(cardId);
21718
+ if (!option) return;
21719
+ setSelectedLimitVenue(option.venue);
21720
+ };
21378
21721
  const displayedLimitToWinHint = formatLimitPriceLabel(limitPrice);
21379
21722
  const activeFeeBreakdown = activeQuoteData == null ? void 0 : activeQuoteData.feeBreakdown;
21380
21723
  const estimatedFeesValue = (0, import_react36.useMemo)(() => {
21381
- if (!activeFeeBreakdown) return null;
21382
- const totalFees = activeFeeBreakdown.venueFees + activeFeeBreakdown.bridgeFees + activeFeeBreakdown.executionGas;
21724
+ const totalFees = getSmartRouteTotalFees(activeFeeBreakdown);
21725
+ if (totalFees == null) return null;
21383
21726
  return formatUsd(totalFees, { minimumFractionDigits: 2, maximumFractionDigits: 2 });
21384
21727
  }, [activeFeeBreakdown]);
21385
21728
  const feeBreakdownRows = (0, import_react36.useMemo)(() => {
@@ -21417,13 +21760,15 @@ var PlaceOrder = ({
21417
21760
  ];
21418
21761
  }, [activeFeeBreakdown, tradingLabels]);
21419
21762
  const isActionLoading = isPrimaryActionLoading || executeManaged.isPending || placeLimitOrder.isPending || isBeforeActionPending;
21420
- const selectedRouteGeoBlocked = (_W = selectedRouteCard == null ? void 0 : selectedRouteCard.isUnavailable) != null ? _W : false;
21763
+ const selectedLimitRouteCardId = selectedLimitVenueOption ? `limit-venue-${selectedLimitVenueOption.venue}-${selectedLimitVenueOption.venueMarketOutcomeId}` : null;
21764
+ const selectedLimitRouteCard = selectedLimitRouteCardId ? (_X = limitRouteCards.find((card) => card.id === selectedLimitRouteCardId)) != null ? _X : null : null;
21765
+ const selectedRouteGeoBlocked = isLimitOrder ? (_Y = selectedLimitRouteCard == null ? void 0 : selectedLimitRouteCard.isUnavailable) != null ? _Y : false : (_Z = selectedRouteCard == null ? void 0 : selectedRouteCard.isUnavailable) != null ? _Z : false;
21421
21766
  const geoBlockedVenuesFromWarnings = (0, import_react36.useMemo)(
21422
21767
  () => {
21423
21768
  var _a2;
21424
21769
  return extractGeoBlockedVenues((_a2 = smartRoute.data) == null ? void 0 : _a2.warnings);
21425
21770
  },
21426
- [(_X = smartRoute.data) == null ? void 0 : _X.warnings]
21771
+ [(__ = smartRoute.data) == null ? void 0 : __.warnings]
21427
21772
  );
21428
21773
  const isPrimaryVenueGeoBlocked = (0, import_react36.useMemo)(() => {
21429
21774
  var _a2, _b2;
@@ -21431,12 +21776,12 @@ var PlaceOrder = ({
21431
21776
  const fills = (_b2 = (_a2 = selectedRouteCard.quoteData) == null ? void 0 : _a2.fills) != null ? _b2 : [];
21432
21777
  return fills.length > 0 && fills.every((f) => geoBlockedVenuesFromWarnings.has(f.venue));
21433
21778
  }, [selectedRouteCard, geoBlockedVenuesFromWarnings]);
21434
- const shouldShowGeoBlockBanner = isTradingBlocked || selectedRouteGeoBlocked || isPrimaryVenueGeoBlocked;
21779
+ const shouldShowGeoBlockBanner = isTradingBlocked || selectedRouteGeoBlocked || isPrimaryVenueGeoBlocked || isLimitOrder && limitRouteCards.length > 0 && limitRouteCards.every((card) => card.isUnavailable);
21435
21780
  const shouldShowLowLiquidityWarning = !isQuoteInputEditing && !isQuoteLoading && (activeQuoteData == null ? void 0 : activeQuoteData.venueMarketOutcomeId) === scopedSelectedOutcomeId && hasLowLiquidityWarning(activeQuoteData.warnings);
21436
21781
  const actionLabel = `${internalTab === "buy" ? tradingLabels.buy : tradingLabels.sell} ${selectedOutcomeLabel}`.trim();
21437
21782
  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;
21438
- const shouldShowSmartRouting = !isLimitOrder && orderEligibility.canPlaceOrder && hasEnteredAmount && !isBelowMinimum && (orderedRouteCards.length > 0 || smartRoute.isFetching || smartRoute.isLoading || isSell && (venueSellQuotes.isFetching || venueSellQuotes.isLoading));
21439
- const shouldShowRouteToggle = !isQuoteLoading && orderedRouteCards.length > PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT;
21783
+ const shouldShowSmartRouting = orderEligibility.canPlaceOrder && hasEnteredAmount && !isBelowMinimum && (isLimitOrder ? limitRouteCards.length > 0 : orderedRouteCards.length > 0 || smartRoute.isFetching || smartRoute.isLoading || isSell && (venueSellQuotes.isFetching || venueSellQuotes.isLoading));
21784
+ const shouldShowRouteToggle = !isLimitOrder && !isQuoteLoading && orderedRouteCards.length > PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT;
21440
21785
  const handleReturnToOrderForm = (0, import_react36.useCallback)(() => {
21441
21786
  const submittedSelection = submittedSelectionRef.current;
21442
21787
  submittedSelectionRef.current = null;
@@ -22081,7 +22426,7 @@ var PlaceOrder = ({
22081
22426
  PlaceOrderResolvedView,
22082
22427
  {
22083
22428
  tradingState: resolvedReadOnlyTradingState,
22084
- resolutionTimestamp: (_Y = resolvedEventTradingState.resolvesAt) != null ? _Y : resolvedReadOnlyTradingState.resolvesAt,
22429
+ resolutionTimestamp: (_$ = resolvedEventTradingState.resolvesAt) != null ? _$ : resolvedReadOnlyTradingState.resolvesAt,
22085
22430
  resolvedClaim,
22086
22431
  classNames,
22087
22432
  className,
@@ -22164,261 +22509,228 @@ var PlaceOrder = ({
22164
22509
  tabItem.value
22165
22510
  );
22166
22511
  }) }),
22167
- showLimitOrders ? /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(
22168
- DropdownMenu.Root,
22512
+ showLimitOrders ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
22513
+ Select,
22169
22514
  {
22170
- open: isExecutionTypeMenuOpen,
22171
- onOpenChange: setIsExecutionTypeMenuOpen,
22172
- children: [
22173
- /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(
22174
- "button",
22175
- {
22176
- ref: executionTypeTriggerRef,
22177
- type: "button",
22178
- className: cn(
22179
- "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",
22180
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-0 focus-visible:ring-offset-agg-secondary"
22181
- ),
22182
- "aria-label": tradingLabels.orderTypeAria,
22183
- children: [
22184
- /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("span", { children: isLimitOrder ? tradingLabels.orderTypeLimit : tradingLabels.orderTypeMarket }),
22185
- /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(Icon, { name: "chevron-down", size: "small", className: "h-4 w-4", "aria-hidden": true })
22186
- ]
22187
- }
22188
- ) }),
22189
- /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
22190
- DropdownMenu.Portal,
22191
- {
22192
- container: resolvePlaceOrderPortalContainer(executionTypeTriggerRef.current),
22193
- children: /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
22194
- DropdownMenu.Content,
22195
- {
22196
- align: "end",
22197
- sideOffset: 8,
22198
- 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)]",
22199
- children: [
22200
- { value: "market", label: tradingLabels.orderTypeMarket },
22201
- { value: "limit", label: tradingLabels.orderTypeLimit }
22202
- ].map((item) => /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
22203
- DropdownMenu.Item,
22204
- {
22205
- className: cn(
22206
- "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",
22207
- executionType === item.value && "font-agg-bold text-agg-primary"
22208
- ),
22209
- onSelect: () => handleExecutionTypeChange(item.value),
22210
- children: item.label
22211
- },
22212
- item.value
22213
- ))
22214
- }
22215
- )
22216
- }
22217
- )
22218
- ]
22515
+ ariaLabel: tradingLabels.orderTypeAria,
22516
+ className: "mb-2",
22517
+ triggerClassName: "agg-order-type-trigger",
22518
+ items: [
22519
+ { value: "market", label: tradingLabels.orderTypeMarket },
22520
+ { value: "limit", label: tradingLabels.orderTypeLimit }
22521
+ ],
22522
+ value: executionType,
22523
+ onChange: handleExecutionTypeChange,
22524
+ variant: "inline",
22525
+ openOnHover: true,
22526
+ contentAlign: "end",
22527
+ contentSideOffset: 4
22219
22528
  }
22220
22529
  ) : null
22221
22530
  ]
22222
22531
  }
22223
22532
  ),
22224
- outcomes.length >= 2 ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("div", { className: "agg-outcomes flex w-full max-w-full gap-2", children: outcomes.map((outcome, index) => {
22225
- var _a2, _b2, _c2;
22226
- const price = getDisplayOutcomePrice({
22227
- outcomeId: outcome.id,
22228
- outcomeLabel: outcome.label,
22229
- selection: (_a2 = tradingContext == null ? void 0 : tradingContext.tradeSide) != null ? _a2 : isSell ? "sell" : "buy",
22230
- bestPrices: clusterBestPrices,
22231
- bestMidpoint: clusterBestMidpoint,
22232
- bestMidpointsByOutcomeId: clusterBestMidpointsByOutcomeId,
22233
- livePrices
22234
- });
22235
- const isActive = outcome.id === scopedSelectedOutcomeId;
22236
- const isPositive = resolveIsPositiveOutcome(outcome, index);
22237
- const isPriceLoading = clusterMidpointResult.isLoading && price == null;
22238
- return /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(
22239
- "button",
22240
- {
22241
- "data-id": outcome.id,
22242
- type: "button",
22243
- className: cn(
22244
- "agg-outcome-button",
22245
- getOutcomeButtonClassName({
22246
- enableAnimations,
22247
- isActive,
22248
- isPositive
22249
- }),
22250
- "disabled:cursor-not-allowed disabled:opacity-60",
22251
- "leading-agg-5! flex-1 min-w-0 gap-1 md:gap-2"
22252
- ),
22253
- "aria-pressed": isActive,
22254
- "aria-label": `${(_b2 = outcome.title) != null ? _b2 : outcome.label} ${formatProbabilityCents(price)}`,
22255
- disabled: !orderEligibility.canPlaceOrder || isResolvedOutcomeCtaLocked,
22256
- onClick: () => handleOutcomeChange(outcome.id),
22257
- children: [
22533
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "agg-order-entry-section flex flex-col gap-4", children: [
22534
+ outcomes.length >= 2 ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("div", { className: "agg-outcomes flex w-full max-w-full gap-2", children: outcomes.map((outcome, index) => {
22535
+ var _a2, _b2, _c2;
22536
+ const price = getDisplayOutcomePrice({
22537
+ outcomeId: outcome.id,
22538
+ outcomeLabel: outcome.label,
22539
+ selection: (_a2 = tradingContext == null ? void 0 : tradingContext.tradeSide) != null ? _a2 : isSell ? "sell" : "buy",
22540
+ bestPrices: clusterBestPrices,
22541
+ bestMidpoint: clusterBestMidpoint,
22542
+ bestMidpointsByOutcomeId: clusterBestMidpointsByOutcomeId,
22543
+ livePrices
22544
+ });
22545
+ const isActive = outcome.id === scopedSelectedOutcomeId;
22546
+ const isPositive = resolveIsPositiveOutcome(outcome, index);
22547
+ const isPriceLoading = clusterMidpointResult.isLoading && price == null;
22548
+ return /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(
22549
+ "button",
22550
+ {
22551
+ "data-id": outcome.id,
22552
+ type: "button",
22553
+ className: cn(
22554
+ "agg-outcome-button",
22555
+ getOutcomeButtonClassName({
22556
+ enableAnimations,
22557
+ isActive,
22558
+ isPositive
22559
+ }),
22560
+ "disabled:cursor-not-allowed disabled:opacity-60",
22561
+ "leading-agg-5! flex-1 min-w-0 gap-1 md:gap-2"
22562
+ ),
22563
+ "aria-pressed": isActive,
22564
+ "aria-label": `${(_b2 = outcome.title) != null ? _b2 : outcome.label} ${formatProbabilityCents(price, formatPrice)}`,
22565
+ disabled: !orderEligibility.canPlaceOrder || isResolvedOutcomeCtaLocked,
22566
+ onClick: () => handleOutcomeChange(outcome.id),
22567
+ children: [
22568
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
22569
+ Typography,
22570
+ {
22571
+ as: "span",
22572
+ variant: isActive ? "body-strong" : "body",
22573
+ className: cn("whitespace-nowrap truncate"),
22574
+ children: (_c2 = outcome.title) != null ? _c2 : outcome.label
22575
+ }
22576
+ ),
22577
+ isPriceLoading ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
22578
+ "span",
22579
+ {
22580
+ "aria-hidden": "true",
22581
+ className: cn(
22582
+ "agg-place-order-outcome-price-loading",
22583
+ "h-4 w-10 shrink-0 rounded-agg-sm bg-agg-separator animate-pulse"
22584
+ )
22585
+ }
22586
+ ) : /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(Typography, { as: "span", variant: isActive ? "body-strong" : "body", children: formatProbabilityCents(price, formatPrice) })
22587
+ ]
22588
+ },
22589
+ outcome.id
22590
+ );
22591
+ }) }) : null,
22592
+ isLimitOrder ? /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "agg-limit-price-section flex items-center justify-between gap-4", children: [
22593
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.limitPrice }),
22594
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "flex min-w-0 flex-col items-end gap-1", children: [
22595
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "flex items-center gap-2", children: [
22596
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("label", { className: "relative flex items-center", children: [
22597
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
22598
+ "input",
22599
+ {
22600
+ type: "text",
22601
+ inputMode: "decimal",
22602
+ "aria-label": tradingLabels.limitPriceInputAria,
22603
+ "aria-invalid": Boolean(limitPriceInputError),
22604
+ value: limitPriceInputValue,
22605
+ onChange: handleLimitPriceInputChange,
22606
+ onBlur: handleLimitPriceInputBlur,
22607
+ className: cn(
22608
+ PLACE_ORDER_NUMERIC_INPUT_CLASS_NAME,
22609
+ "h-9 w-[108px] pr-5",
22610
+ limitPriceInputError && "text-agg-error focus-visible:text-agg-error"
22611
+ )
22612
+ }
22613
+ ),
22614
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("span", { className: "pointer-events-none absolute right-1 text-agg-3xl font-agg-bold leading-agg-9 text-agg-foreground", children: "\xA2" })
22615
+ ] }),
22258
22616
  /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
22259
- Typography,
22617
+ "button",
22260
22618
  {
22261
- as: "span",
22262
- variant: isActive ? "body-strong" : "body",
22263
- className: cn("whitespace-nowrap truncate"),
22264
- children: (_c2 = outcome.title) != null ? _c2 : outcome.label
22619
+ type: "button",
22620
+ 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",
22621
+ "aria-label": tradingLabels.limitPriceDecreaseAria,
22622
+ onClick: () => handleLimitPriceStep("decrease"),
22623
+ children: /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(Icon, { name: "minus", size: "small", className: "h-4 w-4", "aria-hidden": true })
22265
22624
  }
22266
22625
  ),
22267
- isPriceLoading ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
22268
- "span",
22626
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
22627
+ "button",
22269
22628
  {
22270
- "aria-hidden": "true",
22271
- className: cn(
22272
- "agg-place-order-outcome-price-loading",
22273
- "h-4 w-10 shrink-0 rounded-agg-sm bg-agg-separator animate-pulse"
22274
- )
22629
+ type: "button",
22630
+ 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",
22631
+ "aria-label": tradingLabels.limitPriceIncreaseAria,
22632
+ onClick: () => handleLimitPriceStep("increase"),
22633
+ children: /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(Icon, { name: "plus", size: "small", className: "h-4 w-4", "aria-hidden": true })
22275
22634
  }
22276
- ) : /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(Typography, { as: "span", variant: isActive ? "body-strong" : "body", children: formatProbabilityCents(price) })
22277
- ]
22278
- },
22279
- outcome.id
22280
- );
22281
- }) }) : null,
22282
- isLimitOrder ? /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "agg-limit-price-section flex items-center justify-between gap-4", children: [
22283
- /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.limitPrice }),
22284
- /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "flex min-w-0 flex-col items-end gap-1", children: [
22285
- /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "flex items-center gap-2", children: [
22286
- /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("label", { className: "relative flex items-center", children: [
22287
- /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
22288
- "input",
22635
+ )
22636
+ ] }),
22637
+ limitPriceInputError ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("p", { className: "max-w-[220px] text-right text-agg-xs leading-agg-4 text-agg-error", children: limitPriceInputError }) : null
22638
+ ] })
22639
+ ] }) : null,
22640
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "agg-order-amount-section flex items-start justify-between gap-4", children: [
22641
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "agg-order-amount-meta flex flex-col", children: [
22642
+ /* @__PURE__ */ (0, import_jsx_runtime158.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) }),
22643
+ isAuthenticated ? isSell ? /* @__PURE__ */ (0, import_jsx_runtime158.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_runtime158.jsx)(LoadingIcon, { size: "small" }) : /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(import_jsx_runtime158.Fragment, { children: [
22644
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("span", { className: "whitespace-pre", children: displayedCurrentSellableSharesLabel }),
22645
+ displayedCurrentSellableShares > 0 ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
22646
+ "button",
22289
22647
  {
22290
- type: "text",
22291
- inputMode: "decimal",
22292
- "aria-label": tradingLabels.limitPriceInputAria,
22293
- "aria-invalid": Boolean(limitPriceInputError),
22294
- value: limitPriceInputValue,
22295
- onChange: handleLimitPriceInputChange,
22296
- onBlur: handleLimitPriceInputBlur,
22648
+ type: "button",
22297
22649
  className: cn(
22298
- "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",
22299
- "focus-visible:ring-2 focus-visible:ring-agg-primary",
22300
- limitPriceInputError && "text-agg-error focus-visible:ring-agg-error"
22301
- )
22650
+ "agg-max-shares-button",
22651
+ "cursor-pointer disabled:cursor-not-allowed",
22652
+ "bg-transparent p-0 text-agg-sm font-agg-bold leading-agg-5 text-agg-primary disabled:text-agg-muted-foreground",
22653
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-0 focus-visible:ring-offset-agg-secondary"
22654
+ ),
22655
+ "aria-label": tradingLabels.maxShares,
22656
+ disabled: !orderEligibility.canPlaceOrder || isAtMaxSellableShares,
22657
+ onClick: handleFillSellableShares,
22658
+ children: tradingLabels.maxShares
22302
22659
  }
22303
- ),
22304
- /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("span", { className: "pointer-events-none absolute right-1 text-agg-3xl font-agg-bold leading-agg-9 text-agg-foreground", children: "\xA2" })
22305
- ] }),
22306
- /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
22307
- "button",
22308
- {
22309
- type: "button",
22310
- 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",
22311
- "aria-label": tradingLabels.limitPriceDecreaseAria,
22312
- onClick: () => handleLimitPriceStep("decrease"),
22313
- children: /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(Icon, { name: "minus", size: "small", className: "h-4 w-4", "aria-hidden": true })
22660
+ ) : null
22661
+ ] }) }) : /* @__PURE__ */ (0, import_jsx_runtime158.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_runtime158.jsx)(LoadingIcon, { size: "small" }) : tradingLabels.balance(formatUsd(displayedBalance)) }) : null
22662
+ ] }),
22663
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
22664
+ CurrencyInput,
22665
+ {
22666
+ value: internalAmount,
22667
+ onChange: handleAmountChange,
22668
+ ariaLabel: tradingLabels.amount(internalTab),
22669
+ max: isLimitOrder && !isSell && isAuthenticated && !isBalanceLoading ? totalBalance : void 0,
22670
+ isInvalid: isInsufficientBalance || isBelowMinimum,
22671
+ disabled: !orderEligibility.canPlaceOrder,
22672
+ prefix: internalTab === "buy" ? "$" : "",
22673
+ decimalPlaces: isSell ? SELL_SHARE_INPUT_DECIMALS : 2,
22674
+ classNames: {
22675
+ input: cn(
22676
+ "agg-order-amount-input",
22677
+ PLACE_ORDER_NUMERIC_INPUT_CLASS_NAME,
22678
+ "w-full max-w-[168px]",
22679
+ hasEnteredAmount ? "text-agg-foreground" : "text-agg-separator caret-agg-foreground"
22680
+ )
22314
22681
  }
22315
- ),
22682
+ }
22683
+ )
22684
+ ] }),
22685
+ showFeesBreakdown && hasEnteredAmount && !isBelowMinimum && estimatedFeesValue ? /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "agg-order-fees-section flex items-center justify-between gap-4", children: [
22686
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "flex items-center gap-1.5", children: [
22316
22687
  /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
22317
- "button",
22688
+ Typography,
22318
22689
  {
22319
- type: "button",
22320
- 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",
22321
- "aria-label": tradingLabels.limitPriceIncreaseAria,
22322
- onClick: () => handleLimitPriceStep("increase"),
22323
- children: /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(Icon, { name: "plus", size: "small", className: "h-4 w-4", "aria-hidden": true })
22690
+ variant: "text-sm",
22691
+ className: "text-agg-sm leading-agg-5 text-agg-muted-foreground",
22692
+ children: tradingLabels.estimatedFees
22324
22693
  }
22325
- )
22326
- ] }),
22327
- limitPriceInputError ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("p", { className: "max-w-[220px] text-right text-agg-xs leading-agg-4 text-agg-error", children: limitPriceInputError }) : null
22328
- ] })
22329
- ] }) : null,
22330
- /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "agg-order-amount-section flex items-start justify-between gap-4", children: [
22331
- /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "agg-order-amount-meta flex flex-col", children: [
22332
- /* @__PURE__ */ (0, import_jsx_runtime158.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) }),
22333
- isAuthenticated ? isSell ? /* @__PURE__ */ (0, import_jsx_runtime158.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_runtime158.jsx)(LoadingIcon, { size: "small" }) : /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(import_jsx_runtime158.Fragment, { children: [
22334
- /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("span", { className: "whitespace-pre", children: displayedCurrentSellableSharesLabel }),
22335
- displayedCurrentSellableShares > 0 ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
22336
- "button",
22694
+ ),
22695
+ feeBreakdownRows.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
22696
+ Tooltip,
22337
22697
  {
22338
- type: "button",
22339
- className: cn(
22340
- "agg-max-shares-button",
22341
- "cursor-pointer disabled:cursor-not-allowed",
22342
- "bg-transparent p-0 text-agg-sm font-agg-bold leading-agg-5 text-agg-primary disabled:text-agg-muted-foreground",
22343
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-0 focus-visible:ring-offset-agg-secondary"
22344
- ),
22345
- "aria-label": tradingLabels.maxShares,
22346
- disabled: !orderEligibility.canPlaceOrder || isAtMaxSellableShares,
22347
- onClick: handleFillSellableShares,
22348
- children: tradingLabels.maxShares
22698
+ "aria-label": tradingLabels.estimatedFeesTooltipAria,
22699
+ classNames: {
22700
+ content: cn(
22701
+ "min-w-[220px] max-w-[320px] rounded-[10px] px-5 py-4",
22702
+ "shadow-[0_12px_12px_rgba(0,0,0,0.10)]"
22703
+ ),
22704
+ icon: "h-3 w-3 text-agg-muted-foreground",
22705
+ trigger: "h-3 w-3 text-agg-muted-foreground"
22706
+ },
22707
+ content: /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("div", { className: "flex w-full flex-col gap-2", children: feeBreakdownRows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(
22708
+ "div",
22709
+ {
22710
+ className: "flex items-center justify-between gap-3 text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground",
22711
+ children: [
22712
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("span", { children: row.label }),
22713
+ row.kind === "badge" ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
22714
+ "span",
22715
+ {
22716
+ className: cn(
22717
+ "agg-fee-badge inline-flex items-center justify-center rounded-agg-sm border border-agg-primary/50",
22718
+ "bg-linear-to-b from-agg-primary/8 to-agg-primary/15 px-1.5 py-1",
22719
+ "text-agg-xs font-agg-bold leading-agg-4 text-agg-primary uppercase whitespace-nowrap"
22720
+ ),
22721
+ children: row.badgeLabel
22722
+ }
22723
+ ) : /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("span", { className: "text-right", children: row.value })
22724
+ ]
22725
+ },
22726
+ row.label
22727
+ )) })
22349
22728
  }
22350
22729
  ) : null
22351
- ] }) }) : /* @__PURE__ */ (0, import_jsx_runtime158.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_runtime158.jsx)(LoadingIcon, { size: "small" }) : tradingLabels.balance(formatUsd(displayedBalance)) }) : null
22352
- ] }),
22353
- /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
22354
- CurrencyInput,
22355
- {
22356
- value: internalAmount,
22357
- onChange: handleAmountChange,
22358
- ariaLabel: tradingLabels.amount(internalTab),
22359
- max: isLimitOrder && !isSell && isAuthenticated && !isBalanceLoading ? totalBalance : void 0,
22360
- isInvalid: isInsufficientBalance || isBelowMinimum,
22361
- disabled: !orderEligibility.canPlaceOrder,
22362
- prefix: internalTab === "buy" ? "$" : "",
22363
- decimalPlaces: isSell ? SELL_SHARE_INPUT_DECIMALS : 2,
22364
- classNames: {
22365
- input: cn(
22366
- "agg-order-amount-input",
22367
- "w-full max-w-[168px] text-right text-agg-3xl font-agg-bold leading-agg-9 tracking-agg-normal",
22368
- hasEnteredAmount ? "text-agg-foreground" : "text-agg-separator caret-agg-foreground"
22369
- )
22370
- }
22371
- }
22372
- )
22730
+ ] }),
22731
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: estimatedFeesValue })
22732
+ ] }) : null
22373
22733
  ] }),
22374
- showFeesBreakdown && hasEnteredAmount && !isBelowMinimum && estimatedFeesValue ? /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "agg-order-fees-section flex items-center justify-between gap-4", children: [
22375
- /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "flex items-center gap-1.5", children: [
22376
- /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
22377
- Typography,
22378
- {
22379
- variant: "text-sm",
22380
- className: "text-agg-sm leading-agg-5 text-agg-muted-foreground",
22381
- children: tradingLabels.estimatedFees
22382
- }
22383
- ),
22384
- feeBreakdownRows.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
22385
- Tooltip,
22386
- {
22387
- "aria-label": tradingLabels.estimatedFeesTooltipAria,
22388
- classNames: {
22389
- content: cn(
22390
- "min-w-[220px] max-w-[320px] rounded-[10px] px-5 py-4",
22391
- "shadow-[0_12px_12px_rgba(0,0,0,0.10)]"
22392
- ),
22393
- icon: "h-3 w-3 text-agg-muted-foreground",
22394
- trigger: "h-3 w-3 text-agg-muted-foreground"
22395
- },
22396
- content: /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("div", { className: "flex w-full flex-col gap-2", children: feeBreakdownRows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(
22397
- "div",
22398
- {
22399
- className: "flex items-center justify-between gap-3 text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground",
22400
- children: [
22401
- /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("span", { children: row.label }),
22402
- row.kind === "badge" ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
22403
- "span",
22404
- {
22405
- className: cn(
22406
- "agg-fee-badge inline-flex items-center justify-center rounded-agg-sm border border-agg-primary/50",
22407
- "bg-linear-to-b from-agg-primary/8 to-agg-primary/15 px-1.5 py-1",
22408
- "text-agg-xs font-agg-bold leading-agg-4 text-agg-primary uppercase whitespace-nowrap"
22409
- ),
22410
- children: row.badgeLabel
22411
- }
22412
- ) : /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("span", { className: "text-right", children: row.value })
22413
- ]
22414
- },
22415
- row.label
22416
- )) })
22417
- }
22418
- ) : null
22419
- ] }),
22420
- /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: estimatedFeesValue })
22421
- ] }) : null,
22422
22734
  shouldShowSmartRouting ? /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "agg-route-panel flex flex-col gap-3", children: [
22423
22735
  /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "agg-route-panel-header flex items-center justify-between gap-4", children: [
22424
22736
  /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("p", { className: "agg-route-panel-title text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.smartRouting }),
@@ -22427,10 +22739,10 @@ var PlaceOrder = ({
22427
22739
  {
22428
22740
  type: "button",
22429
22741
  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",
22430
- "aria-label": tradingLabels.viewAllRoutes(orderedRouteCards.length),
22742
+ "aria-label": tradingLabels.viewAllRoutes(activeRouteCardCount),
22431
22743
  onClick: () => setIsRoutesExpanded((currentValue) => !currentValue),
22432
22744
  children: [
22433
- /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("span", { children: tradingLabels.viewAllRoutes(orderedRouteCards.length) }),
22745
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("span", { children: tradingLabels.viewAllRoutes(activeRouteCardCount) }),
22434
22746
  /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
22435
22747
  Icon,
22436
22748
  {
@@ -22444,16 +22756,16 @@ var PlaceOrder = ({
22444
22756
  }
22445
22757
  ) : null
22446
22758
  ] }),
22447
- /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("div", { className: "agg-route-list flex flex-col gap-2", children: isQuoteLoading ? /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "agg-route-loading flex flex-col gap-2", "aria-hidden": "true", children: [
22759
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("div", { className: "agg-route-list flex flex-col gap-2", children: !isLimitOrder && isQuoteLoading ? /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "agg-route-loading flex flex-col gap-2", "aria-hidden": "true", children: [
22448
22760
  /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(PlaceOrderRouteCardSkeleton, {}),
22449
22761
  /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(PlaceOrderRouteCardSkeleton, {})
22450
- ] }) : visibleRouteCards.length > 0 ? visibleRouteCards.map((card) => {
22762
+ ] }) : activeRouteCards.length > 0 ? activeRouteCards.map((card) => {
22451
22763
  return /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(import_react36.Fragment, { children: renderRouteCard({
22452
22764
  card,
22453
22765
  enableAnimations,
22454
22766
  isExpanded: card.kind === "split" ? isSplitDetailOpen : isRoutesExpanded,
22455
- isSelected: !card.isUnavailable && card.id === resolvedSelectedRouteCardId,
22456
- onSelect: handleRouteCardSelect,
22767
+ isSelected: !card.isUnavailable && card.id === (isLimitOrder ? selectedLimitRouteCardId : resolvedSelectedRouteCardId),
22768
+ onSelect: handleActiveRouteCardSelect,
22457
22769
  tradingLabels
22458
22770
  }) }, card.id);
22459
22771
  }) : null })
@@ -22474,7 +22786,6 @@ var PlaceOrder = ({
22474
22786
  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",
22475
22787
  "aria-label": tradingLabels.expirationMenuAria,
22476
22788
  children: [
22477
- /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(Icon, { name: "calendar", size: "small", className: "h-4 w-4 shrink-0", "aria-hidden": true }),
22478
22789
  /* @__PURE__ */ (0, import_jsx_runtime158.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(
22479
22790
  "MMM D, YYYY [at] HH:mm"
22480
22791
  ) : tradingLabels.expirationCustom }),
@@ -22778,7 +23089,7 @@ var PlaceOrder = ({
22778
23089
  className: "agg-order-submit h-12 w-full px-8 text-agg-base leading-agg-6 shadow-none",
22779
23090
  disabled: !orderEligibility.canPlaceOrder || shouldShowGeoBlockBanner,
22780
23091
  "aria-label": tradingLabels.signInToTrade,
22781
- onClick: import_hooks60.requestAggAuthChooserOpen,
23092
+ onClick: import_hooks61.requestAggAuthChooserOpen,
22782
23093
  children: tradingLabels.signInToTrade
22783
23094
  }
22784
23095
  ) : /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
@@ -22850,7 +23161,7 @@ var PlaceOrder = ({
22850
23161
  PlaceOrder.displayName = "PlaceOrder";
22851
23162
 
22852
23163
  // src/trading/use-claim-winnings.ts
22853
- var import_hooks61 = require("@agg-build/hooks");
23164
+ var import_hooks62 = require("@agg-build/hooks");
22854
23165
  var import_react37 = require("react");
22855
23166
  var toClaimError = (err) => {
22856
23167
  if (err instanceof Error) return err;
@@ -22858,11 +23169,11 @@ var toClaimError = (err) => {
22858
23169
  };
22859
23170
  function useClaimWinnings(options = {}) {
22860
23171
  const { onClaim, onClaimResult, onClaimSubmitError, externalClaimingKeys } = options;
22861
- const labels = (0, import_hooks61.useLabels)();
23172
+ const labels = (0, import_hooks62.useLabels)();
22862
23173
  const claimNotificationLabels = labels.notifications.claim;
22863
23174
  const toastCtx = useOptionalToast();
22864
- const queryClient = (0, import_hooks61.useQueryClient)();
22865
- const redeemMutation = (0, import_hooks61.useRedeem)();
23175
+ const queryClient = (0, import_hooks62.useQueryClient)();
23176
+ const redeemMutation = (0, import_hooks62.useRedeem)();
22866
23177
  const [activeRedeems, setActiveRedeems] = (0, import_react37.useState)({});
22867
23178
  const activeClaimKeysRef = (0, import_react37.useRef)(/* @__PURE__ */ new Set());
22868
23179
  const pendingClaimToastIdsRef = (0, import_react37.useRef)({});
@@ -22872,7 +23183,7 @@ function useClaimWinnings(options = {}) {
22872
23183
  () => Object.values(activeRedeems),
22873
23184
  [activeRedeems]
22874
23185
  );
22875
- const lifecycleStates = (0, import_hooks61.useRedeemLifecycles)(lifecycleInputs);
23186
+ const lifecycleStates = (0, import_hooks62.useRedeemLifecycles)(lifecycleInputs);
22876
23187
  const internalClaimingIds = (0, import_react37.useMemo)(() => {
22877
23188
  const out = __spreadValues({}, submittingClaimKeys);
22878
23189
  for (const [claimKey, active] of Object.entries(activeRedeems)) {
@@ -22887,13 +23198,13 @@ function useClaimWinnings(options = {}) {
22887
23198
  [externalClaimingKeys, internalClaimingIds]
22888
23199
  );
22889
23200
  const invalidateClaimUiState = (0, import_react37.useCallback)(() => {
22890
- (0, import_hooks61.invalidateBalanceQueries)(queryClient);
22891
- (0, import_hooks61.invalidatePositionQueries)(queryClient);
23201
+ (0, import_hooks62.invalidateBalanceQueries)(queryClient);
23202
+ (0, import_hooks62.invalidatePositionQueries)(queryClient);
22892
23203
  queryClient.invalidateQueries({
22893
- queryKey: import_hooks61.executionKeys.claimablePositionsCount(),
23204
+ queryKey: import_hooks62.executionKeys.claimablePositionsCount(),
22894
23205
  refetchType: "active"
22895
23206
  });
22896
- (0, import_hooks61.invalidateUserActivityQueries)(queryClient);
23207
+ (0, import_hooks62.invalidateUserActivityQueries)(queryClient);
22897
23208
  }, [queryClient]);
22898
23209
  const claim = (0, import_react37.useCallback)(
22899
23210
  (_0) => __async(null, [_0], function* ({ claimKey, winningOutcomeIds, payload }) {
@@ -23090,7 +23401,7 @@ function useClaimWinnings(options = {}) {
23090
23401
  }
23091
23402
 
23092
23403
  // src/trading/use-resolved-market-claim.ts
23093
- var import_hooks62 = require("@agg-build/hooks");
23404
+ var import_hooks63 = require("@agg-build/hooks");
23094
23405
  var import_react38 = require("react");
23095
23406
  var sharesFormatter = new Intl.NumberFormat("en-US", { maximumFractionDigits: 2 });
23096
23407
  var dateFormatter = new Intl.DateTimeFormat("en-US", {
@@ -23107,12 +23418,12 @@ var formatResolutionDate = (value) => {
23107
23418
  function useResolvedMarketClaim(options = {}) {
23108
23419
  var _a;
23109
23420
  const { market, enabled = true, executionMode } = options;
23110
- const { isAuthenticated } = (0, import_hooks62.useAggAuthState)();
23111
- const tradingState = (0, import_react38.useMemo)(() => (0, import_hooks62.resolveMarketTradingState)(market), [market]);
23421
+ const { isAuthenticated } = (0, import_hooks63.useAggAuthState)();
23422
+ const tradingState = (0, import_react38.useMemo)(() => (0, import_hooks63.resolveMarketTradingState)(market), [market]);
23112
23423
  const isResolved = tradingState.kind === "resolved";
23113
23424
  const marketId = (_a = market == null ? void 0 : market.id) != null ? _a : null;
23114
23425
  const shouldFetch = Boolean(enabled && isAuthenticated && isResolved && marketId);
23115
- const { positions } = (0, import_hooks62.useExecutionPositions)(__spreadValues({
23426
+ const { positions } = (0, import_hooks63.useExecutionPositions)(__spreadValues({
23116
23427
  enabled: shouldFetch,
23117
23428
  status: "active",
23118
23429
  limit: 50
@@ -23129,7 +23440,7 @@ function useResolvedMarketClaim(options = {}) {
23129
23440
  (outcome) => outcome.winner === true && outcome.totalSize > 0
23130
23441
  );
23131
23442
  if (winningOutcomes.length === 0) return void 0;
23132
- const totals = (0, import_hooks62.computeClosedPositionTotals)(group);
23443
+ const totals = (0, import_hooks63.computeClosedPositionTotals)(group);
23133
23444
  const winningShares = winningOutcomes.reduce((sum, outcome) => sum + outcome.totalSize, 0);
23134
23445
  const winningOutcomeLabel = (_a2 = resolveResolvedOutcomeLabel({
23135
23446
  market: market != null ? market : group.venueMarket,
@@ -23213,7 +23524,7 @@ var resolveEventMarketPageStickyState = ({
23213
23524
  };
23214
23525
 
23215
23526
  // src/pages/event-market/event-market.shared.tsx
23216
- var import_hooks63 = require("@agg-build/hooks");
23527
+ var import_hooks64 = require("@agg-build/hooks");
23217
23528
  var Dialog7 = __toESM(require("@radix-ui/react-dialog"));
23218
23529
  var import_react39 = require("react");
23219
23530
  var import_jsx_runtime159 = require("react/jsx-runtime");
@@ -23282,7 +23593,7 @@ var EventMarketPageMobileTrade = ({
23282
23593
  midpointsResult,
23283
23594
  onBeforePrimaryAction
23284
23595
  }) => {
23285
- const labels = (0, import_hooks63.useLabels)();
23596
+ const labels = (0, import_hooks64.useLabels)();
23286
23597
  if (!showPlaceOrder) return null;
23287
23598
  const handleOpenChange = (nextOpen) => {
23288
23599
  onOpenChange(nextOpen);
@@ -23337,7 +23648,7 @@ var EventMarketPageMobileTrade = ({
23337
23648
  var EventMarketPageUnavailableState = ({
23338
23649
  ariaLabel: _ariaLabel
23339
23650
  }) => {
23340
- const labels = (0, import_hooks63.useLabels)();
23651
+ const labels = (0, import_hooks64.useLabels)();
23341
23652
  return /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(
23342
23653
  StateMessage,
23343
23654
  {
@@ -23353,7 +23664,7 @@ var EventMarketPageUnavailableState = ({
23353
23664
  var EventMarketPageNotFoundState = ({
23354
23665
  ariaLabel: _ariaLabel
23355
23666
  }) => {
23356
- const labels = (0, import_hooks63.useLabels)();
23667
+ const labels = (0, import_hooks64.useLabels)();
23357
23668
  return /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(
23358
23669
  StateMessage,
23359
23670
  {
@@ -23450,11 +23761,11 @@ var EventMarketPageLoadingState = ({
23450
23761
  };
23451
23762
 
23452
23763
  // src/pages/event-market/sports-event-market-page.tsx
23453
- var import_hooks66 = require("@agg-build/hooks");
23764
+ var import_hooks67 = require("@agg-build/hooks");
23454
23765
  var import_react42 = require("react");
23455
23766
 
23456
23767
  // src/pages/event-market/sports-markets.tsx
23457
- var import_hooks65 = require("@agg-build/hooks");
23768
+ var import_hooks66 = require("@agg-build/hooks");
23458
23769
  var import_react41 = require("react");
23459
23770
 
23460
23771
  // src/pages/event-market/sports-event-market.utils.ts
@@ -24303,7 +24614,7 @@ var mergeSportsSectionMarketsIntoEvent = ({
24303
24614
  };
24304
24615
 
24305
24616
  // src/pages/event-market/sports-market-card.tsx
24306
- var import_hooks64 = require("@agg-build/hooks");
24617
+ var import_hooks65 = require("@agg-build/hooks");
24307
24618
  var import_react40 = require("react");
24308
24619
 
24309
24620
  // src/pages/event-market/sports-line-rail.tsx
@@ -24353,7 +24664,7 @@ function SportsLineRail({
24353
24664
  const didInit = React.useRef(false);
24354
24665
  const programmatic = React.useRef(false);
24355
24666
  const progTimer = React.useRef(void 0);
24356
- const skipCenterOnPropSync = React.useRef(false);
24667
+ const skipCenterForIndex = React.useRef(null);
24357
24668
  const pendingScrollIndex = React.useRef(null);
24358
24669
  const scrollSettleTimer = React.useRef(void 0);
24359
24670
  const stopCount = stops.length;
@@ -24393,9 +24704,15 @@ function SportsLineRail({
24393
24704
  if (!w) return;
24394
24705
  const firstW = (_b = (_a = itemRefs.current[0]) == null ? void 0 : _a.offsetWidth) != null ? _b : 0;
24395
24706
  const lastW = (_d = (_c = itemRefs.current[stopCount - 1]) == null ? void 0 : _c.offsetWidth) != null ? _d : 0;
24396
- setPad({
24707
+ const nextPad = {
24397
24708
  left: Math.max(0, w / 2 - firstW / 2),
24398
24709
  right: Math.max(0, w / 2 - lastW / 2)
24710
+ };
24711
+ setPad((currentPad) => {
24712
+ if (currentPad.left === nextPad.left && currentPad.right === nextPad.right) {
24713
+ return currentPad;
24714
+ }
24715
+ return nextPad;
24399
24716
  });
24400
24717
  updateMask();
24401
24718
  };
@@ -24408,7 +24725,7 @@ function SportsLineRail({
24408
24725
  scrollSettleTimer.current = setTimeout(() => {
24409
24726
  const nextIndex = pendingScrollIndex.current;
24410
24727
  if (nextIndex == null || nextIndex === selectedIndex) return;
24411
- skipCenterOnPropSync.current = true;
24728
+ skipCenterForIndex.current = nextIndex;
24412
24729
  onSelect(nextIndex);
24413
24730
  }, 120);
24414
24731
  }
@@ -24432,11 +24749,12 @@ function SportsLineRail({
24432
24749
  const c = scrollRef.current;
24433
24750
  const el = itemRefs.current[selectedIndex];
24434
24751
  if (!c || !el || !c.clientWidth) return;
24435
- if (skipCenterOnPropSync.current) {
24436
- skipCenterOnPropSync.current = false;
24752
+ if (skipCenterForIndex.current === selectedIndex) {
24753
+ skipCenterForIndex.current = null;
24437
24754
  updateMask();
24438
24755
  return;
24439
24756
  }
24757
+ skipCenterForIndex.current = null;
24440
24758
  const max = c.scrollWidth - c.clientWidth;
24441
24759
  const target = el.offsetLeft - c.clientWidth / 2 + el.clientWidth / 2;
24442
24760
  programmatic.current = true;
@@ -24451,11 +24769,18 @@ function SportsLineRail({
24451
24769
  }, 500);
24452
24770
  updateMask();
24453
24771
  }, [selectedIndex, stopCount, pad, updateMask]);
24454
- const select = (index) => {
24455
- const next = Math.min(stops.length - 1, Math.max(0, index));
24772
+ const clampStopIndex = (index) => Math.min(stops.length - 1, Math.max(0, index));
24773
+ const handleStopClick = (index) => {
24774
+ const next = clampStopIndex(index);
24775
+ if (next !== selectedIndex) {
24776
+ skipCenterForIndex.current = next;
24777
+ }
24778
+ onSelect(next);
24779
+ };
24780
+ const handleStep = (delta) => {
24781
+ const next = clampStopIndex(selectedIndex + delta);
24456
24782
  if (next !== selectedIndex) onSelect(next);
24457
24783
  };
24458
- const step = (delta) => select(selectedIndex + delta);
24459
24784
  if (stopCount === 0) return null;
24460
24785
  return /* @__PURE__ */ (0, import_jsx_runtime160.jsxs)(
24461
24786
  "div",
@@ -24467,7 +24792,7 @@ function SportsLineRail({
24467
24792
  "button",
24468
24793
  {
24469
24794
  type: "button",
24470
- onClick: () => step(-1),
24795
+ onClick: () => handleStep(-1),
24471
24796
  disabled: selectedIndex === 0,
24472
24797
  "aria-label": previousAriaLabel != null ? previousAriaLabel : "Previous line",
24473
24798
  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",
@@ -24490,7 +24815,7 @@ function SportsLineRail({
24490
24815
  ref: (el) => {
24491
24816
  itemRefs.current[index] = el;
24492
24817
  },
24493
- onClick: () => select(index),
24818
+ onClick: () => handleStopClick(index),
24494
24819
  disabled: stop.disabled,
24495
24820
  "aria-pressed": active,
24496
24821
  className: "flex shrink-0 cursor-pointer flex-col items-center gap-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-40",
@@ -24536,7 +24861,7 @@ function SportsLineRail({
24536
24861
  "button",
24537
24862
  {
24538
24863
  type: "button",
24539
- onClick: () => step(1),
24864
+ onClick: () => handleStep(1),
24540
24865
  disabled: selectedIndex === stopCount - 1,
24541
24866
  "aria-label": nextAriaLabel != null ? nextAriaLabel : "Next line",
24542
24867
  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",
@@ -24550,15 +24875,81 @@ function SportsLineRail({
24550
24875
 
24551
24876
  // src/pages/event-market/sports-market-card.tsx
24552
24877
  var import_jsx_runtime161 = require("react/jsx-runtime");
24553
- var resolveSportsLineOutcomeSide = (outcome) => {
24878
+ var resolveSpreadHeaderOutcomeItems = ({
24879
+ market,
24880
+ groupMarkets,
24881
+ midpointsResult
24882
+ }) => {
24554
24883
  var _a;
24555
- for (const candidate of [outcome.label, outcome.title]) {
24556
- if (typeof candidate !== "string") continue;
24557
- const matchedSide = (_a = candidate.trim().toLowerCase().match(/(?:^|\s)(over|under)(?=\s|$)/)) == null ? void 0 : _a[1];
24558
- if (matchedSide === "over" || matchedSide === "under") return matchedSide;
24559
- }
24884
+ const outcomes = (_a = market.venueMarketOutcomes) != null ? _a : [];
24885
+ const lineValue = market.lineValue;
24886
+ if (outcomes.length < 2 || lineValue == null) return void 0;
24887
+ const { favored, dog } = resolveSpreadOutcomeTeamNames(market, groupMarkets);
24888
+ if (!favored && !dog) return void 0;
24889
+ const magnitude = Math.abs(lineValue);
24890
+ const formatLine = (value) => `${value > 0 ? "+" : "\u2212"}${Number.isInteger(magnitude) ? String(magnitude) : magnitude.toFixed(1)}`;
24891
+ return [
24892
+ { index: 0, name: favored, signedLine: -magnitude },
24893
+ { index: 1, name: dog, signedLine: magnitude }
24894
+ ].flatMap(({ index, name, signedLine }) => {
24895
+ var _a2;
24896
+ const outcome = outcomes[index];
24897
+ if (!outcome) return [];
24898
+ const label2 = name != null ? name : outcome.label.trim();
24899
+ const probability = midpointsResult == null ? void 0 : getDisplayOutcomePrice({
24900
+ outcomeId: outcome.id,
24901
+ outcomeLabel: outcome.label,
24902
+ bestMidpointsByOutcomeId: (_a2 = midpointsResult.bestMidpointsByOutcomeId) != null ? _a2 : midpointsResult.prices
24903
+ });
24904
+ return [
24905
+ {
24906
+ id: outcome.id,
24907
+ label: label2,
24908
+ title: label2,
24909
+ lineLabel: formatLine(signedLine),
24910
+ probability,
24911
+ isPriceLoading: (midpointsResult == null ? void 0 : midpointsResult.isLoading) === true && probability == null,
24912
+ tone: index === 0 ? "positive" : "negative",
24913
+ variant: "line",
24914
+ venue: market.venue
24915
+ }
24916
+ ];
24917
+ });
24918
+ };
24919
+ var resolveDisplayedOutcomes = ({
24920
+ market,
24921
+ venueMarkets,
24922
+ groupMarkets,
24923
+ useSpreadOverride
24924
+ }) => {
24925
+ var _a;
24926
+ const spreadHeaderOutcomeItems = useSpreadOverride ? resolveSpreadHeaderOutcomeItems({ market, groupMarkets }) : void 0;
24927
+ const resolvedMarket = resolveMarketFromVenueMarkets(venueMarkets, market.id);
24928
+ const headerOutcomeItems = spreadHeaderOutcomeItems != null ? spreadHeaderOutcomeItems : resolveHeaderOutcomeItems(
24929
+ (_a = resolvedMarket == null ? void 0 : resolvedMarket.venueMarkets) != null ? _a : [market],
24930
+ market,
24931
+ resolveSportsMarketCardVariant(market)
24932
+ );
24933
+ return headerOutcomeItems.flatMap((item) => {
24934
+ const outcome = market.venueMarketOutcomes.find((candidate) => candidate.id === item.id);
24935
+ return outcome ? [outcome] : [];
24936
+ });
24937
+ };
24938
+ var resolveSelectedOutcomeSide = ({
24939
+ displayedOutcomes,
24940
+ selectedOutcomeId
24941
+ }) => {
24942
+ const selectedOutcomeIndex = displayedOutcomes.findIndex(
24943
+ (outcome) => outcome.id === selectedOutcomeId
24944
+ );
24945
+ if (selectedOutcomeIndex === 0) return "left";
24946
+ if (selectedOutcomeIndex === 1) return "right";
24560
24947
  return null;
24561
24948
  };
24949
+ var resolveOutcomeBySide = (displayedOutcomes, side) => {
24950
+ var _a;
24951
+ return (_a = displayedOutcomes[side === "right" ? 1 : 0]) != null ? _a : displayedOutcomes[0];
24952
+ };
24562
24953
  var SportsMarketCard = ({
24563
24954
  group,
24564
24955
  venueMarkets,
@@ -24571,11 +24962,11 @@ var SportsMarketCard = ({
24571
24962
  midpointsResult
24572
24963
  }) => {
24573
24964
  var _a, _b, _c, _d, _e, _f, _g;
24574
- const labels = (0, import_hooks64.useLabels)();
24965
+ const labels = (0, import_hooks65.useLabels)();
24575
24966
  const {
24576
24967
  formatting: { formatCompactCurrency }
24577
- } = (0, import_hooks64.useSdkUiConfig)();
24578
- const tradingContext = (0, import_hooks64.useEventTradingContext)();
24968
+ } = (0, import_hooks65.useSdkUiConfig)();
24969
+ const tradingContext = (0, import_hooks65.useEventTradingContext)();
24579
24970
  const slide = (0, import_react40.useMemo)(() => buildSportsSlideFromGroup(group), [group]);
24580
24971
  const [selectedLineIndex, setSelectedLineIndex] = (0, import_react40.useState)(slide.defaultStopIndex);
24581
24972
  const combinedMoneylineMarkets = (0, import_react40.useMemo)(
@@ -24616,7 +25007,7 @@ var SportsMarketCard = ({
24616
25007
  const justOpened = isExpanded && !wasExpandedRef.current;
24617
25008
  wasExpandedRef.current = isExpanded;
24618
25009
  if (!justOpened || !activeMarket) return;
24619
- if ((0, import_hooks64.resolveMarketTradingState)(activeMarket).isTradingDisabled) return;
25010
+ if ((0, import_hooks65.resolveMarketTradingState)(activeMarket).isTradingDisabled) return;
24620
25011
  const selectedOutcomeId = tradingContext == null ? void 0 : tradingContext.selectedOutcomeId;
24621
25012
  const hasInScopeOutcome = selectedOutcomeId != null && activeMarket.venueMarketOutcomes.some((outcome) => outcome.id === selectedOutcomeId);
24622
25013
  if (hasInScopeOutcome) return;
@@ -24676,69 +25067,46 @@ var SportsMarketCard = ({
24676
25067
  });
24677
25068
  }, [combinedMoneylineMarkets, isCombinedMoneylineGroup, midpointsResult]);
24678
25069
  const spreadHeaderOutcomeItems = (0, import_react40.useMemo)(() => {
24679
- var _a2;
24680
25070
  if (slide.kind !== "spread" || !activeMarket) return void 0;
24681
- const outcomes = (_a2 = activeMarket.venueMarketOutcomes) != null ? _a2 : [];
24682
- const lineValue = activeMarket.lineValue;
24683
- if (outcomes.length < 2 || lineValue == null) return void 0;
24684
- const { favored, dog } = resolveSpreadOutcomeTeamNames(activeMarket, group.markets);
24685
- if (!favored && !dog) return void 0;
24686
- const magnitude = Math.abs(lineValue);
24687
- const formatLine = (value) => `${value > 0 ? "+" : "\u2212"}${Number.isInteger(magnitude) ? String(magnitude) : magnitude.toFixed(1)}`;
24688
- return [
24689
- { index: 0, name: favored, signedLine: -magnitude },
24690
- { index: 1, name: dog, signedLine: magnitude }
24691
- ].flatMap(({ index, name, signedLine }) => {
24692
- var _a3;
24693
- const outcome = outcomes[index];
24694
- if (!outcome) return [];
24695
- const label2 = name != null ? name : outcome.label.trim();
24696
- const probability = midpointsResult == null ? void 0 : getDisplayOutcomePrice({
24697
- outcomeId: outcome.id,
24698
- outcomeLabel: outcome.label,
24699
- bestMidpointsByOutcomeId: (_a3 = midpointsResult.bestMidpointsByOutcomeId) != null ? _a3 : midpointsResult.prices
24700
- });
24701
- return [
24702
- {
24703
- id: outcome.id,
24704
- label: label2,
24705
- title: label2,
24706
- lineLabel: formatLine(signedLine),
24707
- probability,
24708
- isPriceLoading: (midpointsResult == null ? void 0 : midpointsResult.isLoading) === true && probability == null,
24709
- tone: index === 0 ? "positive" : "negative",
24710
- variant: "line",
24711
- venue: activeMarket.venue
24712
- }
24713
- ];
25071
+ return resolveSpreadHeaderOutcomeItems({
25072
+ market: activeMarket,
25073
+ groupMarkets: group.markets,
25074
+ midpointsResult
24714
25075
  });
24715
25076
  }, [slide.kind, activeMarket, group.markets, midpointsResult]);
24716
25077
  const headerOutcomeItemsOverride = combinedMoneylineHeaderOutcomeItems != null ? combinedMoneylineHeaderOutcomeItems : spreadHeaderOutcomeItems;
24717
25078
  const headerOutcomeVariant = isCombinedMoneylineGroup ? "outcome" : resolveSportsMarketCardVariant(activeMarket);
24718
25079
  const handleLineSelect = (index) => {
24719
- var _a2, _b2;
24720
- const previousMarket = activeMarket;
25080
+ var _a2, _b2, _c2;
25081
+ const targetMarket = (_a2 = slide.stops[index]) == null ? void 0 : _a2.market;
25082
+ if (!targetMarket) return;
25083
+ 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;
25084
+ const selectedMarketIsInGroup = selectedMarket != null && group.markets.some((market) => market.id === selectedMarket.id);
25085
+ const selectedSide = selectedMarket ? resolveSelectedOutcomeSide({
25086
+ displayedOutcomes: resolveDisplayedOutcomes({
25087
+ market: selectedMarket,
25088
+ venueMarkets,
25089
+ groupMarkets: group.markets,
25090
+ useSpreadOverride: slide.kind === "spread" && selectedMarketIsInGroup
25091
+ }),
25092
+ selectedOutcomeId: tradingContext == null ? void 0 : tradingContext.selectedOutcomeId
25093
+ }) : null;
25094
+ const targetDisplayedOutcomes = resolveDisplayedOutcomes({
25095
+ market: targetMarket,
25096
+ venueMarkets,
25097
+ groupMarkets: group.markets,
25098
+ useSpreadOverride: slide.kind === "spread"
25099
+ });
25100
+ const nextOutcome = resolveOutcomeBySide(targetDisplayedOutcomes, selectedSide != null ? selectedSide : "left");
24721
25101
  setSelectedLineIndex(index);
24722
- const market = (_a2 = slide.stops[index]) == null ? void 0 : _a2.market;
24723
- if (!market) return;
24724
- const previousOutcomeIndex = previousMarket ? previousMarket.venueMarketOutcomes.findIndex(
24725
- (outcome) => outcome.id === (tradingContext == null ? void 0 : tradingContext.selectedOutcomeId)
24726
- ) : -1;
24727
- const previousOutcome = previousOutcomeIndex >= 0 ? previousMarket == null ? void 0 : previousMarket.venueMarketOutcomes[previousOutcomeIndex] : void 0;
24728
- const previousOutcomeSide = previousOutcome ? resolveSportsLineOutcomeSide(previousOutcome) : null;
24729
- const matchingSideOutcomes = previousOutcomeSide ? market.venueMarketOutcomes.filter(
24730
- (outcome) => resolveSportsLineOutcomeSide(outcome) === previousOutcomeSide
24731
- ) : [];
24732
- const matchingSideOutcome = matchingSideOutcomes.length === 1 ? matchingSideOutcomes[0] : void 0;
24733
- const nextOutcome = (_b2 = matchingSideOutcome != null ? matchingSideOutcome : previousOutcomeIndex >= 0 ? market.venueMarketOutcomes[previousOutcomeIndex] : void 0) != null ? _b2 : market.venueMarketOutcomes[0];
24734
25102
  if (nextOutcome) {
24735
- tradingContext == null ? void 0 : tradingContext.selectMarketAndOutcome(market.id, nextOutcome.id);
25103
+ tradingContext == null ? void 0 : tradingContext.selectMarketAndOutcome(targetMarket.id, nextOutcome.id);
24736
25104
  onOutcomeSelect == null ? void 0 : onOutcomeSelect(group.id, {
24737
- marketId: market.id,
25105
+ marketId: targetMarket.id,
24738
25106
  outcomeId: nextOutcome.id
24739
25107
  });
24740
25108
  } else {
24741
- tradingContext == null ? void 0 : tradingContext.selectMarket(market.id, market);
25109
+ tradingContext == null ? void 0 : tradingContext.selectMarket(targetMarket.id, targetMarket);
24742
25110
  }
24743
25111
  };
24744
25112
  return /* @__PURE__ */ (0, import_jsx_runtime161.jsx)(
@@ -24761,7 +25129,7 @@ var SportsMarketCard = ({
24761
25129
  stops: slide.stops.map((stop) => ({
24762
25130
  value: stop.value,
24763
25131
  venues: stop.venues,
24764
- disabled: stop.market.status !== import_hooks64.MarketStatus.open
25132
+ disabled: stop.market.status !== import_hooks65.MarketStatus.open
24765
25133
  })),
24766
25134
  selectedIndex: selectedLineIndex,
24767
25135
  onSelect: handleLineSelect,
@@ -24848,7 +25216,7 @@ var SportsTabButton = ({
24848
25216
  );
24849
25217
  };
24850
25218
  var SportsMarketsLoadingState = () => {
24851
- const labels = (0, import_hooks65.useLabels)();
25219
+ const labels = (0, import_hooks66.useLabels)();
24852
25220
  return /* @__PURE__ */ (0, import_jsx_runtime162.jsxs)(
24853
25221
  "div",
24854
25222
  {
@@ -24886,13 +25254,13 @@ var SportsMarkets = ({
24886
25254
  midpointsResult
24887
25255
  }) => {
24888
25256
  var _a, _b;
24889
- const labels = (0, import_hooks65.useLabels)();
24890
- const tradingContext = (0, import_hooks65.useEventTradingContext)();
25257
+ const labels = (0, import_hooks66.useLabels)();
25258
+ const tradingContext = (0, import_hooks66.useEventTradingContext)();
24891
25259
  const hasAggKey = Boolean(event.aggKey);
24892
- const gameMarketsQuery = (0, import_hooks65.useVenueMarkets)({
25260
+ const gameMarketsQuery = (0, import_hooks66.useVenueMarkets)({
24893
25261
  aggKey: event.aggKey ? [event.aggKey] : void 0,
24894
25262
  limit: 100,
24895
- status: import_hooks65.MarketStatus.open,
25263
+ status: import_hooks66.MarketStatus.open,
24896
25264
  enabled: hasAggKey
24897
25265
  });
24898
25266
  const {
@@ -24928,7 +25296,7 @@ var SportsMarkets = ({
24928
25296
  const [stableMarketsByTab, setStableMarketsByTab] = (0, import_react41.useState)({});
24929
25297
  const activeTabLabel = resolveSportsSectionLabel(labels, activeTab);
24930
25298
  const sectionFilters = resolveSportsSectionFilters(activeTab);
24931
- const sectionMarketsQuery = (0, import_hooks65.useVenueMarkets)({
25299
+ const sectionMarketsQuery = (0, import_hooks66.useVenueMarkets)({
24932
25300
  aggKey: event.aggKey ? [event.aggKey] : void 0,
24933
25301
  sportsMarketType: sectionFilters.sportsMarketType,
24934
25302
  period: sectionFilters.period,
@@ -24938,7 +25306,7 @@ var SportsMarkets = ({
24938
25306
  // heavy tab (e.g. "Other" spans other/team_props/player_props/specials/
24939
25307
  // completion — hundreds of markets on prop-rich events) from ~15 calls to 1-3.
24940
25308
  limit: 100,
24941
- status: import_hooks65.MarketStatus.open,
25309
+ status: import_hooks66.MarketStatus.open,
24942
25310
  enabled: hasAggKey
24943
25311
  });
24944
25312
  const {
@@ -25024,7 +25392,7 @@ var SportsMarkets = ({
25024
25392
  return;
25025
25393
  }
25026
25394
  setExpandedGroupId(groupId);
25027
- if ((0, import_hooks65.resolveMarketTradingState)(market).isTradingDisabled) return;
25395
+ if ((0, import_hooks66.resolveMarketTradingState)(market).isTradingDisabled) return;
25028
25396
  if (market.id !== (tradingContext == null ? void 0 : tradingContext.selectedMarketId)) {
25029
25397
  tradingContext == null ? void 0 : tradingContext.selectMarket(market.id, market);
25030
25398
  }
@@ -25128,7 +25496,7 @@ var SportsEventMarketPage = ({
25128
25496
  sectionMarketsByKey
25129
25497
  });
25130
25498
  }, [event, sectionMarketsByKey]);
25131
- const eventTradingState = (0, import_react42.useMemo)(() => (0, import_hooks66.resolveEventTradingState)(composedEvent), [composedEvent]);
25499
+ const eventTradingState = (0, import_react42.useMemo)(() => (0, import_hooks67.resolveEventTradingState)(composedEvent), [composedEvent]);
25132
25500
  const hasSportsSections = (0, import_react42.useMemo)(
25133
25501
  () => resolveVisibleSportsSectionTabs(event).length > 0,
25134
25502
  [event]
@@ -25138,12 +25506,12 @@ var SportsEventMarketPage = ({
25138
25506
  });
25139
25507
  const {
25140
25508
  trading: { executionMode: configuredExecutionMode }
25141
- } = (0, import_hooks66.useSdkUiConfig)();
25509
+ } = (0, import_hooks67.useSdkUiConfig)();
25142
25510
  const resolvedExecutionMode = executionMode != null ? executionMode : configuredExecutionMode;
25143
25511
  const [isMobileTradeOpen, setIsMobileTradeOpen] = (0, import_react42.useState)(false);
25144
25512
  const isMobileViewport = useIsMobileEventMarketViewport(SPORTS_EVENT_MARKET_MEDIA_QUERY);
25145
- const tradingContext = (0, import_hooks66.useEventTradingContext)();
25146
- const midpointsResult = (0, import_hooks66.useMidpoints)(composedEvent.venueMarkets);
25513
+ const tradingContext = (0, import_hooks67.useEventTradingContext)();
25514
+ const midpointsResult = (0, import_hooks67.useMidpoints)(composedEvent.venueMarkets);
25147
25515
  const internalResolvedClaim = useResolvedMarketClaim({
25148
25516
  market: eventTradingState.primaryMarket,
25149
25517
  enabled: eventTradingState.kind === "resolved",
@@ -25155,7 +25523,7 @@ var SportsEventMarketPage = ({
25155
25523
  (0, import_react42.useEffect)(() => {
25156
25524
  return () => {
25157
25525
  var _a;
25158
- (_a = setTradeSideRef.current) == null ? void 0 : _a.call(setTradeSideRef, import_hooks66.TradeSide.Buy);
25526
+ (_a = setTradeSideRef.current) == null ? void 0 : _a.call(setTradeSideRef, import_hooks67.TradeSide.Buy);
25159
25527
  };
25160
25528
  }, []);
25161
25529
  const handleSectionMarketsChange = (0, import_react42.useCallback)(
@@ -25327,22 +25695,22 @@ var EventMarketPageContent = ({
25327
25695
  resolvedClaim,
25328
25696
  onBeforePrimaryAction
25329
25697
  }) => {
25330
- const eventTradingState = (0, import_react43.useMemo)(() => (0, import_hooks67.resolveEventTradingState)(event), [event]);
25698
+ const eventTradingState = (0, import_react43.useMemo)(() => (0, import_hooks68.resolveEventTradingState)(event), [event]);
25331
25699
  const stickyOrderPanelState = resolveEventMarketPageStickyState({
25332
25700
  stickyOrderPanel
25333
25701
  });
25334
25702
  const {
25335
25703
  trading: { executionMode: configuredExecutionMode }
25336
- } = (0, import_hooks67.useSdkUiConfig)();
25704
+ } = (0, import_hooks68.useSdkUiConfig)();
25337
25705
  const resolvedExecutionMode = executionMode != null ? executionMode : configuredExecutionMode;
25338
25706
  const [isMobileTradeOpen, setIsMobileTradeOpen] = (0, import_react43.useState)(false);
25339
25707
  const isMobileViewport = useIsMobileEventMarketViewport();
25340
- const tradingContext = (0, import_hooks67.useEventTradingContext)();
25708
+ const tradingContext = (0, import_hooks68.useEventTradingContext)();
25341
25709
  const eventDetailVenueMarkets = (0, import_react43.useMemo)(
25342
25710
  () => normalizeVenueMarketCluster(event.venueMarkets),
25343
25711
  [event.venueMarkets]
25344
25712
  );
25345
- const midpointsResult = (0, import_hooks67.useMidpoints)(eventDetailVenueMarkets);
25713
+ const midpointsResult = (0, import_hooks68.useMidpoints)(eventDetailVenueMarkets);
25346
25714
  const internalResolvedClaim = useResolvedMarketClaim({
25347
25715
  market: eventTradingState.primaryMarket,
25348
25716
  enabled: eventTradingState.kind === "resolved",
@@ -25354,7 +25722,7 @@ var EventMarketPageContent = ({
25354
25722
  (0, import_react43.useEffect)(() => {
25355
25723
  return () => {
25356
25724
  var _a;
25357
- (_a = setTradeSideRef.current) == null ? void 0 : _a.call(setTradeSideRef, import_hooks67.TradeSide.Buy);
25725
+ (_a = setTradeSideRef.current) == null ? void 0 : _a.call(setTradeSideRef, import_hooks68.TradeSide.Buy);
25358
25726
  };
25359
25727
  }, []);
25360
25728
  if (!event.venueMarkets.length) {
@@ -25488,14 +25856,14 @@ var EventMarketPage = (props) => {
25488
25856
  var _a;
25489
25857
  const {
25490
25858
  features: { showSportsMarkets }
25491
- } = (0, import_hooks67.useSdkUiConfig)();
25859
+ } = (0, import_hooks68.useSdkUiConfig)();
25492
25860
  const hasEventProp = "event" in props && !!props.event;
25493
25861
  const {
25494
25862
  event: fetchedEvent,
25495
25863
  error: eventError,
25496
25864
  isLoading: isFetchingEvent,
25497
25865
  isEnriching
25498
- } = (0, import_hooks67.useEnrichedVenueEvent)({
25866
+ } = (0, import_hooks68.useEnrichedVenueEvent)({
25499
25867
  eventId: hasEventProp ? "" : (_a = props.eventId) != null ? _a : "",
25500
25868
  enabled: !props.isLoading && !hasEventProp && !!props.eventId
25501
25869
  });
@@ -25682,14 +26050,14 @@ var HomeSearchResults = ({
25682
26050
  onEventClick,
25683
26051
  onMarketClick
25684
26052
  }) => {
25685
- const labels = (0, import_hooks68.useLabels)();
25686
- const { search: searchConfig } = (0, import_hooks68.useSdkUiConfig)();
25687
- const { disabledVenues } = (0, import_hooks68.useAppConfig)();
26053
+ const labels = (0, import_hooks69.useLabels)();
26054
+ const { search: searchConfig } = (0, import_hooks69.useSdkUiConfig)();
26055
+ const { disabledVenues } = (0, import_hooks69.useAppConfig)();
25688
26056
  const [activeVenueTabValue, setActiveVenueTabValue] = (0, import_react46.useState)("all");
25689
26057
  const eventListTabs = useEventListTabs();
25690
26058
  const { headerRef, titleRef, shouldUseSelectOverflow } = useEventListTabsHeaderOverflow(eventListTabs);
25691
26059
  const visibleVenues = (0, import_react46.useMemo)(
25692
- () => disabledVenues.length === 0 ? void 0 : (0, import_hooks68.getVisibleVenueIdsByConfig)(import_sdk23.VENUES, disabledVenues),
26060
+ () => disabledVenues.length === 0 ? void 0 : (0, import_hooks69.getVisibleVenueIdsByConfig)(import_sdk23.VENUES, disabledVenues),
25693
26061
  [disabledVenues]
25694
26062
  );
25695
26063
  const activeVenueTab = (0, import_react46.useMemo)(() => {
@@ -25707,7 +26075,7 @@ var HomeSearchResults = ({
25707
26075
  hasNextPage,
25708
26076
  isFetchingNextPage,
25709
26077
  isPlaceholderData
25710
- } = (0, import_hooks68.useSearch)({
26078
+ } = (0, import_hooks69.useSearch)({
25711
26079
  q: query,
25712
26080
  type: "events",
25713
26081
  categoryIds: activeTabValue === ALL_CATEGORIES_TAB_VALUE ? void 0 : activeCategoryTab == null ? void 0 : activeCategoryTab.categoryIds,
@@ -25735,7 +26103,7 @@ var HomeSearchResults = ({
25735
26103
  const visibleMidpointVenueMarketIds = (0, import_react46.useMemo)(() => {
25736
26104
  return collectVisibleVenueMarketIds(visibleVenueMarkets);
25737
26105
  }, [visibleVenueMarkets]);
25738
- const { midpointRows: sharedMidpointRows, isLoading: isSharedMidpointsLoading } = (0, import_hooks68.useVenueMarketMidpoints)({
26106
+ const { midpointRows: sharedMidpointRows, isLoading: isSharedMidpointsLoading } = (0, import_hooks69.useVenueMarketMidpoints)({
25739
26107
  venueMarketIds: visibleMidpointVenueMarketIds,
25740
26108
  enabled: visibleMidpointVenueMarketIds.length > 0
25741
26109
  });
@@ -25884,7 +26252,7 @@ var HomePage = ({
25884
26252
  stickyOrderPanel
25885
26253
  }) => {
25886
26254
  var _a, _b, _c, _d;
25887
- const labels = (0, import_hooks68.useLabels)();
26255
+ const labels = (0, import_hooks69.useLabels)();
25888
26256
  const {
25889
26257
  search: {
25890
26258
  value: searchValue,
@@ -25894,8 +26262,8 @@ var HomePage = ({
25894
26262
  onSelect: onSelectEventInternal
25895
26263
  },
25896
26264
  trading: { executionMode }
25897
- } = (0, import_hooks68.useSdkUiConfig)();
25898
- const { capture, consume } = (0, import_hooks68.useEventListState)();
26265
+ } = (0, import_hooks69.useSdkUiConfig)();
26266
+ const { capture, consume } = (0, import_hooks69.useEventListState)();
25899
26267
  const [snapshot] = (0, import_react46.useState)(() => consume());
25900
26268
  const eventListStateRef = (0, import_react46.useRef)(null);
25901
26269
  const handleSelectEvent = (0, import_react46.useCallback)(
@@ -25965,7 +26333,7 @@ var HomePage = ({
25965
26333
  }, [isShowingAllResults, normalizedSearchValue, selectedEvent]);
25966
26334
  const resolvedSelectedEvent = selectedEvent != null ? selectedEvent : stickySelectedEvent;
25967
26335
  const resolvedAllCategoryTabLabel = allCategoryTabLabel === DEFAULT_ALL_CATEGORY_TAB_LABEL ? labels.home.trending : allCategoryTabLabel;
25968
- const { categories } = (0, import_hooks68.useCategories)({
26336
+ const { categories } = (0, import_hooks69.useCategories)({
25969
26337
  limit: categoriesLimit,
25970
26338
  enabled: !hasCustomTabs
25971
26339
  });
@@ -26175,7 +26543,7 @@ var HomePage = ({
26175
26543
  HomePage.displayName = "HomePage";
26176
26544
 
26177
26545
  // src/pages/user-profile/index.tsx
26178
- var import_hooks75 = require("@agg-build/hooks");
26546
+ var import_hooks76 = require("@agg-build/hooks");
26179
26547
  var import_sdk25 = require("@agg-build/sdk");
26180
26548
  var import_dayjs9 = __toESM(require("dayjs"));
26181
26549
  var import_react48 = require("react");
@@ -26201,7 +26569,7 @@ var formatChainIdLabel = (chainId) => {
26201
26569
  };
26202
26570
 
26203
26571
  // src/pages/user-profile/components/available-balance-card.tsx
26204
- var import_hooks69 = require("@agg-build/hooks");
26572
+ var import_hooks70 = require("@agg-build/hooks");
26205
26573
  var import_jsx_runtime166 = require("react/jsx-runtime");
26206
26574
  var BASE_URL = "https://assets.snagsolutions.io";
26207
26575
  var CHAIN_ID_TO_ICON_URL = {
@@ -26257,7 +26625,7 @@ var AvailableBalanceCard = ({
26257
26625
  isLoading = false,
26258
26626
  className
26259
26627
  }) => {
26260
- const labels = (0, import_hooks69.useLabels)();
26628
+ const labels = (0, import_hooks70.useLabels)();
26261
26629
  const balanceLabels = labels.userProfile.balance;
26262
26630
  const resolvedLabel = label2 != null ? label2 : balanceLabels.availableBalance;
26263
26631
  const hasPaperBalance = chains.some(isPaperChain);
@@ -26417,7 +26785,7 @@ var AvailableBalanceCard = ({
26417
26785
  AvailableBalanceCard.displayName = "AvailableBalanceCard";
26418
26786
 
26419
26787
  // src/pages/user-profile/components/claim-activity-breakdown-modal.tsx
26420
- var import_hooks70 = require("@agg-build/hooks");
26788
+ var import_hooks71 = require("@agg-build/hooks");
26421
26789
  var import_sdk24 = require("@agg-build/sdk");
26422
26790
  var import_jsx_runtime167 = require("react/jsx-runtime");
26423
26791
  var CLAIM_VENUE_LABELS = {
@@ -26436,7 +26804,7 @@ var ClaimActivityBreakdownModal = ({
26436
26804
  onTransactionSelect
26437
26805
  }) => {
26438
26806
  var _a;
26439
- const labels = (0, import_hooks70.useLabels)();
26807
+ const labels = (0, import_hooks71.useLabels)();
26440
26808
  return /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(
26441
26809
  Modal,
26442
26810
  {
@@ -26545,7 +26913,7 @@ var ClaimActivityBreakdownModal = ({
26545
26913
  };
26546
26914
 
26547
26915
  // src/pages/user-profile/components/positions-activity.tsx
26548
- var import_hooks73 = require("@agg-build/hooks");
26916
+ var import_hooks74 = require("@agg-build/hooks");
26549
26917
  var import_react47 = require("react");
26550
26918
 
26551
26919
  // src/pages/user-profile/user-profile.constants.ts
@@ -26595,17 +26963,19 @@ var parsePercentLabel = (label2) => {
26595
26963
  const parsed = Number(match[1].replace(/,/g, ""));
26596
26964
  return Number.isFinite(parsed) ? parsed : null;
26597
26965
  };
26598
- var formatCurrency = (value) => {
26966
+ var formatCurrency = (value, formatCurrencyOverride) => {
26599
26967
  if (!isFiniteNumber(value)) return missingLabel;
26968
+ if (formatCurrencyOverride) return formatCurrencyOverride(value);
26600
26969
  return usdFormatter.format(value);
26601
26970
  };
26602
- var formatSignedCurrency = (value) => {
26971
+ var formatSignedCurrency = (value, formatCurrencyOverride) => {
26603
26972
  if (!isFiniteNumber(value)) return missingLabel;
26604
- if (value === 0) return usdFormatter.format(0);
26605
- return `${value > 0 ? "+" : "-"}${usdFormatter.format(Math.abs(value))}`;
26973
+ if (value === 0) return formatCurrency(0, formatCurrencyOverride);
26974
+ return `${value > 0 ? "+" : "-"}${formatCurrency(Math.abs(value), formatCurrencyOverride)}`;
26606
26975
  };
26607
- var formatPriceCents2 = (value) => {
26976
+ var formatPriceCents2 = (value, formatPrice) => {
26608
26977
  if (!isFiniteNumber(value)) return missingLabel;
26978
+ if (formatPrice) return formatPrice(value);
26609
26979
  return `${Math.round(value * 100)}\xA2`;
26610
26980
  };
26611
26981
  var formatSignedPercent = (value) => {
@@ -26700,7 +27070,8 @@ var getPositionTone = (value) => {
26700
27070
  if (!isFiniteNumber(value) || value === 0) return "neutral";
26701
27071
  return value > 0 ? "positive" : "negative";
26702
27072
  };
26703
- var toPositionRowViewModel = (position, labels = defaultLabels2) => {
27073
+ var toPositionRowViewModel = (position, labels = defaultLabels2, formatters = {}) => {
27074
+ const { formatCurrency: currency, formatPrice: price } = formatters;
26704
27075
  const positionStatus = resolvePositionStatus(position);
26705
27076
  const currentValue = getCurrentValue(position);
26706
27077
  const currentPnl = getPnlValue(position, currentValue);
@@ -26718,20 +27089,20 @@ var toPositionRowViewModel = (position, labels = defaultLabels2) => {
26718
27089
  resolutionLabel: position.resolutionLabel || position.outcomeLabel || missingLabel,
26719
27090
  venueShareBreakdown: position.venueShareBreakdown,
26720
27091
  totalTraded: {
26721
- primaryLabel: formatCurrency(getTotalTradedValue(position)),
26722
- averageLabel: `${labels.avgPrefix} ${formatPriceCents2(getAveragePrice(position))}`
27092
+ primaryLabel: formatCurrency(getTotalTradedValue(position), currency),
27093
+ averageLabel: `${labels.avgPrefix} ${formatPriceCents2(getAveragePrice(position), price)}`
26723
27094
  },
26724
27095
  currentValue: {
26725
- primaryLabel: formatCurrency(currentValue),
26726
- deltaLabel: formatSignedCurrency(currentPnl),
26727
- priceLabel: `${labels.nowPrefix} ${formatPriceCents2(getCurrentPrice(position))}`,
27096
+ primaryLabel: formatCurrency(currentValue, currency),
27097
+ deltaLabel: formatSignedCurrency(currentPnl, currency),
27098
+ priceLabel: `${labels.nowPrefix} ${formatPriceCents2(getCurrentPrice(position), price)}`,
26728
27099
  percentLabel: formatSignedPercent(currentPercent),
26729
27100
  tone: getPositionTone(currentPnl)
26730
27101
  },
26731
27102
  payout: {
26732
- primaryLabel: formatCurrency(finalPayout),
26733
- deltaLabel: formatSignedCurrency(payoutPnl),
26734
- priceLabel: `${labels.finalPrefix} ${formatPriceCents2(getFinalPrice(position))}`,
27103
+ primaryLabel: formatCurrency(finalPayout, currency),
27104
+ deltaLabel: formatSignedCurrency(payoutPnl, currency),
27105
+ priceLabel: `${labels.finalPrefix} ${formatPriceCents2(getFinalPrice(position), price)}`,
26735
27106
  percentLabel: formatSignedPercent(payoutPercent),
26736
27107
  tone: getPositionTone(payoutPnl)
26737
27108
  },
@@ -27333,11 +27704,24 @@ var EmptyState = ({ title: title2, description, className }) => {
27333
27704
  EmptyState.displayName = "EmptyState";
27334
27705
 
27335
27706
  // src/pages/user-profile/components/open-order-row.tsx
27336
- var import_hooks71 = require("@agg-build/hooks");
27707
+ var import_hooks72 = require("@agg-build/hooks");
27337
27708
  var import_jsx_runtime170 = require("react/jsx-runtime");
27338
27709
  var shouldUseNativeLinkNavigation2 = (event) => {
27339
27710
  return event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button === 1;
27340
27711
  };
27712
+ var CANCELLABLE_LIMIT_ORDER_STATUSES = /* @__PURE__ */ new Set([
27713
+ "submitted",
27714
+ "open",
27715
+ "partially_filled_open",
27716
+ "cancel_pending"
27717
+ ]);
27718
+ var canCancelOpenOrder = (order) => {
27719
+ const status = order.status.trim().toLowerCase();
27720
+ if (status === "pending" && !order.dagRunId) return true;
27721
+ const isLimitOrder = order.orderType === "limit" || order.limitPriceLabel != null;
27722
+ if (!isLimitOrder) return false;
27723
+ return CANCELLABLE_LIMIT_ORDER_STATUSES.has(status);
27724
+ };
27341
27725
  var OpenOrderRow = ({
27342
27726
  order,
27343
27727
  href,
@@ -27352,7 +27736,7 @@ var OpenOrderRow = ({
27352
27736
  expirationHeader
27353
27737
  }) => {
27354
27738
  var _a, _b, _c, _d;
27355
- const labels = (0, import_hooks71.useLabels)().userProfile.openOrders;
27739
+ const labels = (0, import_hooks72.useLabels)().userProfile.openOrders;
27356
27740
  const resolvedCancelLabel = cancelLabel != null ? cancelLabel : labels.cancel;
27357
27741
  const resolvedCancelAriaLabel = cancelAriaLabel != null ? cancelAriaLabel : labels.cancelOrderAria(order.id);
27358
27742
  const resolvedLimitPriceHeader = limitPriceHeader != null ? limitPriceHeader : labels.limitPriceHeader;
@@ -27373,9 +27757,7 @@ var OpenOrderRow = ({
27373
27757
  event.stopPropagation();
27374
27758
  onCancel == null ? void 0 : onCancel(order);
27375
27759
  };
27376
- const status = order.status.toLowerCase();
27377
- const isLimitOrder = order.orderType === "limit";
27378
- const canCancel = status === "open" || status === "partially_filled_open" || status === "cancel_pending" || status === "submitted" && isLimitOrder || status === "pending" && !order.dagRunId;
27760
+ const canCancel = canCancelOpenOrder(order);
27379
27761
  const Wrapper = href ? "a" : "div";
27380
27762
  const wrapperProps = href ? {
27381
27763
  href,
@@ -27407,7 +27789,7 @@ var OpenOrderRow = ({
27407
27789
  /* @__PURE__ */ (0, import_jsx_runtime170.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_runtime170.jsx)(
27408
27790
  RemoteImage,
27409
27791
  {
27410
- src: (0, import_hooks71.optimizedImageUrl)(order.thumbnailSrc, 60),
27792
+ src: (0, import_hooks72.optimizedImageUrl)(order.thumbnailSrc, 60),
27411
27793
  alt: "",
27412
27794
  className: "h-full w-full rounded-agg-sm object-cover"
27413
27795
  }
@@ -27462,7 +27844,7 @@ var OpenOrderRow = ({
27462
27844
  OpenOrderRow.displayName = "OpenOrderRow";
27463
27845
 
27464
27846
  // src/pages/user-profile/components/position-row.tsx
27465
- var import_hooks72 = require("@agg-build/hooks");
27847
+ var import_hooks73 = require("@agg-build/hooks");
27466
27848
  var import_jsx_runtime171 = require("react/jsx-runtime");
27467
27849
  var shouldUseNativeLinkNavigation3 = (event) => {
27468
27850
  return event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button === 1;
@@ -27600,12 +27982,17 @@ var PositionRow = ({
27600
27982
  onClaim,
27601
27983
  isClaiming = false
27602
27984
  }) => {
27603
- const labels = (0, import_hooks72.useLabels)().userProfile.positions;
27604
- const model = toPositionRowViewModel(position, {
27605
- avgPrefix: labels.avgPrefix,
27606
- nowPrefix: labels.nowPrefix,
27607
- finalPrefix: labels.finalPrefix
27608
- });
27985
+ const labels = (0, import_hooks73.useLabels)().userProfile.positions;
27986
+ const { formatCurrency: formatCurrency2, formatPrice } = (0, import_hooks73.useAggUiConfig)().formatting;
27987
+ const model = toPositionRowViewModel(
27988
+ position,
27989
+ {
27990
+ avgPrefix: labels.avgPrefix,
27991
+ nowPrefix: labels.nowPrefix,
27992
+ finalPrefix: labels.finalPrefix
27993
+ },
27994
+ { formatCurrency: formatCurrency2, formatPrice }
27995
+ );
27609
27996
  const isClosed = (variant != null ? variant : model.bucket) === "closed";
27610
27997
  const handleClaim = (event) => {
27611
27998
  event.preventDefault();
@@ -27654,7 +28041,7 @@ var PositionRow = ({
27654
28041
  /* @__PURE__ */ (0, import_jsx_runtime171.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_runtime171.jsx)(
27655
28042
  RemoteImage,
27656
28043
  {
27657
- src: (0, import_hooks72.optimizedImageUrl)(model.thumbnailSrc, 60),
28044
+ src: (0, import_hooks73.optimizedImageUrl)(model.thumbnailSrc, 60),
27658
28045
  alt: "",
27659
28046
  className: "h-full w-full rounded-agg-sm object-cover"
27660
28047
  }
@@ -27823,9 +28210,10 @@ var PositionsActivity = ({
27823
28210
  initialPositionFilter = "active",
27824
28211
  className
27825
28212
  }) => {
27826
- const userProfileLabels = (0, import_hooks73.useLabels)().userProfile;
28213
+ const userProfileLabels = (0, import_hooks74.useLabels)().userProfile;
27827
28214
  const positionsLabels = userProfileLabels.positions;
27828
28215
  const openOrdersLabels = userProfileLabels.openOrders;
28216
+ const { formatCurrency: formatCurrency2, formatPrice } = (0, import_hooks74.useAggUiConfig)().formatting;
27829
28217
  const tabItems = (0, import_react47.useMemo)(
27830
28218
  () => getTabItems(userProfileLabels.tabs, showOpenOrders),
27831
28219
  [showOpenOrders, userProfileLabels.tabs]
@@ -27904,14 +28292,25 @@ var PositionsActivity = ({
27904
28292
  title: position.title,
27905
28293
  thumbnailSrc: position.thumbnailSrc,
27906
28294
  metaPrimary: position.outcomeLabel,
27907
- metaSecondary: toPositionRowViewModel(position, {
27908
- avgPrefix: positionsLabels.avgPrefix,
27909
- nowPrefix: positionsLabels.nowPrefix,
27910
- finalPrefix: positionsLabels.finalPrefix
27911
- }).currentValue.primaryLabel,
28295
+ metaSecondary: toPositionRowViewModel(
28296
+ position,
28297
+ {
28298
+ avgPrefix: positionsLabels.avgPrefix,
28299
+ nowPrefix: positionsLabels.nowPrefix,
28300
+ finalPrefix: positionsLabels.finalPrefix
28301
+ },
28302
+ { formatCurrency: formatCurrency2, formatPrice }
28303
+ ).currentValue.primaryLabel,
27912
28304
  raw: position
27913
28305
  }));
27914
- }, [filteredPositions, isPositionsTab, positionsLabels, searchValue]);
28306
+ }, [
28307
+ filteredPositions,
28308
+ formatCurrency2,
28309
+ formatPrice,
28310
+ isPositionsTab,
28311
+ positionsLabels,
28312
+ searchValue
28313
+ ]);
27915
28314
  const handleSearchChange = (event) => {
27916
28315
  setSearchValue(event.target.value);
27917
28316
  };
@@ -28082,7 +28481,7 @@ var PositionsActivity = ({
28082
28481
  /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
28083
28482
  "img",
28084
28483
  {
28085
- src: (0, import_hooks73.optimizedImageUrl)(item.thumbnailSrc, 48),
28484
+ src: (0, import_hooks74.optimizedImageUrl)(item.thumbnailSrc, 48),
28086
28485
  alt: "",
28087
28486
  className: "size-12 shrink-0 rounded-agg-lg object-cover"
28088
28487
  }
@@ -28403,7 +28802,7 @@ var buildAggTxExplorerHref = (chainId, txHash) => {
28403
28802
  };
28404
28803
 
28405
28804
  // src/pages/user-profile/components/user-info-card.tsx
28406
- var import_hooks74 = require("@agg-build/hooks");
28805
+ var import_hooks75 = require("@agg-build/hooks");
28407
28806
 
28408
28807
  // src/primitives/conditional-wrapper.tsx
28409
28808
  var ConditionalWrapper = ({
@@ -28470,7 +28869,7 @@ var UserInfoCard = ({
28470
28869
  className
28471
28870
  }) => {
28472
28871
  var _a;
28473
- const labels = (0, import_hooks74.useLabels)();
28872
+ const labels = (0, import_hooks75.useLabels)();
28474
28873
  const wallets = (_a = user.connectedWallets) != null ? _a : [];
28475
28874
  const hasWallets = wallets.length > 0;
28476
28875
  return /* @__PURE__ */ (0, import_jsx_runtime175.jsxs)(
@@ -28486,7 +28885,7 @@ var UserInfoCard = ({
28486
28885
  /* @__PURE__ */ (0, import_jsx_runtime175.jsx)("div", { className: "agg-profile-avatar shrink-0", children: user.avatarUrl ? /* @__PURE__ */ (0, import_jsx_runtime175.jsx)(
28487
28886
  RemoteImage,
28488
28887
  {
28489
- src: (0, import_hooks74.optimizedImageUrl)(user.avatarUrl, 120),
28888
+ src: (0, import_hooks75.optimizedImageUrl)(user.avatarUrl, 120),
28490
28889
  alt: user.username,
28491
28890
  className: "h-20 w-20 rounded-full object-cover sm:h-[120px] sm:w-[120px]"
28492
28891
  }
@@ -29106,16 +29505,16 @@ var UserProfilePage = ({
29106
29505
  (0, import_react48.useEffect)(() => {
29107
29506
  setIsHydrated(true);
29108
29507
  }, []);
29109
- const { user: currentUser, isAuthenticated } = (0, import_hooks75.useAggAuthState)();
29110
- const { isDepositBlocked } = (0, import_hooks75.useGeoBlock)();
29111
- const balanceState = (0, import_hooks75.useAggBalance)();
29112
- const labels = (0, import_hooks75.useLabels)();
29508
+ const { user: currentUser, isAuthenticated } = (0, import_hooks76.useAggAuthState)();
29509
+ const { isDepositBlocked } = (0, import_hooks76.useGeoBlock)();
29510
+ const balanceState = (0, import_hooks76.useAggBalance)();
29511
+ const labels = (0, import_hooks76.useLabels)();
29113
29512
  const {
29114
29513
  features: { showLimitOrders },
29115
29514
  trading: { executionMode: configuredExecutionMode }
29116
- } = (0, import_hooks75.useSdkUiConfig)();
29117
- const client = (0, import_hooks75.useAggClient)();
29118
- const cancelOrderMutation = (0, import_hooks75.useCancelManagedOrder)();
29515
+ } = (0, import_hooks76.useSdkUiConfig)();
29516
+ const client = (0, import_hooks76.useAggClient)();
29517
+ const cancelOrderMutation = (0, import_hooks76.useCancelManagedOrder)();
29119
29518
  const toastContext = useOptionalToast();
29120
29519
  const [internalCancellingIds, setInternalCancellingIds] = (0, import_react48.useState)({});
29121
29520
  const { claim: startClaim, claimingKeys } = useClaimWinnings({
@@ -29136,13 +29535,13 @@ var UserProfilePage = ({
29136
29535
  const [selectedClaimActivity, setSelectedClaimActivity] = (0, import_react48.useState)(null);
29137
29536
  const resolvedExecutionMode = executionMode != null ? executionMode : configuredExecutionMode;
29138
29537
  const queryExecutionMode = resolvedExecutionMode === "paper" ? "paper" : void 0;
29139
- const activePositionsQuery = (0, import_hooks75.useExecutionPositions)({
29538
+ const activePositionsQuery = (0, import_hooks76.useExecutionPositions)({
29140
29539
  enabled: shouldUseHookData && isAuthenticated,
29141
29540
  status: "active",
29142
29541
  limit: 25,
29143
29542
  mode: queryExecutionMode
29144
29543
  });
29145
- const closedPositionsQuery = (0, import_hooks75.useExecutionPositions)({
29544
+ const closedPositionsQuery = (0, import_hooks76.useExecutionPositions)({
29146
29545
  enabled: shouldUseHookData && isAuthenticated,
29147
29546
  status: "closed",
29148
29547
  limit: 25,
@@ -29158,55 +29557,55 @@ var UserProfilePage = ({
29158
29557
  (0, import_react48.useEffect)(() => {
29159
29558
  setPositionFilter(initialPositionFilter);
29160
29559
  }, [initialPositionFilter]);
29161
- const ordersQuery = (0, import_hooks75.useExecutionOrders)({
29560
+ const ordersQuery = (0, import_hooks76.useExecutionOrders)({
29162
29561
  enabled: shouldUseHookData && isAuthenticated,
29163
29562
  limit: 25,
29164
29563
  mode: queryExecutionMode,
29165
29564
  refetchIntervalMs: 5e3
29166
29565
  });
29167
- const pendingOpenOrdersQuery = (0, import_hooks75.useExecutionOrders)({
29566
+ const pendingOpenOrdersQuery = (0, import_hooks76.useExecutionOrders)({
29168
29567
  enabled: shouldUseHookData && isAuthenticated && !openOrders,
29169
29568
  status: OPEN_ORDER_QUERY_STATUSES[0],
29170
29569
  limit: 25,
29171
29570
  mode: queryExecutionMode
29172
29571
  });
29173
- const signingOpenOrdersQuery = (0, import_hooks75.useExecutionOrders)({
29572
+ const signingOpenOrdersQuery = (0, import_hooks76.useExecutionOrders)({
29174
29573
  enabled: shouldUseHookData && isAuthenticated && !openOrders,
29175
29574
  status: OPEN_ORDER_QUERY_STATUSES[1],
29176
29575
  limit: 25,
29177
29576
  mode: queryExecutionMode
29178
29577
  });
29179
- const pendingBridgeOpenOrdersQuery = (0, import_hooks75.useExecutionOrders)({
29578
+ const pendingBridgeOpenOrdersQuery = (0, import_hooks76.useExecutionOrders)({
29180
29579
  enabled: shouldUseHookData && isAuthenticated && !openOrders,
29181
29580
  status: OPEN_ORDER_QUERY_STATUSES[2],
29182
29581
  limit: 25,
29183
29582
  mode: queryExecutionMode
29184
29583
  });
29185
- const submittingOpenOrdersQuery = (0, import_hooks75.useExecutionOrders)({
29584
+ const submittingOpenOrdersQuery = (0, import_hooks76.useExecutionOrders)({
29186
29585
  enabled: shouldUseHookData && isAuthenticated && !openOrders,
29187
29586
  status: OPEN_ORDER_QUERY_STATUSES[3],
29188
29587
  limit: 25,
29189
29588
  mode: queryExecutionMode
29190
29589
  });
29191
- const submittedOpenOrdersQuery = (0, import_hooks75.useExecutionOrders)({
29590
+ const submittedOpenOrdersQuery = (0, import_hooks76.useExecutionOrders)({
29192
29591
  enabled: shouldUseHookData && isAuthenticated && !openOrders,
29193
29592
  status: OPEN_ORDER_QUERY_STATUSES[4],
29194
29593
  limit: 25,
29195
29594
  mode: queryExecutionMode
29196
29595
  });
29197
- const openOpenOrdersQuery = (0, import_hooks75.useExecutionOrders)({
29596
+ const openOpenOrdersQuery = (0, import_hooks76.useExecutionOrders)({
29198
29597
  enabled: shouldUseHookData && isAuthenticated && !openOrders,
29199
29598
  status: OPEN_ORDER_QUERY_STATUSES[5],
29200
29599
  limit: 25,
29201
29600
  mode: queryExecutionMode
29202
29601
  });
29203
- const partiallyFilledOpenOrdersQuery = (0, import_hooks75.useExecutionOrders)({
29602
+ const partiallyFilledOpenOrdersQuery = (0, import_hooks76.useExecutionOrders)({
29204
29603
  enabled: shouldUseHookData && isAuthenticated && !openOrders,
29205
29604
  status: OPEN_ORDER_QUERY_STATUSES[6],
29206
29605
  limit: 25,
29207
29606
  mode: queryExecutionMode
29208
29607
  });
29209
- const cancelPendingOpenOrdersQuery = (0, import_hooks75.useExecutionOrders)({
29608
+ const cancelPendingOpenOrdersQuery = (0, import_hooks76.useExecutionOrders)({
29210
29609
  enabled: shouldUseHookData && isAuthenticated && !openOrders,
29211
29610
  status: OPEN_ORDER_QUERY_STATUSES[7],
29212
29611
  limit: 25,
@@ -29234,7 +29633,7 @@ var UserProfilePage = ({
29234
29633
  submittingOpenOrdersQuery
29235
29634
  ]
29236
29635
  );
29237
- const activityQuery = (0, import_hooks75.useUserActivity)({
29636
+ const activityQuery = (0, import_hooks76.useUserActivity)({
29238
29637
  enabled: shouldUseHookData && isAuthenticated,
29239
29638
  limit: 25
29240
29639
  });
@@ -29321,7 +29720,7 @@ var UserProfilePage = ({
29321
29720
  var _a2, _b2, _c, _d, _e, _f;
29322
29721
  if (user) return user;
29323
29722
  const fullUser = profileUser != null ? profileUser : currentUser;
29324
- const walletAddress = (0, import_hooks75.getWalletAddressFromUserProfile)(fullUser);
29723
+ const walletAddress = (0, import_hooks76.getWalletAddressFromUserProfile)(fullUser);
29325
29724
  const fallbackUsername = walletAddress && shortenAddress(walletAddress) || "username";
29326
29725
  const twitterAccount = (_a2 = fullUser == null ? void 0 : fullUser.accounts) == null ? void 0 : _a2.find(
29327
29726
  (account) => String(account.provider).toLowerCase() === "twitter"
@@ -29376,8 +29775,8 @@ var UserProfilePage = ({
29376
29775
  const reserved = (_a2 = balanceState.reservedBalance) != null ? _a2 : 0;
29377
29776
  return reserved > 0 ? formatUsd2(reserved) : void 0;
29378
29777
  }, [balanceState.reservedBalance]);
29379
- const { disabledVenues, isLoading: isAppConfigLoading } = (0, import_hooks75.useAppConfig)();
29380
- const isKalshiAvailable = (0, import_hooks75.getVenueAvailabilityState)({
29778
+ const { disabledVenues, isLoading: isAppConfigLoading } = (0, import_hooks76.useAppConfig)();
29779
+ const isKalshiAvailable = (0, import_hooks76.getVenueAvailabilityState)({
29381
29780
  venueId: import_sdk25.Venue.kalshi,
29382
29781
  disabledVenues,
29383
29782
  isConfigLoading: isAppConfigLoading
@@ -29603,7 +30002,7 @@ var UserProfilePage = ({
29603
30002
  (groups) => {
29604
30003
  return groups.flatMap((group) => {
29605
30004
  var _a2, _b2, _c, _d;
29606
- const closedTotals = (0, import_hooks75.computeClosedPositionTotals)(group);
30005
+ const closedTotals = (0, import_hooks76.computeClosedPositionTotals)(group);
29607
30006
  const winningOutcome = group.venueMarket.venueMarketOutcomes.find(
29608
30007
  (outcome) => outcome.winner === true
29609
30008
  );