{"ast":null,"code":"import _get from \"C:/Users/kgamal/Downloads/HijriGregorianDatepicker-master/HijriGregorianDatepicker-master/node_modules/@babel/runtime/helpers/esm/get\";\nimport _getPrototypeOf from \"C:/Users/kgamal/Downloads/HijriGregorianDatepicker-master/HijriGregorianDatepicker-master/node_modules/@babel/runtime/helpers/esm/getPrototypeOf\";\nimport _inherits from \"C:/Users/kgamal/Downloads/HijriGregorianDatepicker-master/HijriGregorianDatepicker-master/node_modules/@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"C:/Users/kgamal/Downloads/HijriGregorianDatepicker-master/HijriGregorianDatepicker-master/node_modules/@babel/runtime/helpers/esm/createSuper\";\nimport _classCallCheck from \"C:/Users/kgamal/Downloads/HijriGregorianDatepicker-master/HijriGregorianDatepicker-master/node_modules/@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"C:/Users/kgamal/Downloads/HijriGregorianDatepicker-master/HijriGregorianDatepicker-master/node_modules/@babel/runtime/helpers/esm/createClass\";\nimport { SimpleOuterSubscriber, innerSubscribe, SimpleInnerSubscriber } from '../innerSubscribe';\nexport function debounce(durationSelector) {\n  return function (source) {\n    return source.lift(new DebounceOperator(durationSelector));\n  };\n}\n\nvar DebounceOperator = /*#__PURE__*/function () {\n  function DebounceOperator(durationSelector) {\n    _classCallCheck(this, DebounceOperator);\n\n    this.durationSelector = durationSelector;\n  }\n\n  _createClass(DebounceOperator, [{\n    key: \"call\",\n    value: function call(subscriber, source) {\n      return source.subscribe(new DebounceSubscriber(subscriber, this.durationSelector));\n    }\n  }]);\n\n  return DebounceOperator;\n}();\n\nvar DebounceSubscriber = /*#__PURE__*/function (_SimpleOuterSubscribe) {\n  _inherits(DebounceSubscriber, _SimpleOuterSubscribe);\n\n  var _super = _createSuper(DebounceSubscriber);\n\n  function DebounceSubscriber(destination, durationSelector) {\n    var _this;\n\n    _classCallCheck(this, DebounceSubscriber);\n\n    _this = _super.call(this, destination);\n    _this.durationSelector = durationSelector;\n    _this.hasValue = false;\n    return _this;\n  }\n\n  _createClass(DebounceSubscriber, [{\n    key: \"_next\",\n    value: function _next(value) {\n      try {\n        var result = this.durationSelector.call(this, value);\n\n        if (result) {\n          this._tryNext(value, result);\n        }\n      } catch (err) {\n        this.destination.error(err);\n      }\n    }\n  }, {\n    key: \"_complete\",\n    value: function _complete() {\n      this.emitValue();\n      this.destination.complete();\n    }\n  }, {\n    key: \"_tryNext\",\n    value: function _tryNext(value, duration) {\n      var subscription = this.durationSubscription;\n      this.value = value;\n      this.hasValue = true;\n\n      if (subscription) {\n        subscription.unsubscribe();\n        this.remove(subscription);\n      }\n\n      subscription = innerSubscribe(duration, new SimpleInnerSubscriber(this));\n\n      if (subscription && !subscription.closed) {\n        this.add(this.durationSubscription = subscription);\n      }\n    }\n  }, {\n    key: \"notifyNext\",\n    value: function notifyNext() {\n      this.emitValue();\n    }\n  }, {\n    key: \"notifyComplete\",\n    value: function notifyComplete() {\n      this.emitValue();\n    }\n  }, {\n    key: \"emitValue\",\n    value: function emitValue() {\n      if (this.hasValue) {\n        var value = this.value;\n        var subscription = this.durationSubscription;\n\n        if (subscription) {\n          this.durationSubscription = undefined;\n          subscription.unsubscribe();\n          this.remove(subscription);\n        }\n\n        this.value = undefined;\n        this.hasValue = false;\n\n        _get(_getPrototypeOf(DebounceSubscriber.prototype), \"_next\", this).call(this, value);\n      }\n    }\n  }]);\n\n  return DebounceSubscriber;\n}(SimpleOuterSubscriber); //# sourceMappingURL=debounce.js.map","map":null,"metadata":{},"sourceType":"module"}