import { $ as d } from "./mergeProps-B-cqsBhL.es.js";
import { $ as C } from "./filterDOMProps-Cxz9cAAv.es.js";
import { $ as T } from "./usePress-UxAvyvOO.es.js";
import { $ as v } from "./useFocusable-C4Re42UX.es.js";
function O(e, t) {
  let { elementType: a = "button", isDisabled: r, onPress: i, onPressStart: f, onPressEnd: l, onPressUp: c, onPressChange: u, preventFocusOnPress: b, allowFocusWhenDisabled: P, onClick: m, href: $, target: p, rel: h, type: o = "button" } = e, s;
  a === "button" ? s = {
    type: o,
    disabled: r,
    form: e.form,
    formAction: e.formAction,
    formEncType: e.formEncType,
    formMethod: e.formMethod,
    formNoValidate: e.formNoValidate,
    formTarget: e.formTarget,
    name: e.name,
    value: e.value
  } : s = {
    role: "button",
    href: a === "a" && !r ? $ : void 0,
    target: a === "a" ? p : void 0,
    type: a === "input" ? o : void 0,
    disabled: a === "input" ? r : void 0,
    "aria-disabled": !r || a === "input" ? void 0 : r,
    rel: a === "a" ? h : void 0
  };
  let { pressProps: x, isPressed: g } = T({
    onPressStart: f,
    onPressEnd: l,
    onPressChange: u,
    onPress: i,
    onPressUp: c,
    onClick: m,
    isDisabled: r,
    preventFocusOnPress: b,
    ref: t
  }), { focusableProps: n } = v(e, t);
  P && (n.tabIndex = r ? -1 : n.tabIndex);
  let y = d(n, x, C(e, {
    labelable: !0
  }));
  return {
    isPressed: g,
    buttonProps: d(s, y, {
      "aria-haspopup": e["aria-haspopup"],
      "aria-expanded": e["aria-expanded"],
      "aria-controls": e["aria-controls"],
      "aria-pressed": e["aria-pressed"],
      "aria-current": e["aria-current"],
      "aria-disabled": e["aria-disabled"]
    })
  };
}
export {
  O as $
};
//# sourceMappingURL=useButton-C0YxSZ4p.es.js.map
