{"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 { map } from './map';\nimport { from } from '../observable/from';\nimport { SimpleOuterSubscriber, SimpleInnerSubscriber, innerSubscribe } from '../innerSubscribe';\nexport function switchMap(project, resultSelector) {\n  if (typeof resultSelector === 'function') {\n    return function (source) {\n      return source.pipe(switchMap(function (a, i) {\n        return from(project(a, i)).pipe(map(function (b, ii) {\n          return resultSelector(a, b, i, ii);\n        }));\n      }));\n    };\n  }\n\n  return function (source) {\n    return source.lift(new SwitchMapOperator(project));\n  };\n}\n\nvar SwitchMapOperator = /*#__PURE__*/function () {\n  function SwitchMapOperator(project) {\n    _classCallCheck(this, SwitchMapOperator);\n\n    this.project = project;\n  }\n\n  _createClass(SwitchMapOperator, [{\n    key: \"call\",\n    value: function call(subscriber, source) {\n      return source.subscribe(new SwitchMapSubscriber(subscriber, this.project));\n    }\n  }]);\n\n  return SwitchMapOperator;\n}();\n\nvar SwitchMapSubscriber = /*#__PURE__*/function (_SimpleOuterSubscribe) {\n  _inherits(SwitchMapSubscriber, _SimpleOuterSubscribe);\n\n  var _super = _createSuper(SwitchMapSubscriber);\n\n  function SwitchMapSubscriber(destination, project) {\n    var _this;\n\n    _classCallCheck(this, SwitchMapSubscriber);\n\n    _this = _super.call(this, destination);\n    _this.project = project;\n    _this.index = 0;\n    return _this;\n  }\n\n  _createClass(SwitchMapSubscriber, [{\n    key: \"_next\",\n    value: function _next(value) {\n      var result;\n      var index = this.index++;\n\n      try {\n        result = this.project(value, index);\n      } catch (error) {\n        this.destination.error(error);\n        return;\n      }\n\n      this._innerSub(result);\n    }\n  }, {\n    key: \"_innerSub\",\n    value: function _innerSub(result) {\n      var innerSubscription = this.innerSubscription;\n\n      if (innerSubscription) {\n        innerSubscription.unsubscribe();\n      }\n\n      var innerSubscriber = new SimpleInnerSubscriber(this);\n      var destination = this.destination;\n      destination.add(innerSubscriber);\n      this.innerSubscription = innerSubscribe(result, innerSubscriber);\n\n      if (this.innerSubscription !== innerSubscriber) {\n        destination.add(this.innerSubscription);\n      }\n    }\n  }, {\n    key: \"_complete\",\n    value: function _complete() {\n      var innerSubscription = this.innerSubscription;\n\n      if (!innerSubscription || innerSubscription.closed) {\n        _get(_getPrototypeOf(SwitchMapSubscriber.prototype), \"_complete\", this).call(this);\n      }\n\n      this.unsubscribe();\n    }\n  }, {\n    key: \"_unsubscribe\",\n    value: function _unsubscribe() {\n      this.innerSubscription = undefined;\n    }\n  }, {\n    key: \"notifyComplete\",\n    value: function notifyComplete() {\n      this.innerSubscription = undefined;\n\n      if (this.isStopped) {\n        _get(_getPrototypeOf(SwitchMapSubscriber.prototype), \"_complete\", this).call(this);\n      }\n    }\n  }, {\n    key: \"notifyNext\",\n    value: function notifyNext(innerValue) {\n      this.destination.next(innerValue);\n    }\n  }]);\n\n  return SwitchMapSubscriber;\n}(SimpleOuterSubscriber); //# sourceMappingURL=switchMap.js.map","map":null,"metadata":{},"sourceType":"module"}