{"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 { isArray } from '../util/isArray';\nimport { fromArray } from './fromArray';\nimport { OuterSubscriber } from '../OuterSubscriber';\nimport { subscribeToResult } from '../util/subscribeToResult';\nexport function race() {\n  for (var _len = arguments.length, observables = new Array(_len), _key = 0; _key < _len; _key++) {\n    observables[_key] = arguments[_key];\n  }\n\n  if (observables.length === 1) {\n    if (isArray(observables[0])) {\n      observables = observables[0];\n    } else {\n      return observables[0];\n    }\n  }\n\n  return fromArray(observables, undefined).lift(new RaceOperator());\n}\nexport var RaceOperator = /*#__PURE__*/function () {\n  function RaceOperator() {\n    _classCallCheck(this, RaceOperator);\n  }\n\n  _createClass(RaceOperator, [{\n    key: \"call\",\n    value: function call(subscriber, source) {\n      return source.subscribe(new RaceSubscriber(subscriber));\n    }\n  }]);\n\n  return RaceOperator;\n}();\nexport var RaceSubscriber = /*#__PURE__*/function (_OuterSubscriber) {\n  _inherits(RaceSubscriber, _OuterSubscriber);\n\n  var _super = _createSuper(RaceSubscriber);\n\n  function RaceSubscriber(destination) {\n    var _this;\n\n    _classCallCheck(this, RaceSubscriber);\n\n    _this = _super.call(this, destination);\n    _this.hasFirst = false;\n    _this.observables = [];\n    _this.subscriptions = [];\n    return _this;\n  }\n\n  _createClass(RaceSubscriber, [{\n    key: \"_next\",\n    value: function _next(observable) {\n      this.observables.push(observable);\n    }\n  }, {\n    key: \"_complete\",\n    value: function _complete() {\n      var observables = this.observables;\n      var len = observables.length;\n\n      if (len === 0) {\n        this.destination.complete();\n      } else {\n        for (var i = 0; i < len && !this.hasFirst; i++) {\n          var observable = observables[i];\n          var subscription = subscribeToResult(this, observable, undefined, i);\n\n          if (this.subscriptions) {\n            this.subscriptions.push(subscription);\n          }\n\n          this.add(subscription);\n        }\n\n        this.observables = null;\n      }\n    }\n  }, {\n    key: \"notifyNext\",\n    value: function notifyNext(_outerValue, innerValue, outerIndex) {\n      if (!this.hasFirst) {\n        this.hasFirst = true;\n\n        for (var i = 0; i < this.subscriptions.length; i++) {\n          if (i !== outerIndex) {\n            var subscription = this.subscriptions[i];\n            subscription.unsubscribe();\n            this.remove(subscription);\n          }\n        }\n\n        this.subscriptions = null;\n      }\n\n      this.destination.next(innerValue);\n    }\n  }]);\n\n  return RaceSubscriber;\n}(OuterSubscriber); //# sourceMappingURL=race.js.map","map":null,"metadata":{},"sourceType":"module"}