function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

import React, { createContext, useContext, useReducer } from 'react';
export var defaultState = {
  theme: 'dark',
  blogUrl: '/',
  Link: undefined
};

var dragonKitReducer = function dragonKitReducer(state, data) {
  switch (data.type) {
    case 'blogUrl':
    case 'Link':
    case 'theme':
      {
        var _extends2;

        var type = data.type;
        return _extends({}, state, (_extends2 = {}, _extends2[type] = data[type], _extends2));
      }

    default:
      return state;
  }
};

export var DragonKitContext = createContext();
export var DragonKitProvider = function DragonKitProvider(_ref) {
  var initialState = _ref.initialState,
      children = _ref.children;
  return /*#__PURE__*/React.createElement(DragonKitContext.Provider, {
    value: useReducer(dragonKitReducer, initialState)
  }, children);
};
export var useDragonKitValue = function useDragonKitValue() {
  return useContext(DragonKitContext);
};