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

var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();

function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }

/** @babel */

var ReporterProxy = (function () {
  function ReporterProxy() {
    _classCallCheck(this, ReporterProxy);

    this.reporter = null;
    this.queue = [];
  }

  _createClass(ReporterProxy, [{
    key: 'setReporter',
    value: function setReporter(reporter) {
      this.reporter = reporter;
      var event = undefined;
      while (event = this.queue.shift()) {
        var _reporter;

        (_reporter = this.reporter).sendEvent.apply(_reporter, _toConsumableArray(event));
      }
    }
  }, {
    key: 'sendEvent',
    value: function sendEvent(action, label, value) {
      if (this.reporter) {
        this.reporter.sendEvent('welcome-v1', action, label, value);
      } else {
        this.queue.push(['welcome-v1', action, label, value]);
      }
    }
  }]);

  return ReporterProxy;
})();

exports['default'] = ReporterProxy;
module.exports = exports['default'];
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9idWlsZC9hdG9tL3NyYy9hdG9tLTEuMTUuMC9vdXQvYXBwL25vZGVfbW9kdWxlcy93ZWxjb21lL2xpYi9yZXBvcnRlci1wcm94eS5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7SUFFcUIsYUFBYTtBQUNwQixXQURPLGFBQWEsR0FDakI7MEJBREksYUFBYTs7QUFFO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