import * as React from "react";
import y from "../../../../../../../../../_virtual/index12.js";
import { composeRefs } from "../../../../../../../@radix-ui_react-compose-refs@1.1.2_@types_react@19.1.13_react@19.1.1/node_modules/@radix-ui/react-compose-refs/dist/index.js";
import { textFieldRootPropDefs as f, textFieldSlotPropDefs as i } from "./text-field.props.js";
import { extractProps as v } from "../helpers/extract-props.js";
import { marginPropDefs as r } from "../props/margin.props.js";
const u = React.forwardRef((r$1, s) => {
  const e = React.useRef(null), { children: l, className: i2, color: p, radius: f$1, style: x, ...P } = v(r$1, f, r);
  return React.createElement("div", { "data-accent-color": p, "data-radius": f$1, style: x, className: y("rt-TextFieldRoot", i2), onPointerDown: (T) => {
    const n = T.target;
    if (n.closest("input, button, a")) return;
    const o = e.current;
    if (!o) return;
    const a = n.closest(`
            .rt-TextFieldSlot[data-side='right'],
            .rt-TextFieldSlot:not([data-side='right']) ~ .rt-TextFieldSlot:not([data-side='left'])
          `) ? o.value.length : 0;
    requestAnimationFrame(() => {
      try {
        o.setSelectionRange(a, a);
      } catch {
      }
      o.focus();
    });
  } }, React.createElement("input", { spellCheck: "false", ...P, ref: composeRefs(e, s), className: "rt-reset rt-TextFieldInput" }), l);
});
u.displayName = "TextField.Root";
const c = React.forwardRef((r2, s) => {
  const { className: e, color: l, side: i$1, ...p } = v(r2, i);
  return React.createElement("div", { "data-accent-color": l, "data-side": i$1, ...p, ref: s, className: y("rt-TextFieldSlot", e) });
});
c.displayName = "TextField.Slot";
export {
  u as Root,
  c as Slot
};
//# sourceMappingURL=text-field.js.map
