import { ActionTypes, isKnownAction } from "../actions";
function getInitialState({
  propControllerDescriptors = /* @__PURE__ */ new Map()
} = {}) {
  return propControllerDescriptors;
}
function getPropControllerDescriptors(state) {
  return state;
}
function getComponentPropControllerDescriptors(state, componentType) {
  return getPropControllerDescriptors(state).get(componentType) ?? null;
}
function reducer(state = getInitialState(), action) {
  if (!isKnownAction(action))
    return state;
  switch (action.type) {
    case ActionTypes.REGISTER_COMPONENT:
      return new Map(state).set(action.payload.type, action.payload.propControllerDescriptors);
    case ActionTypes.UNREGISTER_COMPONENT: {
      const nextState = new Map(state);
      const deleted = nextState.delete(action.payload.type);
      return deleted ? nextState : state;
    }
    default:
      return state;
  }
}
export {
  getComponentPropControllerDescriptors,
  getInitialState,
  getPropControllerDescriptors,
  reducer
};
//# sourceMappingURL=prop-controllers.js.map