{"ast":null,"code":"import { Subject } from '../Subject';\nimport { Subscription } from '../Subscription';\nimport { OuterSubscriber } from '../OuterSubscriber';\nimport { subscribeToResult } from '../util/subscribeToResult';\nexport function windowToggle(openings, closingSelector) {\n return source => source.lift(new WindowToggleOperator(openings, closingSelector));\n}\nclass WindowToggleOperator {\n constructor(openings, closingSelector) {\n this.openings = openings;\n this.closingSelector = closingSelector;\n }\n call(subscriber, source) {\n return source.subscribe(new WindowToggleSubscriber(subscriber, this.openings, this.closingSelector));\n }\n}\nclass WindowToggleSubscriber extends OuterSubscriber {\n constructor(destination, openings, closingSelector) {\n super(destination);\n this.openings = openings;\n this.closingSelector = closingSelector;\n this.contexts = [];\n this.add(this.openSubscription = subscribeToResult(this, openings, openings));\n }\n _next(value) {\n const {\n contexts\n } = this;\n if (contexts) {\n const len = contexts.length;\n for (let i = 0; i < len; i++) {\n contexts[i].window.next(value);\n }\n }\n }\n _error(err) {\n const {\n contexts\n } = this;\n this.contexts = null;\n if (contexts) {\n const len = contexts.length;\n let index = -1;\n while (++index < len) {\n const context = contexts[index];\n context.window.error(err);\n context.subscription.unsubscribe();\n }\n }\n super._error(err);\n }\n _complete() {\n const {\n contexts\n } = this;\n this.contexts = null;\n if (contexts) {\n const len = contexts.length;\n let index = -1;\n while (++index < len) {\n const context = contexts[index];\n context.window.complete();\n context.subscription.unsubscribe();\n }\n }\n super._complete();\n }\n _unsubscribe() {\n const {\n contexts\n } = this;\n this.contexts = null;\n if (contexts) {\n const len = contexts.length;\n let index = -1;\n while (++index < len) {\n const context = contexts[index];\n context.window.unsubscribe();\n context.subscription.unsubscribe();\n }\n }\n }\n notifyNext(outerValue, innerValue, outerIndex, innerIndex, innerSub) {\n if (outerValue === this.openings) {\n let closingNotifier;\n try {\n const {\n closingSelector\n } = this;\n closingNotifier = closingSelector(innerValue);\n } catch (e) {\n return this.error(e);\n }\n const window = new Subject();\n const subscription = new Subscription();\n const context = {\n window,\n subscription\n };\n this.contexts.push(context);\n const innerSubscription = subscribeToResult(this, closingNotifier, context);\n if (innerSubscription.closed) {\n this.closeWindow(this.contexts.length - 1);\n } else {\n innerSubscription.context = context;\n subscription.add(innerSubscription);\n }\n this.destination.next(window);\n } else {\n this.closeWindow(this.contexts.indexOf(outerValue));\n }\n }\n notifyError(err) {\n this.error(err);\n }\n notifyComplete(inner) {\n if (inner !== this.openSubscription) {\n this.closeWindow(this.contexts.indexOf(inner.context));\n }\n }\n closeWindow(index) {\n if (index === -1) {\n return;\n }\n const {\n contexts\n } = this;\n const context = contexts[index];\n const {\n window,\n subscription\n } = context;\n contexts.splice(index, 1);\n window.complete();\n subscription.unsubscribe();\n }\n}","map":{"version":3,"names":["Subject","Subscription","OuterSubscriber","subscribeToResult","windowToggle","openings","closingSelector","source","lift","WindowToggleOperator","constructor","call","subscriber","subscribe","WindowToggleSubscriber","destination","contexts","add","openSubscription","_next","value","len","length","i","window","next","_error","err","index","context","error","subscription","unsubscribe","_complete","complete","_unsubscribe","notifyNext","outerValue","innerValue","outerIndex","innerIndex","innerSub","closingNotifier","e","push","innerSubscription","closed","closeWindow","indexOf","notifyError","notifyComplete","inner","splice"],"sources":["/home/arctichawk1/Desktop/Projects/Public/Kargi-Sitesi/node_modules/rxjs/_esm2015/internal/operators/windowToggle.js"],"sourcesContent":["import { Subject } from '../Subject';\nimport { Subscription } from '../Subscription';\nimport { OuterSubscriber } from '../OuterSubscriber';\nimport { subscribeToResult } from '../util/subscribeToResult';\nexport function windowToggle(openings, closingSelector) {\n return (source) => source.lift(new WindowToggleOperator(openings, closingSelector));\n}\nclass WindowToggleOperator {\n constructor(openings, closingSelector) {\n this.openings = openings;\n this.closingSelector = closingSelector;\n }\n call(subscriber, source) {\n return source.subscribe(new WindowToggleSubscriber(subscriber, this.openings, this.closingSelector));\n }\n}\nclass WindowToggleSubscriber extends OuterSubscriber {\n constructor(destination, openings, closingSelector) {\n super(destination);\n this.openings = openings;\n this.closingSelector = closingSelector;\n this.contexts = [];\n this.add(this.openSubscription = subscribeToResult(this, openings, openings));\n }\n _next(value) {\n const { contexts } = this;\n if (contexts) {\n const len = contexts.length;\n for (let i = 0; i < len; i++) {\n contexts[i].window.next(value);\n }\n }\n }\n _error(err) {\n const { contexts } = this;\n this.contexts = null;\n if (contexts) {\n const len = contexts.length;\n let index = -1;\n while (++index < len) {\n const context = contexts[index];\n context.window.error(err);\n context.subscription.unsubscribe();\n }\n }\n super._error(err);\n }\n _complete() {\n const { contexts } = this;\n this.contexts = null;\n if (contexts) {\n const len = contexts.length;\n let index = -1;\n while (++index < len) {\n const context = contexts[index];\n context.window.complete();\n context.subscription.unsubscribe();\n }\n }\n super._complete();\n }\n _unsubscribe() {\n const { contexts } = this;\n this.contexts = null;\n if (contexts) {\n const len = contexts.length;\n let index = -1;\n while (++index < len) {\n const context = contexts[index];\n context.window.unsubscribe();\n context.subscription.unsubscribe();\n }\n }\n }\n notifyNext(outerValue, innerValue, outerIndex, innerIndex, innerSub) {\n if (outerValue === this.openings) {\n let closingNotifier;\n try {\n const { closingSelector } = this;\n closingNotifier = closingSelector(innerValue);\n }\n catch (e) {\n return this.error(e);\n }\n const window = new Subject();\n const subscription = new Subscription();\n const context = { window, subscription };\n this.contexts.push(context);\n const innerSubscription = subscribeToResult(this, closingNotifier, context);\n if (innerSubscription.closed) {\n this.closeWindow(this.contexts.length - 1);\n }\n else {\n innerSubscription.context = context;\n subscription.add(innerSubscription);\n }\n this.destination.next(window);\n }\n else {\n this.closeWindow(this.contexts.indexOf(outerValue));\n }\n }\n notifyError(err) {\n this.error(err);\n }\n notifyComplete(inner) {\n if (inner !== this.openSubscription) {\n this.closeWindow(this.contexts.indexOf(inner.context));\n }\n }\n closeWindow(index) {\n if (index === -1) {\n return;\n }\n const { contexts } = this;\n const context = contexts[index];\n const { window, subscription } = context;\n contexts.splice(index, 1);\n window.complete();\n subscription.unsubscribe();\n }\n}\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,YAAY;AACpC,SAASC,YAAY,QAAQ,iBAAiB;AAC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