"use client";
import "./chunk-KHHFHXXD.mjs";
import {
  ConditionalWrapper,
  DefaultAvatar,
  EventMarketPage,
  HomePage,
  USER_PROFILE_TAB_ACTIVITY,
  USER_PROFILE_TAB_OPEN_ORDERS,
  USER_PROFILE_TAB_POSITIONS,
  UserProfilePage,
  useHomePageModals
} from "./chunk-75IGOQ4N.mjs";
import {
  EventList,
  EventListItem,
  EventListItemDetails,
  MarketDetails,
  MarketDetailsList,
  Orderbook,
  OrderbookWithStates,
  SettlementSummary,
  collectEligibleVenueOutcomeIds,
  collectEligibleVenueOutcomes,
  mergeVenueOutcomeOrderbooks,
  orderbookRowLimitDefault,
  useCenterOrderbookSpread
} from "./chunk-I2WBGEWK.mjs";
import {
  CARD_NETWORK_OPTIONS,
  ConnectAccountsStep,
  ConnectKalshiModal,
  ConnectOnchainModal,
  DepositModal,
  GeoBlockModal,
  HowItWorksStep,
  OnboardingModal,
  ProfileModal,
  ProfileSetupStep,
  WithdrawModal,
  clearPendingCardSession,
  getPendingCardSession
} from "./chunk-DMKKNK76.mjs";
import {
  DEPOSIT_MODAL_OPEN_EVENT,
  PlaceOrder,
  PlaceOrderFailureView,
  PlaceOrderSuccessView,
  Settlement,
  SettlementDetails,
  WITHDRAW_MODAL_OPEN_EVENT,
  defaultSettlementDifferencesTitle,
  defaultSettlementSectionLabel,
  defaultTradingDisclaimer,
  getTradingAveragePriceLabel,
  getTradingBalanceLabel,
  getTradingDateLabel,
  getTradingPriceLabel,
  getTradingSharesLabel,
  getTradingSlippageLabel,
  getTradingValueLabel,
  getTradingVenueLabel,
  mapVenueMarketsToSettlementSections,
  parseAmount,
  parseVenue,
  requestAggDepositModalOpen,
  requestAggWithdrawModalOpen
} from "./chunk-CGNDMLQL.mjs";
import {
  formatProbabilityCents,
  resolveOrderBookRows,
  resolveUnifiedOrderBookEntries,
  useEventTradingContext
} from "./chunk-C7T56TJR.mjs";
import {
  GeoBlockBanner
} from "./chunk-2QJXRRYP.mjs";
import {
  AGG_DEFAULT_URL,
  AGG_DOCS_URL,
  AGG_PRIVACY_POLICY_URL,
  AGG_ROOT_CLASS_NAME,
  AGG_TERMS_OF_SERVICE_URL,
  ActivityChartIcon,
  AggErrorBoundary,
  AggLogo,
  AppleIcon,
  ArbitrumIcon,
  ArrowRightIcon,
  ArrowTrendUpIcon,
  ArrowsToDotIcon,
  AutocompleteSelect,
  Badge,
  BadgeCheckThinIcon,
  BankIcon,
  BaseIcon,
  BestPricesIcon,
  BnbIcon,
  BoltIcon,
  Button,
  Card,
  ChartCandlestickIcon,
  ChartLineIcon,
  CheckCircleIcon,
  ChevronDownIcon,
  ChevronLeftIcon,
  ChevronRightIcon,
  ChevronUpIcon,
  CloseIcon,
  CopyIcon,
  CreateAccountIcon,
  CreditCardIcon,
  CurrencyInput,
  DisconnectIcon,
  DocumentIcon,
  DotsHorizontalIcon,
  DownloadIcon,
  ErrorFilledIcon,
  EthereumIcon,
  ExternalLinkIcon,
  Footer,
  GoogleIcon,
  Header,
  Icon,
  ImageIcon,
  InfoIcon,
  InlineAlert,
  LineChart,
  LinkAccountsIcon,
  LoadingIcon,
  Modal,
  NumberValue,
  PaperPlaneIcon,
  PencilIcon,
  PlaySquareIcon,
  PolygonIcon,
  ProfileIcon,
  RemoteImage,
  RevenueAltIcon,
  Search,
  SearchIcon,
  Select,
  ShieldTrustIcon,
  Skeleton,
  SolanaIcon,
  SparklesFilledIcon,
  StateMessage,
  StayInControlIcon,
  SuccessCheckIcon,
  SwitchButton,
  Tabs,
  Tooltip,
  TriangleDownIcon,
  TriangleUpFilledIcon,
  TriangleUpIcon,
  Typography,
  UploadIcon,
  UsdcIcon,
  UserTrustIcon,
  VenueLogo,
  WalletAvatarIcon,
  WalletFilledIcon,
  WalletIcon,
  WarningFilledIcon,
  WarningIcon,
  __spreadProps,
  __spreadValues,
  badgeSizes,
  cn,
  formatAmountDisplay,
  formatCompactUsd,
  formatUsd,
  getMotionClassName,
  getScrollBehavior,
  iconNames,
  isTruthy,
  isValidDateValue,
  shortenAddress,
  skeletonViews,
  toDate,
  typographyVariants,
  venueLogoNames
} from "./chunk-6NS7D73S.mjs";

