{"ast":null,"code":"import { isScheduler } from '../util/isScheduler';\nimport { Observable } from '../Observable';\nimport { subscribeOn } from '../operators/subscribeOn';\nimport { mapOneOrManyArgs } from '../util/mapOneOrManyArgs';\nimport { observeOn } from '../operators/observeOn';\nimport { AsyncSubject } from '../AsyncSubject';\nexport function bindCallbackInternals(isNodeStyle, callbackFunc, resultSelector, scheduler) {\n  if (resultSelector) {\n    if (isScheduler(resultSelector)) {\n      scheduler = resultSelector;\n    } else {\n      return function () {\n        for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n          args[_key] = arguments[_key];\n        }\n        return bindCallbackInternals(isNodeStyle, callbackFunc, scheduler).apply(this, args).pipe(mapOneOrManyArgs(resultSelector));\n      };\n    }\n  }\n  if (scheduler) {\n    return function () {\n      for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n        args[_key2] = arguments[_key2];\n      }\n      return bindCallbackInternals(isNodeStyle, callbackFunc).apply(this, args).pipe(subscribeOn(scheduler), observeOn(scheduler));\n    };\n  }\n  return function () {\n    var _this = this;\n    for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n      args[_key3] = arguments[_key3];\n    }\n    var subject = new AsyncSubject();\n    var uninitialized = true;\n    return new Observable(function (subscriber) {\n      var subs = subject.subscribe(subscriber);\n      if (uninitialized) {\n        uninitialized = false;\n        var isAsync = false;\n        var isComplete = false;\n        callbackFunc.apply(_this, [].concat(args, [function () {\n          for (var _len4 = arguments.length, results = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {\n            results[_key4] = arguments[_key4];\n          }\n          if (isNodeStyle) {\n            var err = results.shift();\n            if (err != null) {\n              subject.error(err);\n              return;\n            }\n          }\n          subject.next(1 < results.length ? results : results[0]);\n          isComplete = true;\n          if (isAsync) {\n            subject.complete();\n          }\n        }]));\n        if (isComplete) {\n          subject.complete();\n        }\n        isAsync = true;\n      }\n      return subs;\n    });\n  };\n}\n//# sourceMappingURL=bindCallbackInternals.js.map","map":null,"metadata":{},"sourceType":"module","externalDependencies":[]}