"use client";
import { jsxs as n, jsx as e, Fragment as N } from "react/jsx-runtime";
import { CaretUpDownIcon as F, CheckIcon as A } from "@phosphor-icons/react";
import { useId as C } from "react";
import { c as g } from "./cn-Bhsu1vx2.js";
import { b as O } from "./button-Bh96oxRL.js";
import { S as P } from "./skeleton-line-CtpS1u1J.js";
import { F as T } from "./field-B8xISAuX.js";
import { aS as V, aT as U, aU as W, aV as B, aW as D, aX as R, aY as X, aZ as Y, a_ as Z, a$ as _ } from "./vendor-base-ui-Bsg5ebHI.js";
function $({
  children: r,
  className: s,
  renderValue: p,
  label: a,
  hideLabel: y = !0,
  placeholder: i,
  loading: c,
  labelTooltip: h,
  description: S,
  error: o,
  required: v,
  ...l
}) {
  const m = C(), u = l, x = u["aria-label"], k = u["aria-labelledby"], w = typeof a == "string" ? a : i, d = a && !y, f = d ? void 0 : k ?? (a ? m : void 0), I = x ?? (f ? void 0 : w);
  let t = l.items;
  i && (t ? typeof t == "object" ? t = [
    {
      value: null,
      label: i
    },
    ...Object.entries(t).map(([L, j]) => ({
      value: L,
      label: j
    }))
  ] : Array.isArray(t) && (t = [
    {
      value: null,
      label: i
    },
    ...t
  ]) : t = [
    {
      value: null,
      label: i
    }
  ]);
  const b = /* @__PURE__ */ n(
    V,
    {
      ...l,
      items: t,
      disabled: c || l.disabled,
      children: [
        /* @__PURE__ */ n(
          U,
          {
            className: g(
              O(),
              "justify-between font-normal",
              "outline-none focus:opacity-100 focus-visible:ring-1 focus-visible:ring-kumo-ring *:in-focus:opacity-100",
              l.disabled && "cursor-not-allowed opacity-50",
              s
            ),
            "aria-label": I,
            "aria-labelledby": f,
            children: [
              c ? /* @__PURE__ */ e(P, { className: "w-32" }) : /* @__PURE__ */ e(W, { children: p }),
              /* @__PURE__ */ e(B, { className: "flex items-center", children: /* @__PURE__ */ e(F, {}) })
            ]
          }
        ),
        /* @__PURE__ */ e(D, { children: /* @__PURE__ */ e(R, { children: /* @__PURE__ */ e(
          X,
          {
            className: g(
              "overflow-hidden bg-kumo-control text-kumo-default",
              // background
              "rounded-lg shadow-lg ring ring-kumo-line",
              // border part
              // 3px adjustment to account for padding + border differences
              "min-w-[calc(var(--anchor-width)+3px)] p-1.5"
              // spacing
            ),
            children: r
          }
        ) }) })
      ]
    }
  );
  return d ? /* @__PURE__ */ e(
    T,
    {
      label: a,
      required: v,
      labelTooltip: h,
      description: S,
      error: o ? typeof o == "string" ? { message: o, match: !0 } : o : void 0,
      children: b
    }
  ) : /* @__PURE__ */ n(N, { children: [
    a && /* @__PURE__ */ e("span", { id: m, className: "sr-only", children: a }),
    b
  ] });
}
function q({ children: r, value: s }) {
  return /* @__PURE__ */ n(
    Y,
    {
      value: s,
      className: "group flex cursor-pointer items-center justify-between gap-2 rounded px-2 py-1.5 text-base data-highlighted:bg-kumo-overlay",
      children: [
        /* @__PURE__ */ e(Z, { children: r }),
        /* @__PURE__ */ e(_, { children: /* @__PURE__ */ e(A, {}) })
      ]
    }
  );
}
$.Option = q;
export {
  $ as S
};
//# sourceMappingURL=select-DtcT1zGm.js.map
