"use client";
import { j as e } from "../../../node_modules/.pnpm/react@19.1.0/node_modules/react/jsx-runtime.mjs";
import i, { useState as m } from "react";
import { Popover as c } from "@mantine/core";
import u from "../../../node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.mjs";
import d from "../Button/index.mjs";
import f from "../Item/index.mjs";
import o from "./AccountSelect.module.scss.mjs";
import { Option as x } from "./components/Option/index.mjs";
import j from "../../../node_modules/.pnpm/@tabler_icons-react@3.34.0_react@19.1.0/node_modules/@tabler/icons-react/dist/esm/icons/IconCaretDown.mjs";
import h from "../../../node_modules/.pnpm/@tabler_icons-react@3.34.0_react@19.1.0/node_modules/@tabler/icons-react/dist/esm/icons/IconCirclePlus.mjs";
const p = i.createContext({
  value: "",
  /* eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function*/
  setValue: (s) => {
  }
}), v = ({
  i18n: s = { myAccounts: "My Accounts", newAccount: "New Account" },
  ...t
}) => {
  const [l, n] = m(!1), r = (a) => {
    n(!1), t.onChange(a);
  };
  return /* @__PURE__ */ e.jsxs(
    c,
    {
      position: "bottom-start",
      opened: l,
      onClose: () => n(!1),
      classNames: { dropdown: o.popoverDropdown },
      offset: 20,
      unstyled: !0,
      children: [
        /* @__PURE__ */ e.jsx(c.Target, { children: /* @__PURE__ */ e.jsxs(
          "button",
          {
            style: t.style,
            onClick: () => n(!l),
            className: o.targetButton,
            children: [
              /* @__PURE__ */ e.jsx(f, { name: t.name, image: t.image }),
              /* @__PURE__ */ e.jsx(j, { size: 16, fill: "currentColor" })
            ]
          }
        ) }),
        /* @__PURE__ */ e.jsxs(c.Dropdown, { children: [
          /* @__PURE__ */ e.jsx("div", { className: u("menu", o.popoverHeader), children: s.myAccounts }),
          /* @__PURE__ */ e.jsx("div", { className: o.scrollArea, children: /* @__PURE__ */ e.jsx(
            p.Provider,
            {
              value: { value: t.value, setValue: r },
              children: t.children
            }
          ) }),
          /* @__PURE__ */ e.jsx("div", { className: o.link, children: /* @__PURE__ */ e.jsx("a", { href: t.href, children: /* @__PURE__ */ e.jsx(
            d,
            {
              type: "link",
              leftIcon: /* @__PURE__ */ e.jsx(h, { size: 26, className: o.circleIcon }),
              className: o.linkButton,
              children: /* @__PURE__ */ e.jsx("div", { className: "caption", children: s.newAccount })
            }
          ) }) })
        ] })
      ]
    }
  );
};
v.Option = x;
export {
  p as AccountSelectContext,
  v as default
};
//# sourceMappingURL=index.mjs.map
