Liferay.Loader.define("data-engine-taglib@2.5.29/data_layout_builder/js/data-layout-builder/EventEmitter.es", ['module', 'exports', 'require'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    exports.default = void 0;

    function _typeof(obj) {
      "@babel/helpers - typeof";
      if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
        _typeof = function _typeof(obj) {
          return typeof obj;
        };
      } else {
        _typeof = function _typeof(obj) {
          return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
        };
      }return _typeof(obj);
    }

    function _classCallCheck(instance, Constructor) {
      if (!(instance instanceof Constructor)) {
        throw new TypeError("Cannot call a class as a 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);
      }
    }

    function _createClass(Constructor, protoProps, staticProps) {
      if (protoProps) _defineProperties(Constructor.prototype, protoProps);if (staticProps) _defineProperties(Constructor, staticProps);return Constructor;
    }

    /**
     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
     *
     * This library is free software; you can redistribute it and/or modify it under
     * the terms of the GNU Lesser General Public License as published by the Free
     * Software Foundation; either version 2.1 of the License, or (at your option)
     * any later version.
     *
     * This library is distributed in the hope that it will be useful, but WITHOUT
     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
     * details.
     */
    var EventEmitter = /*#__PURE__*/function () {
      function EventEmitter() {
        _classCallCheck(this, EventEmitter);

        this.events = {};
      }

      _createClass(EventEmitter, [{
        key: "on",
        value: function on(event, listener) {
          var _this = this;

          if (_typeof(this.events[event]) !== 'object') {
            this.events[event] = [];
          }

          this.events[event].push(listener);
          return function () {
            return _this.removeListener(event, listener);
          };
        }
      }, {
        key: "removeListener",
        value: function removeListener(event, listener) {
          if (_typeof(this.events[event]) === 'object') {
            var idx = this.events[event].indexOf(listener);

            if (idx > -1) {
              this.events[event].splice(idx, 1);
            }
          }
        }
      }, {
        key: "emit",
        value: function emit(event) {
          var _this2 = this;

          for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
            args[_key - 1] = arguments[_key];
          }

          if (_typeof(this.events[event]) === 'object') {
            this.events[event].forEach(function (listener) {
              return listener.apply(_this2, args);
            });
          }
        }
      }, {
        key: "once",
        value: function once(event, listener) {
          var _this3 = this;

          var remove = this.on(event, function () {
            remove();

            for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
              args[_key2] = arguments[_key2];
            }

            listener.apply(_this3, args);
          });
        }
      }]);

      return EventEmitter;
    }();

    exports.default = EventEmitter;
    //# sourceMappingURL=EventEmitter.es.js.map
  }
});
//# sourceMappingURL=EventEmitter.es.js.map