// src/auth/connect-button-view/index.tsx
import { optimizedImageUrl, useAggAuthContext, useLabels, useSdkUiConfig } from "@agg-build/hooks";
import * as DropdownMenu from "@radix-ui/react-dropdown-menu";

// src/auth/connect-button-view/connect-button-view.constants.ts
var connectButtonContainerClassName = cn(
  "inline-flex flex-col items-start gap-2 font-agg-sans max-w-full"
);
var authNoticeClassName = cn("text-agg-xs leading-agg-4 text-agg-muted-foreground");
var authErrorClassName = cn("text-agg-sm leading-agg-5 text-red-500");
var authModalContainerClassName = cn("max-w-[400px] rounded-[24px]");
var authModalBodyClassName = cn("px-8 pt-0 pb-6 sm:px-8 sm:pt-0 sm:pb-6");
var authSectionClassName = cn("flex w-full flex-col gap-5");
var authSectionHeadingClassName = cn(
  "text-center text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground"
);
var authMethodsListClassName = cn("flex w-full flex-col gap-6 pt-2");
var authInputFormClassName = cn("flex w-full flex-col gap-3");
var authInputFieldClassName = cn(
  "h-10 w-full rounded-[4px] border border-agg-separator bg-agg-secondary px-4 text-agg-base leading-agg-6 text-agg-foreground outline-none",
  "placeholder:text-agg-muted-foreground focus-visible:border-agg-primary-hover focus-visible:ring-2 focus-visible:ring-agg-primary-hover focus-visible:ring-offset-[-1px] focus-visible:ring-offset-agg-secondary",
  "disabled:cursor-not-allowed disabled:text-agg-muted-foreground"
);
var authPrimaryActionClassName = cn("h-10 w-full");
var authMethodGridClassName = cn(
  "grid w-full gap-3 [grid-template-columns:repeat(auto-fit,minmax(60px,1fr))]",
  "[&>*]:w-full [&>*]:mx-auto"
);
var authWalletMethodGridClassName = cn("flex w-full flex-col gap-2");
var authSocialButtonClassName = cn(
  "cursor-pointer! hover:cursor-pointer hover:bg-agg-secondary-hover",
  "flex h-[60px] items-center justify-center rounded-xl border border-agg-separator bg-agg-secondary text-agg-foreground",
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary-hover focus-visible:ring-offset-0 focus-visible:ring-offset-agg-secondary",
  "disabled:cursor-not-allowed disabled:text-agg-muted-foreground"
);
var authWalletButtonClassName = cn(
  "cursor-pointer! hover:cursor-pointer hover:bg-agg-secondary-hover",
  "flex h-12 items-center justify-center gap-2 rounded-agg-full border border-agg-separator bg-agg-secondary px-4 text-agg-base font-agg-bold leading-agg-6 text-agg-foreground",
  "hover:bg-agg-secondary-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary-hover focus-visible:ring-offset-0 focus-visible:ring-offset-agg-secondary",
  "disabled:cursor-not-allowed disabled:text-agg-muted-foreground"
);
var authWalletIconGroupClassName = cn("flex items-center justify-center -space-x-2");
var authHelperTextClassName = cn(
  "text-center text-agg-xs leading-agg-4 text-agg-muted-foreground"
);
var authHelperLinkClassName = cn("underline underline-offset-2 decoration-current");
var authDividerClassName = cn("flex w-full items-center gap-3");
var authDividerLineClassName = cn("h-px flex-1 bg-agg-separator");
var authDividerLabelClassName = cn(
  "text-agg-xs font-agg-bold uppercase leading-agg-4 text-agg-muted-foreground"
);
var authLegalTextClassName = cn(
  "text-center text-agg-xs leading-agg-4 text-agg-muted-foreground"
);
var connectedButtonsRowClassName = cn("inline-flex h-10 items-center gap-2 max-w-full");
var connectedBalanceChipClassName = cn(
  "hidden md:inline-flex",
  "h-10 items-center gap-4 rounded-agg-full border border-agg-separator bg-agg-secondary pl-[12px] pr-13 font-agg-sans"
);
var profileMenuContentClassName = cn(
  "z-50 w-64 max-w-[calc(100vw-2rem)] overflow-hidden rounded-agg-xl font-agg-sans",
  "border border-agg-separator bg-agg-secondary",
  "shadow-agg-popover"
);
var profileMenuSectionClassName = cn("flex w-full flex-col gap-5 px-5 py-5");
var profileMenuSeparatorClassName = cn("h-px w-full bg-agg-separator");
var profileMenuActionItemClassName = cn(
  "flex w-full items-center gap-3 px-5 py-4 font-agg-sans text-agg-sm leading-agg-5 text-agg-foreground",
  "outline-none",
  "hover:bg-agg-secondary-hover focus:bg-agg-secondary-hover"
);
var avatarRootClassName = cn(
  "inline-flex size-6 shrink-0 items-center justify-center rounded-agg-full bg-agg-separator"
);
var avatarIconClassName = cn("h-[66%] w-[66%] text-agg-muted-foreground");

