1 line
8.5 KiB
JSON
1 line
8.5 KiB
JSON
{"ast":null,"code":"import { SimpleOuterSubscriber, SimpleInnerSubscriber, innerSubscribe } from '../innerSubscribe';\nexport function mergeScan(accumulator, seed, concurrent = Number.POSITIVE_INFINITY) {\n return source => source.lift(new MergeScanOperator(accumulator, seed, concurrent));\n}\nexport class MergeScanOperator {\n constructor(accumulator, seed, concurrent) {\n this.accumulator = accumulator;\n this.seed = seed;\n this.concurrent = concurrent;\n }\n\n call(subscriber, source) {\n return source.subscribe(new MergeScanSubscriber(subscriber, this.accumulator, this.seed, this.concurrent));\n }\n\n}\nexport class MergeScanSubscriber extends SimpleOuterSubscriber {\n constructor(destination, accumulator, acc, concurrent) {\n super(destination);\n this.accumulator = accumulator;\n this.acc = acc;\n this.concurrent = concurrent;\n this.hasValue = false;\n this.hasCompleted = false;\n this.buffer = [];\n this.active = 0;\n this.index = 0;\n }\n\n _next(value) {\n if (this.active < this.concurrent) {\n const index = this.index++;\n const destination = this.destination;\n let ish;\n\n try {\n const {\n accumulator\n } = this;\n ish = accumulator(this.acc, value, index);\n } catch (e) {\n return destination.error(e);\n }\n\n this.active++;\n\n this._innerSub(ish);\n } else {\n this.buffer.push(value);\n }\n }\n\n _innerSub(ish) {\n const innerSubscriber = new SimpleInnerSubscriber(this);\n const destination = this.destination;\n destination.add(innerSubscriber);\n const innerSubscription = innerSubscribe(ish, innerSubscriber);\n\n if (innerSubscription !== innerSubscriber) {\n destination.add(innerSubscription);\n }\n }\n\n _complete() {\n this.hasCompleted = true;\n\n if (this.active === 0 && this.buffer.length === 0) {\n if (this.hasValue === false) {\n this.destination.next(this.acc);\n }\n\n this.destination.complete();\n }\n\n this.unsubscribe();\n }\n\n notifyNext(innerValue) {\n const {\n destination\n } = this;\n this.acc = innerValue;\n this.hasValue = true;\n destination.next(innerValue);\n }\n\n notifyComplete() {\n const buffer = this.buffer;\n this.active--;\n\n if (buffer.length > 0) {\n this._next(buffer.shift());\n } else if (this.active === 0 && this.hasCompleted) {\n if (this.hasValue === false) {\n this.destination.next(this.acc);\n }\n\n this.destination.complete();\n }\n }\n\n}","map":{"version":3,"names":["SimpleOuterSubscriber","SimpleInnerSubscriber","innerSubscribe","mergeScan","accumulator","seed","concurrent","Number","POSITIVE_INFINITY","source","lift","MergeScanOperator","constructor","call","subscriber","subscribe","MergeScanSubscriber","destination","acc","hasValue","hasCompleted","buffer","active","index","_next","value","ish","e","error","_innerSub","push","innerSubscriber","add","innerSubscription","_complete","length","next","complete","unsubscribe","notifyNext","innerValue","notifyComplete","shift"],"sources":["D:/MobileDev/WRB/WrenchBoard2023a/node_modules/rxjs/_esm2015/internal/operators/mergeScan.js"],"sourcesContent":["import { SimpleOuterSubscriber, SimpleInnerSubscriber, innerSubscribe } from '../innerSubscribe';\nexport function mergeScan(accumulator, seed, concurrent = Number.POSITIVE_INFINITY) {\n return (source) => source.lift(new MergeScanOperator(accumulator, seed, concurrent));\n}\nexport class MergeScanOperator {\n constructor(accumulator, seed, concurrent) {\n this.accumulator = accumulator;\n this.seed = seed;\n this.concurrent = concurrent;\n }\n call(subscriber, source) {\n return source.subscribe(new MergeScanSubscriber(subscriber, this.accumulator, this.seed, this.concurrent));\n }\n}\nexport class MergeScanSubscriber extends SimpleOuterSubscriber {\n constructor(destination, accumulator, acc, concurrent) {\n super(destination);\n this.accumulator = accumulator;\n this.acc = acc;\n this.concurrent = concurrent;\n this.hasValue = false;\n this.hasCompleted = false;\n this.buffer = [];\n this.active = 0;\n this.index = 0;\n }\n _next(value) {\n if (this.active < this.concurrent) {\n const index = this.index++;\n const destination = this.destination;\n let ish;\n try {\n const { accumulator } = this;\n ish = accumulator(this.acc, value, index);\n }\n catch (e) {\n return destination.error(e);\n }\n this.active++;\n this._innerSub(ish);\n }\n else {\n this.buffer.push(value);\n }\n }\n _innerSub(ish) {\n const innerSubscriber = new SimpleInnerSubscriber(this);\n const destination = this.destination;\n destination.add(innerSubscriber);\n const innerSubscription = innerSubscribe(ish, innerSubscriber);\n if (innerSubscription !== innerSubscriber) {\n destination.add(innerSubscription);\n }\n }\n _complete() {\n this.hasCompleted = true;\n if (this.active === 0 && this.buffer.length === 0) {\n if (this.hasValue === false) {\n this.destination.next(this.acc);\n }\n this.destination.complete();\n }\n this.unsubscribe();\n }\n notifyNext(innerValue) {\n const { destination } = this;\n this.acc = innerValue;\n this.hasValue = true;\n destination.next(innerValue);\n }\n notifyComplete() {\n const buffer = this.buffer;\n this.active--;\n if (buffer.length > 0) {\n this._next(buffer.shift());\n }\n else if (this.active === 0 && this.hasCompleted) {\n if (this.hasValue === false) {\n this.destination.next(this.acc);\n }\n this.destination.complete();\n }\n }\n}\n"],"mappings":"AAAA,SAASA,qBAAT,EAAgCC,qBAAhC,EAAuDC,cAAvD,QAA6E,mBAA7E;AACA,OAAO,SAASC,SAAT,CAAmBC,WAAnB,EAAgCC,IAAhC,EAAsCC,UAAU,GAAGC,MAAM,CAACC,iBAA1D,EAA6E;EAChF,OAAQC,MAAD,IAAYA,MAAM,CAACC,IAAP,CAAY,IAAIC,iBAAJ,CAAsBP,WAAtB,EAAmCC,IAAnC,EAAyCC,UAAzC,CAAZ,CAAnB;AACH;AACD,OAAO,MAAMK,iBAAN,CAAwB;EAC3BC,WAAW,CAACR,WAAD,EAAcC,IAAd,EAAoBC,UAApB,EAAgC;IACvC,KAAKF,WAAL,GAAmBA,WAAnB;IACA,KAAKC,IAAL,GAAYA,IAAZ;IACA,KAAKC,UAAL,GAAkBA,UAAlB;EACH;;EACDO,IAAI,CAACC,UAAD,EAAaL,MAAb,EAAqB;IACrB,OAAOA,MAAM,CAACM,SAAP,CAAiB,IAAIC,mBAAJ,CAAwBF,UAAxB,EAAoC,KAAKV,WAAzC,EAAsD,KAAKC,IAA3D,EAAiE,KAAKC,UAAtE,CAAjB,CAAP;EACH;;AAR0B;AAU/B,OAAO,MAAMU,mBAAN,SAAkChB,qBAAlC,CAAwD;EAC3DY,WAAW,CAACK,WAAD,EAAcb,WAAd,EAA2Bc,GAA3B,EA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