import { j as e } from "../../node_modules/react/jsx-runtime.js";
import u from "react";
import { Icon as l } from "../Icon/index.js";
import { cn as c } from "../../utils/index.js";
import { Select as g, SelectTrigger as h, SelectValue as j, SelectContent as N, SelectGroup as y } from "../Select/index.js";
import { Item as E, ItemText as v, ItemIndicator as w } from "../../node_modules/@radix-ui/react-select/dist/index.js";
import { Badge as S } from "../Badge/index.js";
import { Typography as I } from "../Typography/index.js";
const m = {
  AMBER: {
    className: "bg-amber-40 text-content-primary",
    selectClassName: "bg-amber-90 text-content-inverse-strong",
    iconName: "code-block"
  },
  GREEN: {
    className: "bg-green-70 text-content-inverse-strong",
    selectClassName: "text-content-primary bg-content-inverse-strong",
    iconName: "station"
  },
  BLUE: {
    className: "bg-blue-80 text-content-inverse-strong",
    selectClassName: "text-content-primary bg-content-inverse-strong",
    iconName: "station"
  }
}, x = {
  staging: {
    style: m.AMBER,
    prefix: /* @__PURE__ */ e.jsxs("p", { children: [
      "Working with ",
      /* @__PURE__ */ e.jsx("b", { children: "mock data in" })
    ] }),
    label: "Staging",
    description: "Make configuration changes and test your app with mock data."
  },
  production: {
    style: m.GREEN,
    prefix: /* @__PURE__ */ e.jsxs("p", { children: [
      "Working with ",
      /* @__PURE__ */ e.jsx("b", { children: "live data in" })
    ] }),
    label: "Production",
    description: "Integrate with live data and release your app for end-users."
  }
}, R = u.forwardRef(({ className: n, children: r, environment: t, ...s }, a) => /* @__PURE__ */ e.jsxs(
  E,
  {
    ref: a,
    className: c(
      "relative flex w-full px-6 py-3 cursor-pointer select-none items-center rounded-sm text-sm outline-none focus:bg-surface data-[disabled]:pointer-events-none data-[disabled]:opacity-50 border-b border-divider-medium last:border-transparent",
      n
    ),
    ...s,
    children: [
      /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-2 max-w-60", children: [
        /* @__PURE__ */ e.jsxs(
          S,
          {
            className: c(
              "flex items-center gap-1 w-fit",
              t.style.className
            ),
            children: [
              /* @__PURE__ */ e.jsx(l, { name: t.style.iconName }),
              /* @__PURE__ */ e.jsx(v, { children: r })
            ]
          }
        ),
        /* @__PURE__ */ e.jsx(I, { variant: "body-sm", children: t.description })
      ] }),
      /* @__PURE__ */ e.jsx("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ e.jsx(w, { children: /* @__PURE__ */ e.jsx(l, { name: "check", className: "h-4 w-4" }) }) })
    ]
  }
));
function T({
  value: n,
  onValueChange: r,
  environments: t
}) {
  const {
    style: { selectClassName: s }
  } = t[n];
  return /* @__PURE__ */ e.jsxs(g, { value: n, onValueChange: r, children: [
    /* @__PURE__ */ e.jsx(
      h,
      {
        className: c(
          "border-none w-fit h-fit px-2 py-0.5 font-semibold",
          s
        ),
        children: /* @__PURE__ */ e.jsx(j, {})
      }
    ),
    /* @__PURE__ */ e.jsx(N, { children: /* @__PURE__ */ e.jsx(y, { className: "p-0 m-0", children: Object.entries(t).map(([a, i], o) => /* @__PURE__ */ e.jsx(R, { environment: i, value: a, children: i.label }, o)) }) })
  ] });
}
function f({
  editable: n = !1,
  onValueChange: r,
  ...t
}) {
  const s = t.environments ?? x, a = t.value ?? Object.keys(s)[0], { label: i, style: o, prefix: p } = s[a], { className: d, iconName: b } = o;
  return /* @__PURE__ */ e.jsx("div", { className: c("w-full h-2 flex justify-center", d), children: /* @__PURE__ */ e.jsxs(
    "div",
    {
      className: c(
        "absolute flex flex-row sm:rounded-b-lg p-2 gap-1 w-full sm:w-fit h-fit items-center justify-center text-sm",
        d
      ),
      children: [
        /* @__PURE__ */ e.jsx(l, { name: b }),
        p,
        n ? /* @__PURE__ */ e.jsx(
          T,
          {
            value: a,
            onValueChange: r,
            environments: s
          }
        ) : /* @__PURE__ */ e.jsx("b", { children: i })
      ]
    }
  ) });
}
f.STYLES = m;
f.DEFAULT_ENVIRONMENTS = x;
export {
  f as EnvironmentIndicator
};
