// packages/keyboard-shortcuts/src/components/shortcut-provider.js
import { useState } from "@wordpress/element";
import { context } from "../context.mjs";
import { jsx } from "react/jsx-runtime";
var { Provider } = context;
function ShortcutProvider(props) {
  const [keyboardShortcuts] = useState(() => /* @__PURE__ */ new Set());
  function onKeyDown(event) {
    if (props.onKeyDown) {
      props.onKeyDown(event);
    }
    for (const keyboardShortcut of keyboardShortcuts) {
      keyboardShortcut(event);
    }
  }
  return /* @__PURE__ */ jsx(Provider, { value: keyboardShortcuts, children: /* @__PURE__ */ jsx("div", { ...props, onKeyDown }) });
}
export {
  ShortcutProvider
};
//# sourceMappingURL=shortcut-provider.mjs.map
