import { jsx as $ } from "react/jsx-runtime";
import { useRef as u } from "react";
import { $ as c } from "./Button-C9AKe3Kt.es.js";
import { $ as P } from "./utils-CrjF8U_E.es.js";
import { createRecipeContext as x, mergeRefs as R } from "@chakra-ui/react";
import { i as v } from "./emotion-is-prop-valid.esm-BUuA3iy8.es.js";
import { s as C } from "./index-N3Xxo-X9.es.js";
import { $ as h } from "./useObjectRef-CaJ5pgjX.es.js";
import { $ as E } from "./mergeProps-B-cqsBhL.es.js";
import { $ as y } from "./useButton-C0YxSZ4p.es.js";
const B = [
  "onPress",
  "onPressStart",
  "onPressEnd",
  "onPressChange",
  "onPressUp",
  "onFocusChange",
  "onHoverStart",
  "onHoverEnd",
  "onHoverChange",
  "onMoveStart",
  "onMove",
  "onMoveEnd"
], g = (o) => B.some((t) => o.includes(t)), { withContext: S } = /* @__PURE__ */ x({
  key: "nimbusButton"
}), A = /* @__PURE__ */ S(
  "button",
  {
    defaultProps: {
      type: "button"
    },
    /**
     * Filter out React Aria-specific props that shouldn't reach the DOM.
     * These props are consumed by useButton() but may still be present in
     * contextProps from ButtonContext slots.
     */
    shouldForwardProp(o, t) {
      const e = !t?.includes(o) && !C.isValidProperty(o);
      return v(o) && e && !g(o);
    }
  }
), d = (o) => {
  const { ref: t, as: e, asChild: r, children: i, ...f } = o, m = u(null), p = h(R(m, t)), [s, a] = P(
    f,
    p,
    c
  ), b = e || (r ? "a" : "button"), { buttonProps: l } = y(
    {
      ...s,
      elementType: b
    },
    a
  ), n = E(s, l, {
    as: e,
    asChild: r,
    /**
     * In case `slot` was null, the `useContextProps` hook already
     * processed it at this point, so it's safe to not attach it
     * to the DOM element
     */
    slot: s.slot || void 0
  });
  return /* @__PURE__ */ $(
    A,
    {
      ref: a,
      ...n,
      "aria-disabled": n.isDisabled || void 0,
      "data-disabled": n.isDisabled || void 0,
      children: i
    }
  );
};
d.displayName = "Button";
const N = /* @__PURE__ */ Object.assign(d, {
  Context: c
});
export {
  N as B
};
//# sourceMappingURL=button-BX2O6MQP.es.js.map
