{"ast":null,"code":"import _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 expand(project) {\n  var concurrent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Number.POSITIVE_INFINITY;\n  var scheduler = arguments.length > 2 ? arguments[2] : undefined;\n  concurrent = (concurrent || 0) < 1 ? Number.POSITIVE_INFINITY : concurrent;\n  return function (source) {\n    return source.lift(new ExpandOperator(project, concurrent, scheduler));\n  };\n}\nexport var ExpandOperator = /*#__PURE__*/function () {\n  function ExpandOperator(project, concurrent, scheduler) {\n    _classCallCheck(this, ExpandOperator);\n\n    this.project = project;\n    this.concurrent = concurrent;\n    this.scheduler = scheduler;\n  }\n\n  _createClass(ExpandOperator, [{\n    key: \"call\",\n    value: function call(subscriber, source) {\n      return source.subscribe(new ExpandSubscriber(subscriber, this.project, this.concurrent, this.scheduler));\n    }\n  }]);\n\n  return ExpandOperator;\n}();\nexport var ExpandSubscriber = /*#__PURE__*/function (_SimpleOuterSubscribe) {\n  _inherits(ExpandSubscriber, _SimpleOuterSubscribe);\n\n  var _super = _createSuper(ExpandSubscriber);\n\n  function ExpandSubscriber(destination, project, concurrent, scheduler) {\n    var _this;\n\n    _classCallCheck(this, ExpandSubscriber);\n\n    _this = _super.call(this, destination);\n    _this.project = project;\n    _this.concurrent = concurrent;\n    _this.scheduler = scheduler;\n    _this.index = 0;\n    _this.active = 0;\n    _this.hasCompleted = false;\n\n    if (concurrent < Number.POSITIVE_INFINITY) {\n      _this.buffer = [];\n    }\n\n    return _this;\n  }\n\n  _createClass(ExpandSubscriber, [{\n    key: \"_next\",\n    value: function _next(value) {\n      var destination = this.destination;\n\n      if (destination.closed) {\n        this._complete();\n\n        return;\n      }\n\n      var index = this.index++;\n\n      if (this.active < this.concurrent) {\n        destination.next(value);\n\n        try {\n          var project = this.project;\n          var result = project(value, index);\n\n          if (!this.scheduler) {\n            this.subscribeToProjection(result, value, index);\n          } else {\n            var state = {\n              subscriber: this,\n              result: result,\n              value: value,\n              index: index\n            };\n            var _destination = this.destination;\n\n            _destination.add(this.scheduler.schedule(ExpandSubscriber.dispatch, 0, state));\n          }\n        } catch (e) {\n          destination.error(e);\n        }\n      } else {\n        this.buffer.push(value);\n      }\n    }\n  }, {\n    key: \"subscribeToProjection\",\n    value: function subscribeToProjection(result, value, index) {\n      this.active++;\n      var destination = this.destination;\n      destination.add(innerSubscribe(result, new SimpleInnerSubscriber(this)));\n    }\n  }, {\n    key: \"_complete\",\n    value: function _complete() {\n      this.hasCompleted = true;\n\n      if (this.hasCompleted && this.active === 0) {\n        this.destination.complete();\n      }\n\n      this.unsubscribe();\n    }\n  }, {\n    key: \"notifyNext\",\n    value: function notifyNext(innerValue) {\n      this._next(innerValue);\n    }\n  }, {\n    key: \"notifyComplete\",\n    value: function notifyComplete() {\n      var buffer = this.buffer;\n      this.active--;\n\n      if (buffer && buffer.length > 0) {\n        this._next(buffer.shift());\n      }\n\n      if (this.hasCompleted && this.active === 0) {\n        this.destination.complete();\n      }\n    }\n  }], [{\n    key: \"dispatch\",\n    value: function dispatch(arg) {\n      var subscriber = arg.subscriber,\n          result = arg.result,\n          value = arg.value,\n          index = arg.index;\n      subscriber.subscribeToProjection(result, value, index);\n    }\n  }]);\n\n  return ExpandSubscriber;\n}(SimpleOuterSubscriber); //# sourceMappingURL=expand.js.map","map":null,"metadata":{},"sourceType":"module"}