text: /**
   * VueLayers
   * Web map Vue components with the power of OpenLayers
   *
   * @package vuelayers
   * @author Vladimir Vershinin <ghettovoice@gmail.com>
   * @version 0.11.4
   * @license MIT
   * @copyright (c) 2017-2019, Vladimir Vershinin <ghettovoice@gmail.com>
   */
  import _typeof from '@babel/runtime-corejs2/helpers/esm/typeof';
  import _toConsumableArray from '@babel/runtime-corejs2/helpers/esm/toConsumableArray';
  import _Array$isArray from '@babel/runtime-corejs2/core-js/array/is-array';
  import { fromEventPattern } from 'rxjs/_esm5/internal/observable/fromEventPattern';
  import { merge } from 'rxjs/_esm5/internal/observable/merge';
  
  /**
   * Creates an Observable using OpenLayers event pattern that emits events coming from the given event target.
   *
   * @example **Subscribe on view center change events**
   * const map = ol.Map({ ... })
   * const changes = Observable.fromOlEvent(map.getView(), 'change:center')
   *
   * changes.subscribe(({ coordinate }) => console.log(coordinate))
   *
   * @param {ol.Object} target OpenLayers event target.
   * @param {string|Object[]} eventName The event name of interest, being emitted by the `target`
   *                          or an array of events/selectors like `[{ event: 'event1', selector?: x => x }, ...]`.
   * @param {function(...*): *} [selector] An optional function to post-process results. It takes the arguments
   *    from the event handler and should return a single value.
   * @return {Observable<T>}
   * @memberOf {Observable}
   */
  
  function fromOlEvent(target, eventName, selector) {
    if (_Array$isArray(eventName)) {
      return merge.apply(void 0, _toConsumableArray(eventName.map(function (elem) {
        var eventName, selector;
  
        if (_typeof(elem) === 'object') {
          eventName = elem.event;
          selector = elem.selector;
        } else {
          eventName = elem;
        }
  
        return fromOlEvent(target, eventName, selector);
      })));
    }
  
    return fromEventPattern(function (handler) {
      return target.on(eventName, handler);
    }, function (handler) {
      return target.un(eventName, handler);
    }, selector);
  }
  
  export default fromOlEvent;
  