{"ast":null,"code":"import { Subscriber } from '../Subscriber';\nimport { async } from '../scheduler/async';\nexport function debounceTime(dueTime, scheduler = async) {\n  return source => source.lift(new DebounceTimeOperator(dueTime, scheduler));\n}\n\nclass DebounceTimeOperator {\n  constructor(dueTime, scheduler) {\n    this.dueTime = dueTime;\n    this.scheduler = scheduler;\n  }\n\n  call(subscriber, source) {\n    return source.subscribe(new DebounceTimeSubscriber(subscriber, this.dueTime, this.scheduler));\n  }\n\n}\n\nclass DebounceTimeSubscriber extends Subscriber {\n  constructor(destination, dueTime, scheduler) {\n    super(destination);\n    this.dueTime = dueTime;\n    this.scheduler = scheduler;\n    this.debouncedSubscription = null;\n    this.lastValue = null;\n    this.hasValue = false;\n  }\n\n  _next(value) {\n    this.clearDebounce();\n    this.lastValue = value;\n    this.hasValue = true;\n    this.add(this.debouncedSubscription = this.scheduler.schedule(dispatchNext, this.dueTime, this));\n  }\n\n  _complete() {\n    this.debouncedNext();\n    this.destination.complete();\n  }\n\n  debouncedNext() {\n    this.clearDebounce();\n\n    if (this.hasValue) {\n      const {\n        lastValue\n      } = this;\n      this.lastValue = null;\n      this.hasValue = false;\n      this.destination.next(lastValue);\n    }\n  }\n\n  clearDebounce() {\n    const debouncedSubscription = this.debouncedSubscription;\n\n    if (debouncedSubscription !== null) {\n      this.remove(debouncedSubscription);\n      debouncedSubscription.unsubscribe();\n      this.debouncedSubscription = null;\n    }\n  }\n\n}\n\nfunction dispatchNext(subscriber) {\n  subscriber.debouncedNext();\n} //# sourceMappingURL=debounceTime.js.map","map":null,"metadata":{},"sourceType":"module"}