'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var createEvent = function createEvent(ref) {
  if (ref.current) {
    var event = new Event('change', {
      bubbles: true
    });
    Object.defineProperty(event, 'target', {
      writable: false,
      value: ref.current
    });
    var syntheticEvent = createSyntheticEvent(event);
    return syntheticEvent;
  }
  return null;
};
var createSyntheticEvent = function createSyntheticEvent(event) {
  var _isDefaultPrevented = false;
  var _isPropagationStopped = false;
  var preventDefault = function preventDefault() {
    _isDefaultPrevented = true;
    event.preventDefault();
  };
  var stopPropagation = function stopPropagation() {
    _isPropagationStopped = true;
    event.stopPropagation();
  };
  return {
    nativeEvent: event,
    currentTarget: event.currentTarget,
    target: event.target,
    bubbles: event.bubbles,
    cancelable: event.cancelable,
    defaultPrevented: event.defaultPrevented,
    eventPhase: event.eventPhase,
    isTrusted: event.isTrusted,
    preventDefault: preventDefault,
    isDefaultPrevented: function isDefaultPrevented() {
      return _isDefaultPrevented;
    },
    stopPropagation: stopPropagation,
    isPropagationStopped: function isPropagationStopped() {
      return _isPropagationStopped;
    },
    persist: function persist() {},
    timeStamp: event.timeStamp,
    type: event.type
  };
};

exports.createEvent = createEvent;
