{"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 { Subscriber } from '../Subscriber';\nimport { Subject } from '../Subject';\nexport function windowCount(windowSize) {\n  var startWindowEvery = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n  return function windowCountOperatorFunction(source) {\n    return source.lift(new WindowCountOperator(windowSize, startWindowEvery));\n  };\n}\n\nvar WindowCountOperator = /*#__PURE__*/function () {\n  function WindowCountOperator(windowSize, startWindowEvery) {\n    _classCallCheck(this, WindowCountOperator);\n\n    this.windowSize = windowSize;\n    this.startWindowEvery = startWindowEvery;\n  }\n\n  _createClass(WindowCountOperator, [{\n    key: \"call\",\n    value: function call(subscriber, source) {\n      return source.subscribe(new WindowCountSubscriber(subscriber, this.windowSize, this.startWindowEvery));\n    }\n  }]);\n\n  return WindowCountOperator;\n}();\n\nvar WindowCountSubscriber = /*#__PURE__*/function (_Subscriber) {\n  _inherits(WindowCountSubscriber, _Subscriber);\n\n  var _super = _createSuper(WindowCountSubscriber);\n\n  function WindowCountSubscriber(destination, windowSize, startWindowEvery) {\n    var _this;\n\n    _classCallCheck(this, WindowCountSubscriber);\n\n    _this = _super.call(this, destination);\n    _this.destination = destination;\n    _this.windowSize = windowSize;\n    _this.startWindowEvery = startWindowEvery;\n    _this.windows = [new Subject()];\n    _this.count = 0;\n    destination.next(_this.windows[0]);\n    return _this;\n  }\n\n  _createClass(WindowCountSubscriber, [{\n    key: \"_next\",\n    value: function _next(value) {\n      var startWindowEvery = this.startWindowEvery > 0 ? this.startWindowEvery : this.windowSize;\n      var destination = this.destination;\n      var windowSize = this.windowSize;\n      var windows = this.windows;\n      var len = windows.length;\n\n      for (var i = 0; i < len && !this.closed; i++) {\n        windows[i].next(value);\n      }\n\n      var c = this.count - windowSize + 1;\n\n      if (c >= 0 && c % startWindowEvery === 0 && !this.closed) {\n        windows.shift().complete();\n      }\n\n      if (++this.count % startWindowEvery === 0 && !this.closed) {\n        var window = new Subject();\n        windows.push(window);\n        destination.next(window);\n      }\n    }\n  }, {\n    key: \"_error\",\n    value: function _error(err) {\n      var windows = this.windows;\n\n      if (windows) {\n        while (windows.length > 0 && !this.closed) {\n          windows.shift().error(err);\n        }\n      }\n\n      this.destination.error(err);\n    }\n  }, {\n    key: \"_complete\",\n    value: function _complete() {\n      var windows = this.windows;\n\n      if (windows) {\n        while (windows.length > 0 && !this.closed) {\n          windows.shift().complete();\n        }\n      }\n\n      this.destination.complete();\n    }\n  }, {\n    key: \"_unsubscribe\",\n    value: function _unsubscribe() {\n      this.count = 0;\n      this.windows = null;\n    }\n  }]);\n\n  return WindowCountSubscriber;\n}(Subscriber); //# sourceMappingURL=windowCount.js.map","map":null,"metadata":{},"sourceType":"module"}