import * as e from "react";
import { useStableCallback as a } from "../../../../../../@base-ui_utils@0.2.4_@types_react@18.3.27_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/esm/useStableCallback.js";
import { useEnhancedClickHandler as u } from "../../../../../../@base-ui_utils@0.2.4_@types_react@18.3.27_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/esm/useEnhancedClickHandler.js";
import { isIOS as p } from "../../../../../../@base-ui_utils@0.2.4_@types_react@18.3.27_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/esm/detectBrowser.js";
function k(c) {
  const [o, t] = e.useState(null), i = a((m, l) => {
    c || t(l || // On iOS Safari, the hitslop around touch targets means tapping outside an element's
    // bounds does not fire `pointerdown` but does fire `mousedown`. The `interactionType`
    // will be "" in that case.
    (p ? "touch" : ""));
  }), n = e.useCallback(() => {
    t(null);
  }, []), {
    onClick: r,
    onPointerDown: s
  } = u(i);
  return e.useMemo(() => ({
    openMethod: o,
    reset: n,
    triggerProps: {
      onClick: r,
      onPointerDown: s
    }
  }), [o, n, r, s]);
}
export {
  k as useOpenInteractionType
};
