import { __assign } from "../../../../../../../tslib@2.6.2/node_modules/tslib/tslib.es6.js";
import * as React from "react";
import { useContext } from "react";
import { env } from "../../utils/process.js";
import { featureDefinitions } from "./definitions.js";
import { invariant } from "../../../../../../../hey-listen@1.0.8/node_modules/hey-listen/dist/hey-listen.es.js";
import { LazyContext } from "../../context/LazyContext.js";
var featureNames = Object.keys(featureDefinitions);
var numFeatures = featureNames.length;
function useFeatures(props, visualElement, preloadedFeatures) {
  var features = [];
  var lazyContext = useContext(LazyContext);
  if (!visualElement)
    return null;
  if (env !== "production" && preloadedFeatures && lazyContext.strict) {
    invariant(false, "You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.");
  }
  for (var i = 0; i < numFeatures; i++) {
    var name_1 = featureNames[i];
    var _a = featureDefinitions[name_1], isEnabled = _a.isEnabled, Component = _a.Component;
    if (isEnabled(props) && Component) {
      features.push(React.createElement(Component, __assign({ key: name_1 }, props, { visualElement })));
    }
  }
  return features;
}
export {
  useFeatures
};
//# sourceMappingURL=use-features.js.map
