hunk.code_window:  * that, when applied to an item emitted by the source Observable, returns an
    * Observable.
    * @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of input
    * Observables being subscribed to concurrently.
    * @return {Observable} An Observable that emits the result of applying the
    * projection function (and the optional `resultSelector`) to each item emitted
    * by the source Observable and merging the results of the Observables obtained
    * from this transformation.
    * @method mergeMap
    * @owner Observable
    */
  
hunk.labels: keep keep keep keep keep replace replace replace keep keep keep
hunk.after_edit:  * projection function (and the optional deprecated `resultSelector`) to each item
    * emitted by the source Observable and merging the results of the Observables
    * obtained from this transformation.
  
hunk.file_path: src/internal/operators/mergeMap.ts
hunk.type: replace
file: import { Observable } from 'rxjs';
  import { distinct as higherOrder } from 'rxjs/operators';
  
  /**
   * Returns an Observable that emits all items emitted by the source Observable that are distinct by comparison from previous items.
   *
   * If a keySelector function is provided, then it will project each value from the source observable into a new value that it will
   * check for equality with previously projected values. If a keySelector function is not provided, it will use each value from the
   * source observable directly with an equality check against previous values.
   *
   * In JavaScript runtimes that support `Set`, this operator will use a `Set` to improve performance of the distinct value checking.
   *
   * In other runtimes, this operator will use a minimal implementation of `Set` that relies on an `Array` and `indexOf` under the
   * hood, so performance will degrade as more values are checked for distinction. Even in newer browsers, a long-running `distinct`
   * use might result in memory leaks. To help alleviate this in some scenarios, an optional `flushes` parameter is also provided so
   * that the internal `Set` can be "flushed", basically clearing it of values.
   *
   * @example <caption>A simple example with numbers</caption>
   * Observable.of(1, 1, 2, 2, 2, 1, 2, 3, 4, 3, 2, 1)
   *   .distinct()
   *   .subscribe(x => console.log(x)); // 1, 2, 3, 4
   *
   * @example <caption>An example using a keySelector function</caption>
   * interface Person {
   *    age: number,
   *    name: string
   * }
   *
   * Observable.of<Person>(
   *     { age: 4, name: 'Foo'},
   *     { age: 7, name: 'Bar'},
   *     { age: 5, name: 'Foo'})
   *     .distinct((p: Person) => p.name)
   *     .subscribe(x => console.log(x));
   *
   * // displays:
   * // { age: 4, name: 'Foo' }
   * // { age: 7, name: 'Bar' }
   *
   * @see {@link distinctUntilChanged}
   * @see {@link distinctUntilKeyChanged}
   *
   * @param {function} [keySelector] Optional function to select which value you want to check as distinct.
   * @param {Observable} [flushes] Optional Observable for flushing the internal HashSet of the operator.
   * @return {Observable} An Observable that emits items from the source Observable with distinct values.
   * @method distinct
   * @owner Observable
   */
  export function distinct<T, K>(this: Observable<T>,
                                 keySelector?: (value: T) => K,
                                 flushes?: Observable<any>): Observable<T> {
    return higherOrder(keySelector, flushes)(this);
  }
  