"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.withUid = exports.generateId = exports.Provider = exports.Consumer = void 0;

var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));

var _react = _interopRequireDefault(require("react"));

var _React$createContext = /*#__PURE__*/_react["default"].createContext(-1),
    Consumer = _React$createContext.Consumer,
    Provider = _React$createContext.Provider;

exports.Provider = Provider;
exports.Consumer = Consumer;

var generateId = function generateId() {
  return (Math.random() * 1000001).toFixed(0);
};

exports.generateId = generateId;

var withUid = function withUid(Component) {
  var Wrapped = function Wrapped(props) {
    return /*#__PURE__*/_react["default"].createElement(Consumer, null, function (uid) {
      return /*#__PURE__*/_react["default"].createElement(Component, (0, _extends2["default"])({}, props, {
        uid: uid
      }));
    });
  };

  return Wrapped;
};

exports.withUid = withUid;
//# sourceMappingURL=uid-context.js.map