import React, { useReducer } from 'react';
import SlotContext, { defaultSlotConfig, SlotActionEnum, slotReducer } from './slotContext';
import { SlotParser } from './ParentComponent';
function SlotContainer({
  children
}) {
  const [slots, dispatch] = useReducer(slotReducer, defaultSlotConfig);
  const registerSlot = (site, key, children, options) => {
    dispatch({
      type: SlotActionEnum.registerSlot,
      payload: {
        site,
        key,
        children,
        options
      }
    });
  };
  const changeComponentVisible = (site, key, visible) => {
    dispatch({
      type: SlotActionEnum.changeComponentVisible,
      payload: {
        site,
        key,
        visible
      }
    });
  };
  const removeComponent = (site, key) => {
    dispatch({
      type: SlotActionEnum.removeComponent,
      payload: {
        site,
        key
      }
    });
    return true;
  };
  return /*#__PURE__*/React.createElement(SlotContext.Provider, {
    value: {
      changeComponentVisible,
      registerSlot,
      removeComponent
    }
  }, /*#__PURE__*/React.createElement(SlotParser, {
    slots: slots
  }), children);
}
export default SlotContainer;
//# sourceMappingURL=SlotContainer.js.map