import{h as t,o as n,s as r,i as e,S as o,O as s,a as i,c}from"./p-ea120e31.js";const u="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator",f=t=>t&&"number"==typeof t.length&&"function"!=typeof t;function h(t){return!!t&&"function"!=typeof t.subscribe&&"function"==typeof t.then}const a=o=>{if(o&&"function"==typeof o[n])return c=o,t=>{const r=c[n]();if("function"!=typeof r.subscribe)throw new TypeError("Provided object does not correctly implement Symbol.observable");return r.subscribe(t)};if(f(o))return r(o);if(h(o))return i=o,n=>(i.then((t=>{n.closed||(n.next(t),n.complete())}),(t=>n.error(t))).then(null,t),n);if(o&&"function"==typeof o[u])return s=o,t=>{const n=s[u]();for(;;){let r;try{r=n.next()}catch(n){return t.error(n),t}if(r.done){t.complete();break}if(t.next(r.value),t.closed)break}return"function"==typeof n.return&&t.add((()=>{n.return&&n.return()})),t};{const t=e(o)?"an invalid object":`'${o}'`;throw new TypeError(`You provided ${t} where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.`)}var s,i,c};class l extends o{constructor(t){super(),this.parent=t}_next(t){this.parent.notifyNext(t)}_error(t){this.parent.notifyError(t),this.unsubscribe()}_complete(){this.parent.notifyComplete(),this.unsubscribe()}}class y extends o{notifyNext(t){this.destination.next(t)}notifyError(t){this.destination.error(t)}notifyComplete(){this.destination.complete()}}function p(t,n){if(n.closed)return;if(t instanceof s)return t.subscribe(n);let r;try{r=a(t)(n)}catch(t){n.error(t)}return r}function w(t,r){return r?function(t,r){if(null!=t){if(function(t){return t&&"function"==typeof t[n]}(t))return function(t,r){return new s((e=>{const o=new i;return o.add(r.schedule((()=>{const s=t[n]();o.add(s.subscribe({next(t){o.add(r.schedule((()=>e.next(t))))},error(t){o.add(r.schedule((()=>e.error(t))))},complete(){o.add(r.schedule((()=>e.complete())))}}))}))),o}))}(t,r);if(h(t))return function(t,n){return new s((r=>{const e=new i;return e.add(n.schedule((()=>t.then((t=>{e.add(n.schedule((()=>{r.next(t),e.add(n.schedule((()=>r.complete())))})))}),(t=>{e.add(n.schedule((()=>r.error(t))))}))))),e}))}(t,r);if(f(t))return c(t,r);if(function(t){return t&&"function"==typeof t[u]}(t)||"string"==typeof t)return function(t,n){if(!t)throw new Error("Iterable cannot be null");return new s((r=>{const e=new i;let o;return e.add((()=>{o&&"function"==typeof o.return&&o.return()})),e.add(n.schedule((()=>{o=t[u](),e.add(n.schedule((function(){if(r.closed)return;let t,n;try{const r=o.next();t=r.value,n=r.done}catch(t){return void r.error(t)}n?r.complete():(r.next(t),this.schedule())})))}))),e}))}(t,r)}throw new TypeError((null!==t&&typeof t||t)+" is not observable")}(t,r):t instanceof s?t:new s(a(t))}function b(t,n){return function(r){if("function"!=typeof t)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return r.lift(new m(t,n))}}class m{constructor(t,n){this.project=t,this.thisArg=n}call(t,n){return n.subscribe(new d(t,this.project,this.thisArg))}}class d extends o{constructor(t,n,r){super(t),this.project=n,this.count=0,this.thisArg=r||this}_next(t){let n;try{n=this.project.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}this.destination.next(n)}}function x(t,n){return r=>r.lift(new v(t,n))}class v{constructor(t,n){this.compare=t,this.keySelector=n}call(t,n){return n.subscribe(new S(t,this.compare,this.keySelector))}}class S extends o{constructor(t,n,r){super(t),this.keySelector=r,this.hasKey=!1,"function"==typeof n&&(this.compare=n)}compare(t,n){return t===n}_next(t){let n;try{const{keySelector:r}=this;n=r?r(t):t}catch(t){return this.destination.error(t)}let r=!1;if(this.hasKey)try{const{compare:t}=this;r=t(this.key,n)}catch(t){return this.destination.error(t)}else this.hasKey=!0;r||(this.key=n,this.destination.next(t))}}function E(t,n){return function(r){return r.lift(new _(t,n))}}class _{constructor(t,n){this.predicate=t,this.thisArg=n}call(t,n){return n.subscribe(new T(t,this.predicate,this.thisArg))}}class T extends o{constructor(t,n,r){super(t),this.predicate=n,this.thisArg=r,this.count=0}_next(t){let n;try{n=this.predicate.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}n&&this.destination.next(t)}}export{y as S,l as a,E as b,x as d,w as f,p as i,b as m}