"use client";
import { jsx as o, jsxs as c } from "react/jsx-runtime";
import { CheckIcon as w, XIcon as d, CaretDownIcon as x } from "@phosphor-icons/react";
import { createContext as T, useContext as u, Fragment as V } from "react";
import { i as p, K as P } from "./input-c8jmidy7gdqfiky1.js";
import { c as a } from "./cn-ct4n7r74mh8y0f48.js";
import { F as j } from "./field-csje72m7j9403fj5.js";
import { a5 as G, a6 as L, a7 as M, a8 as F, a9 as _, aa as A, ab as g, ac as E, ad as K, ae as O, af as U, ag as W, ah as f, ai as D, aj as C, ak as N, al as H, am as X, an as q } from "./vendor-base-ui-ccr5l0ynrievzzv3.js";
P.size;
const h = T("base");
function y({
  label: e,
  required: t,
  labelTooltip: i,
  description: r,
  error: n,
  children: s,
  size: l = "base",
  ...m
}) {
  const b = /* @__PURE__ */ o(h.Provider, { value: l, children: /* @__PURE__ */ o(L, { ...m, children: s }) });
  return e ? /* @__PURE__ */ o(
    j,
    {
      label: e,
      required: t,
      labelTooltip: i,
      description: r,
      error: n ? typeof n == "string" ? { message: n, match: !0 } : n : void 0,
      children: b
    }
  ) : b;
}
function z({
  children: e,
  className: t,
  align: i = "start",
  sideOffset: r = 4,
  alignOffset: n,
  side: s
}) {
  return /* @__PURE__ */ o(H, { children: /* @__PURE__ */ o(
    X,
    {
      className: "",
      align: i,
      sideOffset: r,
      alignOffset: n,
      side: s,
      children: /* @__PURE__ */ o(
        q,
        {
          className: a(
            "flex flex-col",
            // flexbox layout for sticky input + scrollable list
            "max-h-[min(var(--available-height),24rem)] max-w-(--available-width) min-w-(--anchor-width) py-1.5",
            "bg-kumo-base text-kumo-default",
            // background
            "rounded-lg shadow-lg ring ring-kumo-line",
            // border part
            t
          ),
          children: e
        }
      )
    }
  ) });
}
const B = {
  xs: { padding: "pr-5", iconSize: 12, iconRight: "right-1" },
  sm: { padding: "pr-6", iconSize: 14, iconRight: "right-1.5" },
  base: { padding: "pr-8", iconSize: 16, iconRight: "right-2" },
  lg: { padding: "pr-10", iconSize: 18, iconRight: "right-3" }
};
function R({
  className: e,
  ...t
}) {
  const i = u(h), r = B[i];
  return /* @__PURE__ */ c(
    C,
    {
      className: a(
        p({ size: i }),
        "relative flex items-center",
        r.padding,
        e
      ),
      children: [
        /* @__PURE__ */ o(f, { children: t.children }),
        /* @__PURE__ */ o(
          N,
          {
            className: a(
              "absolute top-1/2 -translate-y-1/2 flex items-center text-kumo-subtle",
              r.iconRight
            ),
            children: /* @__PURE__ */ o(x, { size: r.iconSize, className: "fill-current" })
          }
        )
      ]
    }
  );
}
const J = {
  xs: {
    padding: "pr-7",
    iconSize: 12,
    clearRight: "right-5",
    caretRight: "right-1"
  },
  sm: {
    padding: "pr-9",
    iconSize: 14,
    clearRight: "right-6",
    caretRight: "right-1.5"
  },
  base: {
    padding: "pr-12",
    iconSize: 16,
    clearRight: "right-8",
    caretRight: "right-2"
  },
  lg: {
    padding: "pr-14",
    iconSize: 18,
    clearRight: "right-9",
    caretRight: "right-3"
  }
};
function v(e) {
  const t = u(h), i = J[t];
  return /* @__PURE__ */ c(
    "div",
    {
      className: a("relative inline-block w-full max-w-xs", e.className),
      children: [
        /* @__PURE__ */ o(
          g,
          {
            ...e,
            className: a(p({ size: t }), "w-full", i.padding)
          }
        ),
        /* @__PURE__ */ o(
          D,
          {
            className: a(
              "absolute top-1/2 flex -translate-y-1/2 cursor-pointer bg-transparent p-0",
              i.clearRight
            ),
            children: /* @__PURE__ */ o(d, { size: i.iconSize })
          }
        ),
        /* @__PURE__ */ o(C, { className: "p-0", children: /* @__PURE__ */ o(
          N,
          {
            className: a(
              "absolute top-1/2 flex -translate-y-1/2 cursor-pointer text-kumo-subtle",
              i.caretRight
            ),
            children: /* @__PURE__ */ o(x, { size: i.iconSize, className: "fill-current" })
          }
        ) })
      ]
    }
  );
}
function I({ children: e, ...t }) {
  return /* @__PURE__ */ c(
    E,
    {
      ...t,
      className: "group mx-1.5 grid cursor-pointer grid-cols-[1fr_16px] gap-2 rounded px-2 py-1.5 text-base data-highlighted:bg-kumo-tint",
      children: [
        /* @__PURE__ */ o("div", { className: "col-start-1", children: e }),
        /* @__PURE__ */ o(K, { className: "col-start-2 flex items-center", children: /* @__PURE__ */ o(w, {}) })
      ]
    }
  );
}
function Q(e) {
  return /* @__PURE__ */ o(
    A,
    {
      ...e,
      className: a(
        "mx-1.5 shrink-0 px-4 py-2 text-[0.925rem] leading-4 text-kumo-subtle empty:m-0 empty:p-0"
      ),
      children: e.children ?? "No labels found."
    }
  );
}
function Y(e) {
  return /* @__PURE__ */ o(
    g,
    {
      ...e,
      className: a(
        p(),
        "mx-1.5 w-[calc(100%-0.75rem)] shrink-0 first:mb-2",
        e.className
      )
    }
  );
}
function Z({
  className: e,
  ...t
}) {
  return /* @__PURE__ */ o(
    M,
    {
      ...t,
      className: a(
        "min-h-0 flex-1 overflow-y-auto overscroll-contain scroll-pt-2 scroll-pb-2",
        e
      )
    }
  );
}
function $(e) {
  return /* @__PURE__ */ o(
    _,
    {
      ...e,
      className: a(
        "mx-1.5 px-2 py-1.5 text-sm text-kumo-strong",
        e.className
      )
    }
  );
}
function ee(e) {
  return /* @__PURE__ */ o(
    F,
    {
      ...e,
      className: "border-t border-kumo-line mt-2 pt-2 first:border-t-0 first:mt-0 first:pt-0"
    }
  );
}
function k(e) {
  return /* @__PURE__ */ c(
    O,
    {
      ...e,
      className: a(
        "flex items-center gap-2.5",
        // Layout
        "h-6 pl-2 pr-[3px]",
        // Dimensions
        "rounded-sm ring-1 ring-kumo-line",
        // Border
        "bg-kumo-overlay",
        // Background
        "text-sm"
        // Typography
      ),
      children: [
        e.children,
        /* @__PURE__ */ o(
          U,
          {
            className: a(
              "cursor-pointer rounded-md p-1 hover:bg-kumo-fill-hover",
              "bg-transparent flex"
            ),
            children: /* @__PURE__ */ o(d, { size: 10 })
          }
        )
      ]
    }
  );
}
const oe = {
  xs: "min-h-5",
  sm: "min-h-6.5",
  base: "min-h-9",
  lg: "min-h-10"
};
function S({
  placeholder: e,
  renderItem: t,
  className: i,
  inputSide: r = "right",
  value: n
}) {
  const s = u(h), l = n;
  return /* @__PURE__ */ c(
    W,
    {
      className: a(
        p({ size: s }),
        "flex flex-col",
        "gap-1 py-1 px-1.5",
        oe[s],
        "h-auto",
        i
      ),
      children: [
        r === "top" && /* @__PURE__ */ o(
          g,
          {
            placeholder: e,
            className: "w-full px-2 py-1 border-0 bg-inherit"
          }
        ),
        /* @__PURE__ */ c("div", { className: "flex items-center flex-wrap gap-1.5 flex-1", children: [
          l !== void 0 && l.length > 0 && l.map((m) => t(m)),
          /* @__PURE__ */ o(f, { children: (m) => l !== void 0 ? null : /* @__PURE__ */ o(V, { children: m.map((b) => t(b)) }) }),
          r === "right" && /* @__PURE__ */ o(
            g,
            {
              placeholder: e,
              className: "min-w-[100px] flex-1 px-2 py-1 border-0 bg-inherit"
            }
          )
        ] })
      ]
    }
  );
}
y.displayName = "Combobox.Root";
z.displayName = "Combobox.Content";
R.displayName = "Combobox.TriggerValue";
v.displayName = "Combobox.TriggerInput";
I.displayName = "Combobox.Item";
k.displayName = "Combobox.Chip";
S.displayName = "Combobox.TriggerMultipleWithInput";
const ce = Object.assign(y, {
  // Helper components
  Content: z,
  TriggerValue: R,
  TriggerInput: v,
  TriggerMultipleWithInput: S,
  // Slightly modified BaseUI
  Chip: k,
  Item: I,
  // Styled BaseUI
  Input: Y,
  Empty: Q,
  GroupLabel: $,
  Group: ee,
  // Styled BaseUI
  List: Z,
  // BaseUI
  Collection: G
});
export {
  ce as C
};
//# sourceMappingURL=combobox-ft0u7rfaxawk0r0c.js.map
