import { jsx as f } from "react/jsx-runtime";
import { useCallback as d } from "react";
import { BaseInput as Y } from "../../../input/InputPrimitive.js";
import Z from "../../hooks/useInputGroupContext.js";
import _ from "../../../input/hooks/useInputMask.js";
import { c as x } from "../../../../index-BtlgVD4m.js";
import { inputGroupSizes as $ } from "../../types/InputGroupSize.js";
import B from "../../../../utils/pickFieldAriaProps.js";
const F = ({
  ref: o,
  id: y,
  type: h,
  value: u,
  inputMode: g,
  disabled: I,
  readOnly: k,
  name: b,
  placeholder: C,
  onChange: R,
  onFocus: n,
  onBlur: c,
  maxLength: v,
  autoComplete: M,
  mask: O,
  ...S
}) => {
  const { size: z, disabled: G, readOnly: L, inputProps: e, inputRef: s } = Z(), N = d(
    (t) => {
      s && (s.current = t), typeof o == "function" ? o(t) : o && (o.current = t);
    },
    [o, s]
  ), w = y ?? (e == null ? void 0 : e.id), l = h ?? (e == null ? void 0 : e.type) ?? "text", j = u ?? (e == null ? void 0 : e.value), p = g ?? (e == null ? void 0 : e.inputMode) ?? "text", A = b ?? (e == null ? void 0 : e.name), D = C ?? (e == null ? void 0 : e.placeholder), H = v ?? (e == null ? void 0 : e.maxLength), q = M ?? (e == null ? void 0 : e.autoComplete), a = R ?? (e == null ? void 0 : e.onChange), E = k ?? (e == null ? void 0 : e.readOnly) ?? L, J = O ?? (e == null ? void 0 : e.mask), K = B(e ?? {}), m = I ?? G, r = !!(E && !m), i = $[z], Q = d(
    (t) => {
      l === "file" ? a == null || a(t.target.files) : a == null || a(t.target.value);
    },
    [a, l]
  ), T = d(
    (t) => {
      n == null || n(t);
    },
    [n]
  ), U = d(
    (t) => {
      c == null || c(t);
    },
    [c]
  ), { mergedRef: V, isMasked: W } = _({
    mask: l !== "file" ? J : void 0,
    ref: N,
    onChange: a
  }), X = x(
    // Base layout - takes remaining space
    "flex",
    "flex-1 min-w-0 items-center",
    // Height based on size
    i.height,
    // Font styles
    i.fontSize,
    i.lineHeight,
    // Disabled state
    m && "cursor-not-allowed",
    r && "cursor-default",
    // File input specific
    l === "file" && "p-0"
  );
  return /* @__PURE__ */ f("div", { className: X, style: { order: 3 }, "data-control": !0, children: /* @__PURE__ */ f(
    Y,
    {
      ref: V,
      id: w,
      type: l,
      name: A,
      inputMode: p,
      disabled: m,
      className: x(r && "disabled:cursor-default disabled:opacity-100"),
      placeholder: D,
      autoComplete: q,
      onFocus: T,
      onBlur: U,
      ...!W && { onChange: Q, maxLength: H },
      ...l !== "file" && { value: j },
      ...K,
      ...S
    }
  ) });
};
F.displayName = "InputGroupInput";
export {
  F as default
};
//# sourceMappingURL=InputGroupInput.js.map
