"use client";
import { jsx as e, jsxs as i } from "react/jsx-runtime";
import { CheckIcon as k, XIcon as p, CaretDownIcon as d } from "@phosphor-icons/react";
import { Fragment as T } from "react";
import { i as b } from "./input-Dqvc2AB_.js";
import { c as l } from "./cn-Bhsu1vx2.js";
import { F as R } from "./field-V3J0Ql_V.js";
import { P as V, Q as G, U as L, V as P, W as j, X as z, Y as u, Z as F, _ as W, $ as E, a0 as M, a1 as X, a2 as x, a3 as _, a4 as h, a5 as g, a6 as D, a7 as O, a8 as Q } from "./vendor-base-ui-DWIDNgE1.js";
function f({
  label: o,
  required: a,
  labelTooltip: s,
  description: n,
  error: t,
  children: r,
  ...m
}) {
  const c = /* @__PURE__ */ e(L, { ...m, children: r });
  return o ? /* @__PURE__ */ e(
    R,
    {
      label: o,
      required: a,
      labelTooltip: s,
      description: n,
      error: t ? typeof t == "string" ? { message: t, match: !0 } : t : void 0,
      children: c
    }
  ) : c;
}
function C({
  children: o,
  className: a,
  align: s = "start",
  sideOffset: n = 4,
  alignOffset: t,
  side: r
}) {
  return /* @__PURE__ */ e(D, { children: /* @__PURE__ */ e(
    O,
    {
      className: "z-50 outline-none",
      align: s,
      sideOffset: n,
      alignOffset: t,
      side: r,
      children: /* @__PURE__ */ e(
        Q,
        {
          className: l(
            "max-h-[min(var(--available-height),24rem)] max-w-(--available-width) min-w-(--anchor-width) scroll-pt-2 scroll-pb-2 overflow-y-auto overscroll-contain p-1.5",
            "z-50 overflow-hidden bg-kumo-control text-kumo-default",
            // background
            "rounded-lg shadow-lg ring ring-kumo-line",
            // border part
            a
          ),
          children: o
        }
      )
    }
  ) });
}
function N({
  className: o,
  ...a
}) {
  return /* @__PURE__ */ i(
    h,
    {
      className: l(
        b(),
        "relative flex items-center pr-8",
        o
      ),
      children: [
        /* @__PURE__ */ e(x, { children: a.children }),
        /* @__PURE__ */ e(g, { className: "absolute top-1/2 right-2 -translate-y-1/2", children: /* @__PURE__ */ e(d, { className: "fill-kumo-ring" }) })
      ]
    }
  );
}
function y(o) {
  return /* @__PURE__ */ i(
    "div",
    {
      className: l("relative inline-block w-full max-w-xs", o.className),
      children: [
        /* @__PURE__ */ e(
          u,
          {
            ...o,
            className: l(b(), "w-full pr-12")
          }
        ),
        /* @__PURE__ */ e(_, { className: "absolute top-1/2 right-8 flex -translate-y-1/2 cursor-pointer bg-transparent p-0", children: /* @__PURE__ */ e(p, {}) }),
        /* @__PURE__ */ e(h, { className: "p-0", children: /* @__PURE__ */ e(g, { className: "absolute top-1/2 right-2 flex -translate-y-1/2 cursor-pointer", children: /* @__PURE__ */ e(d, { className: "fill-kumo-ring" }) }) })
      ]
    }
  );
}
function v({ children: o, ...a }) {
  return /* @__PURE__ */ i(
    F,
    {
      ...a,
      className: "group grid cursor-pointer grid-cols-[1fr_16px] gap-2 rounded px-2 py-1.5 text-base data-highlighted:bg-kumo-overlay",
      children: [
        /* @__PURE__ */ e("div", { className: "col-start-1", children: o }),
        /* @__PURE__ */ e(W, { className: "col-start-2 flex items-center", children: /* @__PURE__ */ e(k, {}) })
      ]
    }
  );
}
function U(o) {
  return /* @__PURE__ */ e(
    z,
    {
      ...o,
      className: l(
        "px-4 py-2 text-[0.925rem] leading-4 text-kumo-subtle empty:m-0 empty:p-0"
      ),
      children: o.children ?? "No labels found."
    }
  );
}
function Y(o) {
  return /* @__PURE__ */ e(
    u,
    {
      ...o,
      className: l(b(), "w-full first:mb-2", o.className)
    }
  );
}
function Z(o) {
  return /* @__PURE__ */ e(
    j,
    {
      ...o,
      className: "ml-[16px] px-4 py-1.5 text-sm font-medium"
    }
  );
}
function $(o) {
  return /* @__PURE__ */ e(P, { ...o, className: "mt-2 first:mt-0" });
}
function w(o) {
  return /* @__PURE__ */ i(
    E,
    {
      ...o,
      className: "flex items-center gap-1 rounded-md bg-kumo-overlay px-2 py-1",
      children: [
        o.children,
        /* @__PURE__ */ e(M, { className: "cursor-pointer rounded-md p-1 hover:bg-kumo-fill-hover", children: /* @__PURE__ */ e(p, { size: 12, weight: "bold" }) })
      ]
    }
  );
}
function I({
  placeholder: o,
  renderItem: a,
  className: s,
  inputSide: n = "right",
  value: t
}) {
  const r = t;
  return /* @__PURE__ */ i(
    X,
    {
      className: l(
        b(),
        l("flex flex-col", "gap-1 p-1", "min-h-9", "h-auto"),
        s
      ),
      children: [
        n === "top" && /* @__PURE__ */ e(
          u,
          {
            placeholder: o,
            className: "w-full px-2 py-1 outline-none"
          }
        ),
        /* @__PURE__ */ i("div", { className: "flex flex-wrap gap-1", children: [
          r !== void 0 && r.length > 0 && r.map((m) => a(m)),
          /* @__PURE__ */ e(x, { children: (m) => r !== void 0 ? null : /* @__PURE__ */ e(T, { children: m.map((c) => a(c)) }) }),
          n === "right" && /* @__PURE__ */ e(
            u,
            {
              placeholder: o,
              className: "min-w-[100px] flex-1 px-2 py-1 outline-none"
            }
          )
        ] })
      ]
    }
  );
}
f.displayName = "Combobox.Root";
C.displayName = "Combobox.Content";
N.displayName = "Combobox.TriggerValue";
y.displayName = "Combobox.TriggerInput";
v.displayName = "Combobox.Item";
w.displayName = "Combobox.Chip";
I.displayName = "Combobox.TriggerMultipleWithInput";
const oo = Object.assign(f, {
  // Helper components
  Content: C,
  TriggerValue: N,
  TriggerInput: y,
  TriggerMultipleWithInput: I,
  // Slightly modified BaseUI
  Chip: w,
  Item: v,
  // Styled BaseUI
  Input: Y,
  Empty: U,
  GroupLabel: Z,
  Group: $,
  // BaseUI
  List: G,
  Collection: V
});
export {
  oo as C
};
//# sourceMappingURL=combobox-Dld0kS0U.js.map