// src/auth/connect-button-view/index.tsx
import { jsx, jsxs } from "react/jsx-runtime";
var WalletAvatar = ({ className }) => {
  const { isAuthenticated, user } = useAggAuthContext();
  if (isAuthenticated && (user == null ? void 0 : user.avatarUrl)) {
    return /* @__PURE__ */ jsx(
      "img",
      {
        src: optimizedImageUrl(user.avatarUrl, 44),
        alt: "Avatar",
        className: cn(avatarRootClassName, className)
      }
    );
  }
  return /* @__PURE__ */ jsx(DefaultAvatar, { className: cn("size-6 shrink-0 rounded-full", className) });
};
var AuthMethodActionButton = ({
  activeMethodId,
  className,
  disabled,
  method,
  onSelect,
  renderLabel = true
}) => {
  var _a;
  const labels = useLabels();
  const isMethodLoading = activeMethodId === method.id;
  const isMethodDisabled = disabled || !method.isAvailable || activeMethodId !== null && !isMethodLoading;
  return /* @__PURE__ */ jsxs(
    "button",
    {
      type: "button",
      className,
      disabled: isMethodDisabled,
      "aria-busy": isMethodLoading || void 0,
      "aria-label": labels.auth.signInWithMethod(method.label),
      onClick: () => onSelect(method.id),
      children: [
        isMethodLoading ? /* @__PURE__ */ jsx(LoadingIcon, { size: "small" }) : /* @__PURE__ */ jsx(
          Icon,
          {
            name: (_a = method.iconName) != null ? _a : "profile",
            size: "medium",
            className: cn("!rounded-agg-lg", renderLabel ? void 0 : "h-6 w-6 text-agg-foreground"),
            title: renderLabel ? void 0 : method.label
          }
        ),
        renderLabel ? /* @__PURE__ */ jsx("span", { children: labels.auth.connect(method.label) }) : null
      ]
    }
  );
};
var UnauthenticatedConnectView = ({
  activeMethodId,
  buttonProps,
  challengeContent,
  classNames,
  disabled,
  emailMethod,
  emailError,
  emailValue,
  errorMessage,
  isBusy,
  isChooserOpen,
  notice,
  onChooserOpenChange,
  onEmailChange,
  onEmailSubmit,
  onMethodSelect,
  socialMethods,
  walletMethods
}) => {
  var _a, _b, _c, _d, _e;
  const labels = useLabels();
  const hasConfiguredMethods = emailMethod !== null || socialMethods.length > 0 || walletMethods.length > 0;
  const showWalletDivider = walletMethods.length > 0 && (emailMethod !== null || socialMethods.length > 0);
  return /* @__PURE__ */ jsxs("div", { className: cn(connectButtonContainerClassName, classNames == null ? void 0 : classNames.root), children: [
    /* @__PURE__ */ jsx(
      Button,
      __spreadProps(__spreadValues({
        variant: "primary",
        size: "large",
        className: classNames == null ? void 0 : classNames.connectButton,
        onClick: () => onChooserOpenChange(true),
        disabled: disabled || !hasConfiguredMethods,
        "aria-label": labels.auth.connect()
      }, buttonProps), {
        children: labels.auth.connect()
      })
    ),
    notice ? /* @__PURE__ */ jsx("p", { className: cn(authNoticeClassName, classNames == null ? void 0 : classNames.authNotice), children: notice }) : null,
    /* @__PURE__ */ jsx(Modal, { open: isChooserOpen || !!challengeContent, onOpenChange: onChooserOpenChange, children: /* @__PURE__ */ jsxs(
      Modal.Container,
      {
        maxWidth: "400px",
        classNames: {
          container: cn(authModalContainerClassName, classNames == null ? void 0 : classNames.authModalContent)
        },
        "aria-label": challengeContent ? "Security Check" : labels.auth.signIn,
        children: [
          /* @__PURE__ */ jsx(
            Modal.Header,
            {
              title: challengeContent ? "Security Check" : labels.auth.signIn,
              hideBorder: true,
              classNames: {
                container: "px-8 py-6",
                title: "text-agg-2xl leading-agg-8",
                titleContainer: "max-w-none"
              }
            }
          ),
          /* @__PURE__ */ jsx(Modal.Body, { classNames: { root: authModalBodyClassName }, children: challengeContent ? challengeContent : /* @__PURE__ */ jsxs("div", { className: authMethodsListClassName, children: [
            emailMethod ? /* @__PURE__ */ jsxs(
              "form",
              {
                className: authSectionClassName,
                onSubmit: (event) => {
                  event.preventDefault();
                  onEmailSubmit();
                },
                children: [
                  /* @__PURE__ */ jsxs("div", { className: authInputFormClassName, children: [
                    /* @__PURE__ */ jsx(
                      "input",
                      {
                        id: "agg-auth-email",
                        type: "email",
                        value: emailValue,
                        onChange: (event) => onEmailChange(event.target.value),
                        placeholder: (_b = (_a = emailMethod.input) == null ? void 0 : _a.placeholder) != null ? _b : labels.auth.emailAddress,
                        className: cn(authInputFieldClassName, classNames == null ? void 0 : classNames.authFormField),
                        "aria-label": labels.auth.emailAddress,
                        disabled: disabled || isBusy || !emailMethod.isAvailable
                      }
                    ),
                    /* @__PURE__ */ jsx(
                      Button,
                      {
                        type: "submit",
                        variant: "secondary",
                        size: "large",
                        className: authPrimaryActionClassName,
                        isLoading: activeMethodId === emailMethod.id,
                        disabled: disabled || isBusy || !emailMethod.isAvailable,
                        children: (_d = (_c = emailMethod.input) == null ? void 0 : _c.submitLabel) != null ? _d : labels.auth.continue
                      }
                    )
                  ] }),
                  emailMethod.isAvailable && ((_e = emailMethod.input) == null ? void 0 : _e.helperText) ? /* @__PURE__ */ jsx("p", { className: cn(authNoticeClassName, classNames == null ? void 0 : classNames.authNotice), children: emailMethod.input.helperText }) : null,
                  !emailMethod.isAvailable ? /* @__PURE__ */ jsx(
                    InlineAlert,
                    {
                      tone: "warning",
                      variant: "surface",
                      message: labels.auth.emailUnavailable,
                      className: classNames == null ? void 0 : classNames.authError
                    }
                  ) : null,
                  emailError ? /* @__PURE__ */ jsx(
                    InlineAlert,
                    {
                      tone: "error",
                      message: emailError,
                      className: classNames == null ? void 0 : classNames.authError
                    }
                  ) : null
                ]
              }
            ) : null,
            socialMethods.length > 0 ? /* @__PURE__ */ jsxs("div", { className: authSectionClassName, children: [
              /* @__PURE__ */ jsx("div", { className: cn(authMethodGridClassName, classNames == null ? void 0 : classNames.authMethodGrid), children: socialMethods.map((method) => /* @__PURE__ */ jsx(
                AuthMethodActionButton,
                {
                  activeMethodId,
                  className: cn(authSocialButtonClassName, classNames == null ? void 0 : classNames.authMethodButton),
                  disabled: disabled || isBusy,
                  method,
                  onSelect: onMethodSelect,
                  renderLabel: false
                },
                method.id
              )) }),
              /* @__PURE__ */ jsxs("p", { className: authHelperTextClassName, children: [
                labels.auth.socialWalletNotice,
                " ",
                /* @__PURE__ */ jsx("span", { className: cn(authHelperLinkClassName, classNames == null ? void 0 : classNames.authHelperLink), children: labels.auth.learnMore })
              ] })
            ] }) : null,
            showWalletDivider ? /* @__PURE__ */ jsxs("div", { className: authDividerClassName, children: [
              /* @__PURE__ */ jsx("div", { className: authDividerLineClassName }),
              /* @__PURE__ */ jsx("span", { className: authDividerLabelClassName, children: labels.auth.dividerOr }),
              /* @__PURE__ */ jsx("div", { className: authDividerLineClassName })
            ] }) : null,
            walletMethods.length > 0 ? /* @__PURE__ */ jsx("div", { className: authSectionClassName, children: /* @__PURE__ */ jsx("div", { className: cn(authWalletMethodGridClassName, classNames == null ? void 0 : classNames.authMethodGrid), children: walletMethods.map((method) => /* @__PURE__ */ jsx(
              AuthMethodActionButton,
              {
                activeMethodId,
                className: cn(authWalletButtonClassName, classNames == null ? void 0 : classNames.authMethodButton),
                disabled: disabled || isBusy,
                method,
                onSelect: onMethodSelect
              },
              method.id
            )) }) }) : null,
            /* @__PURE__ */ jsxs("p", { className: authLegalTextClassName, children: [
              labels.auth.legalNoticePrefix,
              " ",
              /* @__PURE__ */ jsx(
                "a",
                {
                  className: cn(authHelperLinkClassName, classNames == null ? void 0 : classNames.authHelperLink),
                  href: AGG_TERMS_OF_SERVICE_URL,
                  target: "_blank",
                  rel: "noreferrer",
                  children: labels.auth.terms
                }
              ),
              " ",
              labels.auth.legalNoticeSeparator,
              " ",
              /* @__PURE__ */ jsx(
                "a",
                {
                  className: cn(authHelperLinkClassName, classNames == null ? void 0 : classNames.authHelperLink),
                  href: AGG_PRIVACY_POLICY_URL,
                  target: "_blank",
                  rel: "noreferrer",
                  children: labels.auth.privacyPolicy
                }
              ),
              "."
            ] }),
            errorMessage ? /* @__PURE__ */ jsx(
              InlineAlert,
              {
                tone: "error",
                message: errorMessage,
                className: classNames == null ? void 0 : classNames.authError
              }
            ) : null
          ] }) })
        ]
      }
    ) })
  ] });
};
var AuthConnectButtonView = ({
  activeMethodId,
  addressLabel,
  buttonProps,
  challengeContent,
  classNames,
  disabled,
  emailMethod,
  emailError,
  emailValue,
  errorMessage,
  isAuthenticated,
  isBalanceLoading,
  isBusy,
  isChooserOpen,
  isProfileMenuOpen,
  notice,
  onChooserOpenChange,
  onDepositClick,
  onDisconnectClick,
  onEmailChange,
  onEmailSubmit,
  onMethodSelect,
  onProfileCardClick,
  onProfileClick,
  onProfileMenuOpenChange,
  socialMethods,
  onWithdrawClick,
  profileLabel,
  totalBalance,
  positionsBalance,
  claimReadyCount = 0,
  onClaimWinningsClick,
  walletMethods,
  isDepositBlocked = false
}) => {
  var _a;
  const labels = useLabels();
  const {
    general: { rootClassName },
    features: { enableAnimations }
  } = useSdkUiConfig();
  const resolvedProfileLabel = profileLabel || labels.auth.myProfile;
  const authLabelsWithClaim = labels.auth;
  const resolveClaimTooltipLabel = (count) => {
    var _a2, _b;
    return (_b = (_a2 = authLabelsWithClaim.claimableWinningsTooltip) == null ? void 0 : _a2.call(authLabelsWithClaim, count)) != null ? _b : `${count} position${count === 1 ? "" : "s"} ready to claim`;
  };
  const resolveClaimBadgeAriaLabel = (count) => {
    var _a2, _b;
    return (_b = (_a2 = authLabelsWithClaim.claimableWinningsBadge) == null ? void 0 : _a2.call(authLabelsWithClaim, count)) != null ? _b : `${count} claimable winning${count === 1 ? "" : "s"}`;
  };
  const claimWinningsLabel = (_a = authLabelsWithClaim.claimWinnings) != null ? _a : "Claim Now";
  const dropdownMenuItemClassName = cn(
    "cursor-pointer",
    profileMenuActionItemClassName,
    enableAnimations ? "transition-colors" : null,
    disabled ? "pointer-events-none opacity-50" : null,
    classNames == null ? void 0 : classNames.profileMenuActionItem
  );
  if (!isAuthenticated) {
    return /* @__PURE__ */ jsx(
      UnauthenticatedConnectView,
      {
        activeMethodId,
        buttonProps,
        challengeContent,
        classNames,
        disabled,
        emailMethod,
        emailError,
        emailValue,
        errorMessage,
        isBusy,
        isChooserOpen,
        notice,
        onChooserOpenChange,
        onEmailChange,
        onEmailSubmit,
        onMethodSelect,
        socialMethods,
        walletMethods
      }
    );
  }
  return /* @__PURE__ */ jsx("div", { className: cn(connectButtonContainerClassName, classNames == null ? void 0 : classNames.root), children: /* @__PURE__ */ jsxs("div", { className: cn(connectedButtonsRowClassName, classNames == null ? void 0 : classNames.connectedRow), children: [
    /* @__PURE__ */ jsxs("div", { className: cn(connectedBalanceChipClassName, classNames == null ? void 0 : classNames.balanceChip), children: [
      /* @__PURE__ */ jsx("div", { className: "hidden lg:inline-flex", children: /* @__PURE__ */ jsx(
        ConditionalWrapper,
        {
          condition: isDepositBlocked,
          wrapper: (children) => /* @__PURE__ */ jsx(Tooltip, { content: /* @__PURE__ */ jsx("p", { className: "text-center", children: labels.auth.depositGeoBlocked }), children }),
          children: /* @__PURE__ */ jsx(
            Button,
            __spreadProps(__spreadValues({
              variant: "primary",
              size: "small",
              className: cn("h-6! px-3! text-agg-xs! leading-agg-4!", classNames == null ? void 0 : classNames.depositButton)
            }, !isDepositBlocked ? { onClick: onDepositClick } : { disabled: true }), {
              "aria-label": labels.auth.deposit,
              children: labels.auth.deposit
            })
          )
        }
      ) }),
      /* @__PURE__ */ jsx(
        ConditionalWrapper,
        {
          condition: claimReadyCount > 0,
          wrapper: (children) => /* @__PURE__ */ jsx(
            Tooltip,
            {
              size: "medium",
              content: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-2", children: [
                /* @__PURE__ */ jsx("p", { children: resolveClaimTooltipLabel(claimReadyCount) }),
                onClaimWinningsClick ? /* @__PURE__ */ jsxs(
                  "button",
                  {
                    type: "button",
                    className: "inline-flex cursor-pointer items-center gap-1.5 font-agg-bold text-agg-primary hover:text-agg-primary-hover",
                    onClick: onClaimWinningsClick,
                    children: [
                      claimWinningsLabel,
                      /* @__PURE__ */ jsx(
                        Icon,
                        {
                          name: "arrow-right",
                          size: "small",
                          className: "h-3.5 w-3.5 text-agg-primary",
                          "aria-hidden": true
                        }
                      )
                    ]
                  }
                ) : null
              ] }),
              children
            }
          ),
          children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
            /* @__PURE__ */ jsx("span", { className: "h-3.5 w-3.5 shrink-0 [&_svg]:h-full [&_svg]:w-full", children: /* @__PURE__ */ jsx(Icon, { name: "activity-chart", size: "small", className: "text-agg-muted-foreground" }) }),
            /* @__PURE__ */ jsx("p", { className: cn("agg-type-label text-agg-foreground", classNames == null ? void 0 : classNames.positionsText), children: isBalanceLoading ? /* @__PURE__ */ jsx(LoadingIcon, { size: "small" }) : formatUsd(positionsBalance) }),
            claimReadyCount > 0 ? /* @__PURE__ */ jsx(
              "span",
              {
                className: "inline-flex size-4 shrink-0 items-center justify-center rounded-full bg-linear-to-r from-agg-primary to-agg-primary-hover text-[10px] leading-[14px] font-agg-bold text-white uppercase",
                "aria-label": resolveClaimBadgeAriaLabel(claimReadyCount),
                children: claimReadyCount
              }
            ) : null
          ] })
        }
      ),
      /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
        /* @__PURE__ */ jsx("span", { className: "h-3.5 w-3.5 shrink-0 [&_svg]:h-full [&_svg]:w-full", children: /* @__PURE__ */ jsx(Icon, { name: "wallet-filled", size: "small", className: "text-agg-muted-foreground" }) }),
        /* @__PURE__ */ jsx("p", { className: cn("agg-type-label text-agg-foreground", classNames == null ? void 0 : classNames.balanceText), children: isBalanceLoading ? /* @__PURE__ */ jsx(LoadingIcon, { size: "small" }) : formatUsd(totalBalance) })
      ] })
    ] }),
    /* @__PURE__ */ jsxs(DropdownMenu.Root, { open: isProfileMenuOpen, onOpenChange: onProfileMenuOpenChange, children: [
      /* @__PURE__ */ jsx(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs(
        "button",
        {
          type: "button",
          className: cn(
            "ml-0 md:-ml-12 max-w-48",
            "inline-flex h-10 items-center gap-3 rounded-agg-full border bg-agg-secondary pl-2 pr-3 font-agg-sans",
            "cursor-pointer hover:bg-agg-secondary-hover",
            "focus-visible:outline-none focus-visible:border-agg-primary",
            isProfileMenuOpen ? "border-agg-primary" : "border-agg-separator",
            enableAnimations ? "transition-colors" : null,
            classNames == null ? void 0 : classNames.profileTrigger
          ),
          disabled,
          "aria-label": labels.auth.walletMenuFor(resolvedProfileLabel),
          children: [
            /* @__PURE__ */ jsx(WalletAvatar, {}),
            /* @__PURE__ */ jsx(
              Typography,
              {
                variant: "body-strong",
                className: cn("truncate whitespace-pre", classNames == null ? void 0 : classNames.profileTriggerLabel),
                children: resolvedProfileLabel
              }
            ),
            /* @__PURE__ */ jsx(
              Icon,
              {
                name: isProfileMenuOpen ? "chevron-up" : "chevron-down",
                size: "small",
                className: "h-3.5 w-3.5 min-w-3.5 min-h-3.5 text-agg-foreground",
                "aria-hidden": "true"
              }
            )
          ]
        }
      ) }),
      /* @__PURE__ */ jsx(DropdownMenu.Portal, { children: /* @__PURE__ */ jsxs(
        DropdownMenu.Content,
        {
          className: cn(
            AGG_ROOT_CLASS_NAME,
            rootClassName,
            profileMenuContentClassName,
            classNames == null ? void 0 : classNames.profileMenuContent
          ),
          "data-agg-animations": enableAnimations ? "true" : "false",
          sideOffset: 4,
          align: "end",
          children: [
            /* @__PURE__ */ jsx(
              "button",
              {
                type: "button",
                className: cn(
                  profileMenuSectionClassName,
                  "cursor-pointer",
                  "hover:bg-agg-secondary-hover focus:bg-agg-secondary-hover",
                  enableAnimations ? "transition-colors" : null,
                  classNames == null ? void 0 : classNames.profileMenuSection
                ),
                onClick: onProfileCardClick,
                disabled,
                children: /* @__PURE__ */ jsxs("div", { className: "flex flex-row items-start justify-start gap-3", children: [
                  /* @__PURE__ */ jsx(WalletAvatar, { className: "size-11" }),
                  /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col items-start justify-start gap-0.5", children: [
                    /* @__PURE__ */ jsx("p", { className: "w-full truncate text-agg-lg font-agg-bold leading-agg-7 text-agg-foreground text-left", children: resolvedProfileLabel }),
                    addressLabel ? /* @__PURE__ */ jsx("p", { className: "w-full truncate text-agg-sm font-agg-normal leading-agg-5 text-agg-muted-foreground text-left", children: addressLabel }) : null
                  ] })
                ] })
              }
            ),
            /* @__PURE__ */ jsx(
              "div",
              {
                className: cn(profileMenuSeparatorClassName, classNames == null ? void 0 : classNames.profileMenuSeparator)
              }
            ),
            /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-col py-2", children: [
              /* @__PURE__ */ jsxs(
                DropdownMenu.Item,
                {
                  className: dropdownMenuItemClassName,
                  onSelect: onProfileClick,
                  disabled,
                  children: [
                    /* @__PURE__ */ jsx(Icon, { name: "profile", size: "small", className: "text-agg-foreground" }),
                    /* @__PURE__ */ jsx("span", { children: labels.auth.myProfile })
                  ]
                }
              ),
              isDepositBlocked ? /* @__PURE__ */ jsx(Tooltip, { content: /* @__PURE__ */ jsx("p", { className: "text-center", children: labels.auth.depositGeoBlocked }), children: /* @__PURE__ */ jsx("span", { className: "w-full", children: /* @__PURE__ */ jsxs(
                DropdownMenu.Item,
                {
                  className: cn(dropdownMenuItemClassName, "opacity-50 pointer-events-none"),
                  disabled: true,
                  children: [
                    /* @__PURE__ */ jsx(Icon, { name: "download", size: "small", className: "text-agg-foreground" }),
                    /* @__PURE__ */ jsx("span", { children: labels.auth.deposit })
                  ]
                }
              ) }) }) : /* @__PURE__ */ jsxs(
                DropdownMenu.Item,
                {
                  className: dropdownMenuItemClassName,
                  onSelect: onDepositClick,
                  disabled,
                  children: [
                    /* @__PURE__ */ jsx(Icon, { name: "download", size: "small", className: "text-agg-foreground" }),
                    /* @__PURE__ */ jsx("span", { children: labels.auth.deposit })
                  ]
                }
              ),
              /* @__PURE__ */ jsxs(
                DropdownMenu.Item,
                {
                  className: dropdownMenuItemClassName,
                  onSelect: onWithdrawClick,
                  disabled,
                  children: [
                    /* @__PURE__ */ jsx(Icon, { name: "upload", size: "small", className: "text-agg-foreground" }),
                    /* @__PURE__ */ jsx("span", { children: labels.auth.withdraw })
                  ]
                }
              ),
              /* @__PURE__ */ jsxs(
                DropdownMenu.Item,
                {
                  className: dropdownMenuItemClassName,
                  onSelect: onDisconnectClick,
                  disabled,
                  children: [
                    /* @__PURE__ */ jsx(Icon, { name: "disconnect", size: "small", className: "text-agg-foreground" }),
                    /* @__PURE__ */ jsx("span", { children: labels.auth.disconnect })
                  ]
                }
              )
            ] })
          ]
        }
      ) })
    ] })
  ] }) });
};
AuthConnectButtonView.displayName = "AuthConnectButtonView";
export {
  AGG_DEFAULT_URL,
  AGG_DOCS_URL,
  AGG_PRIVACY_POLICY_URL,
  AGG_ROOT_CLASS_NAME,
  AGG_TERMS_OF_SERVICE_URL,
  ActivityChartIcon,
  AggErrorBoundary,
  AggLogo,
  AppleIcon,
  ArbitrumIcon,
  ArrowRightIcon,
  ArrowTrendUpIcon,
  ArrowsToDotIcon,
  AuthConnectButtonView,
  AutocompleteSelect,
  Badge,
  BadgeCheckThinIcon,
  BankIcon,
  BaseIcon,
  BestPricesIcon,
  BnbIcon,
  BoltIcon,
  Button,
  CARD_NETWORK_OPTIONS,
  Card,
  ChartCandlestickIcon,
  ChartLineIcon,
  CheckCircleIcon,
  ChevronDownIcon,
  ChevronLeftIcon,
  ChevronRightIcon,
  ChevronUpIcon,
  CloseIcon,
  ConnectAccountsStep,
  ConnectKalshiModal,
  ConnectOnchainModal,
  CopyIcon,
  CreateAccountIcon,
  CreditCardIcon,
  CurrencyInput,
  DEPOSIT_MODAL_OPEN_EVENT,
  DepositModal,
  DisconnectIcon,
  DocumentIcon,
  DotsHorizontalIcon,
  DownloadIcon,
  ErrorFilledIcon,
  EthereumIcon,
  EventList,
  EventListItem,
  EventListItemDetails,
  EventMarketPage,
  ExternalLinkIcon,
  Footer,
  GeoBlockBanner,
  GeoBlockModal,
  GoogleIcon,
  Header,
  HomePage,
  HowItWorksStep,
  Icon,
  ImageIcon,
  InfoIcon,
  InlineAlert,
  LineChart,
  LinkAccountsIcon,
  LoadingIcon,
  MarketDetails,
  MarketDetailsList,
  Modal,
  NumberValue,
  OnboardingModal,
  Orderbook,
  OrderbookWithStates,
  PaperPlaneIcon,
  PencilIcon,
  PlaceOrder,
  PlaceOrderFailureView,
  PlaceOrderSuccessView,
  PlaySquareIcon,
  PolygonIcon,
  ProfileIcon,
  ProfileModal,
  ProfileSetupStep,
  RemoteImage,
  RevenueAltIcon,
  Search,
  SearchIcon,
  Select,
  Settlement,
  SettlementDetails,
  SettlementSummary,
  ShieldTrustIcon,
  Skeleton,
  SolanaIcon,
  SparklesFilledIcon,
  StateMessage,
  StayInControlIcon,
  SuccessCheckIcon,
  SwitchButton,
  Tabs,
  Tooltip,
  TriangleDownIcon,
  TriangleUpFilledIcon,
  TriangleUpIcon,
  Typography,
  USER_PROFILE_TAB_ACTIVITY,
  USER_PROFILE_TAB_OPEN_ORDERS,
  USER_PROFILE_TAB_POSITIONS,
  UploadIcon,
  UsdcIcon,
  UserProfilePage,
  UserTrustIcon,
  VenueLogo,
  WITHDRAW_MODAL_OPEN_EVENT,
  WalletAvatarIcon,
  WalletFilledIcon,
  WalletIcon,
  WarningFilledIcon,
  WarningIcon,
  WithdrawModal,
  AGG_ROOT_CLASS_NAME as aggRootClassName,
  badgeSizes,
  clearPendingCardSession,
  cn,
  collectEligibleVenueOutcomeIds,
  collectEligibleVenueOutcomes,
  defaultSettlementDifferencesTitle,
  defaultSettlementSectionLabel,
  defaultTradingDisclaimer,
  formatAmountDisplay,
  formatCompactUsd,
  formatProbabilityCents,
  formatUsd,
  getMotionClassName,
  getPendingCardSession,
  getScrollBehavior,
  getTradingAveragePriceLabel,
  getTradingBalanceLabel,
  getTradingDateLabel,
  getTradingPriceLabel,
  getTradingSharesLabel,
  getTradingSlippageLabel,
  getTradingValueLabel,
  getTradingVenueLabel,
  iconNames,
  isTruthy,
  isValidDateValue,
  mapVenueMarketsToSettlementSections,
  mergeVenueOutcomeOrderbooks,
  orderbookRowLimitDefault,
  parseAmount,
  parseVenue,
  requestAggDepositModalOpen,
  requestAggWithdrawModalOpen,
  resolveOrderBookRows,
  resolveUnifiedOrderBookEntries,
  shortenAddress,
  skeletonViews,
  toDate,
  typographyVariants,
  useCenterOrderbookSpread,
  useEventTradingContext,
  useHomePageModals,
  venueLogoNames
};
