Kargi-Sitesi/.angular/cache/18.2.11/babel-webpack/5af2046661c257522a3fe47310a2a7437e5994d6e65c0df8f2b7f6c85c3d3d89.json

1 line
18 KiB
JSON
Raw Normal View History

2024-10-31 19:07:58 +00:00
{"ast":null,"code":"import { fromArray } from './fromArray';\nimport { isArray } from '../util/isArray';\nimport { Subscriber } from '../Subscriber';\nimport { iterator as Symbol_iterator } from '../../internal/symbol/iterator';\nimport { SimpleOuterSubscriber, SimpleInnerSubscriber, innerSubscribe } from '../innerSubscribe';\nexport function zip(...observables) {\n const resultSelector = observables[observables.length - 1];\n if (typeof resultSelector === 'function') {\n observables.pop();\n }\n return fromArray(observables, undefined).lift(new ZipOperator(resultSelector));\n}\nexport class ZipOperator {\n constructor(resultSelector) {\n this.resultSelector = resultSelector;\n }\n call(subscriber, source) {\n return source.subscribe(new ZipSubscriber(subscriber, this.resultSelector));\n }\n}\nexport class ZipSubscriber extends Subscriber {\n constructor(destination, resultSelector, values = Object.create(null)) {\n super(destination);\n this.resultSelector = resultSelector;\n this.iterators = [];\n this.active = 0;\n this.resultSelector = typeof resultSelector === 'function' ? resultSelector : undefined;\n }\n _next(value) {\n const iterators = this.iterators;\n if (isArray(value)) {\n iterators.push(new StaticArrayIterator(value));\n } else if (typeof value[Symbol_iterator] === 'function') {\n iterators.push(new StaticIterator(value[Symbol_iterator]()));\n } else {\n iterators.push(new ZipBufferIterator(this.destination, this, value));\n }\n }\n _complete() {\n const iterators = this.iterators;\n const len = iterators.length;\n this.unsubscribe();\n if (len === 0) {\n this.destination.complete();\n return;\n }\n this.active = len;\n for (let i = 0; i < len; i++) {\n let iterator = iterators[i];\n if (iterator.stillUnsubscribed) {\n const destination = this.destination;\n destination.add(iterator.subscribe());\n } else {\n this.active--;\n }\n }\n }\n notifyInactive() {\n this.active--;\n if (this.active === 0) {\n this.destination.complete();\n }\n }\n checkIterators() {\n const iterators = this.iterators;\n const len = iterators.length;\n const destination = this.destination;\n for (let i = 0; i < len; i++) {\n let iterator = iterators[i];\n if (typeof iterator.hasValue === 'function' && !iterator.hasValue()) {\n return;\n }\n }\n let shouldComplete = false;\n const args = [];\n for (let i = 0; i < len; i++) {\n let iterator = iterators[i];\n let result = iterator.next();\n if (iterator.hasCompleted()) {\n shouldComplete = true;\n }\n if (result.done) {\n destination.complete();\n return;\n }\n args.push(result.value);\n }\n if (this.resultSelector) {\n this._tryresultSelector(args);\n } else {\n destination.next(args);\n }\n if (shouldComplete) {\n destination.complete();\n }\n }\n _tryresultSelector(args) {\n let result;\n try {\n result = this.resultSelector.apply(this, args);\n } catch (err) {\n this.destination.error(err);\n return;\n }\n this.destination.next(result);\n }\n}\nclass StaticIterator {\n constructor(iterator) {\n this.iterator = iterator;\n this.nextResult = iterator.next();\n }\n hasValue() {\n return true;\n }\n next() {\n const result = this.nextResult;\n this.nextResult = this.iterator.next();\n return result;\n }\n hasCompleted() {\n const nextResult = this.nextResult;\n return Boolean(nextResult && nextResult.done);\n }\n}\nclass StaticArrayIterator {\n constructor(array) {\n this.array = array;\n this.index = 0;\n this.length = 0;\n this.length = array.length;\n }\n [Symbol_iterator]() {\n return this;\n }\n next(value) {\n const i = this.index++;\n const array = this.array;\n return i < this.length ? {\n value: array[i],\n done: false\n } : {\n value: null,\n done: true\n };\n }\n