import{__exports as r}from"../../../_virtual/esnext.observable.constructor.mjs";import{__require as e}from"../internals/export.mjs";import{__require as s}from"../internals/function-call.mjs";import{__require as t}from"../internals/descriptors.mjs";import{__require as i}from"../internals/set-species.mjs";import{__require as o}from"../internals/a-callable.mjs";import{__require as n}from"../internals/an-object.mjs";import{__require as a}from"../internals/an-instance.mjs";import{__require as c}from"../internals/is-callable.mjs";import{__require as l}from"../internals/is-null-or-undefined.mjs";import{__require as u}from"../internals/is-object.mjs";import{__require as m}from"../internals/get-method.mjs";import{__require as p}from"../internals/define-built-in.mjs";import{__require as b}from"../internals/define-built-ins.mjs";import{__require as f}from"../internals/define-built-in-accessor.mjs";import{__require as v}from"../internals/host-report-errors.mjs";import{__require as _}from"../internals/well-known-symbol.mjs";import{__require as h}from"../internals/internal-state.mjs";var d;function j(){if(d)return r;d=1;var j=e(),q=s(),y=t(),C=i(),g=o(),x=n(),S=a(),O=c(),w=l(),k=u(),F=m(),z=p(),A=b(),B=f(),D=v(),E=_(),G=h(),H=E("observable"),I="Observable",J="Subscription",K="SubscriptionObserver",L=G.getterFor,M=G.set,N=L(I),P=L(J),Q=L(K),R=function(r){this.observer=x(r),this.cleanup=null,this.subscriptionObserver=null};R.prototype={type:J,clean:function(){var r=this.cleanup;if(r){this.cleanup=null;try{r()}catch(r){D(r)}}},close:function(){if(!y){var r=this.facade,e=this.subscriptionObserver;r.closed=!0,e&&(e.closed=!0)}this.observer=null},isClosed:function(){return null===this.observer}};var T=function(r,e){var s,t=M(this,new R(r));y||(this.closed=!1);try{(s=F(r,"start"))&&q(s,r,this)}catch(r){D(r)}if(!t.isClosed()){var i=t.subscriptionObserver=new U(t);try{var o=e(i),n=o;w(o)||(t.cleanup=O(o.unsubscribe)?function(){n.unsubscribe()}:g(o))}catch(r){return void i.error(r)}t.isClosed()&&t.clean()}};T.prototype=A({},{unsubscribe:function(){var r=P(this);r.isClosed()||(r.close(),r.clean())}}),y&&B(T.prototype,"closed",{configurable:!0,get:function(){return P(this).isClosed()}});var U=function(r){M(this,{type:K,subscriptionState:r}),y||(this.closed=!1)};U.prototype=A({},{next:function(r){var e=Q(this).subscriptionState;if(!e.isClosed()){var s=e.observer;try{var t=F(s,"next");t&&q(t,s,r)}catch(r){D(r)}}},error:function(r){var e=Q(this).subscriptionState;if(!e.isClosed()){var s=e.observer;e.close();try{var t=F(s,"error");t?q(t,s,r):D(r)}catch(r){D(r)}e.clean()}},complete:function(){var r=Q(this).subscriptionState;if(!r.isClosed()){var e=r.observer;r.close();try{var s=F(e,"complete");s&&q(s,e)}catch(r){D(r)}r.clean()}}}),y&&B(U.prototype,"closed",{configurable:!0,get:function(){return Q(this).subscriptionState.isClosed()}});var V=function(r){S(this,W),M(this,{type:I,subscriber:g(r)})},W=V.prototype;return A(W,{subscribe:function(r){var e=arguments.length;return new T(O(r)?{next:r,error:e>1?arguments[1]:void 0,complete:e>2?arguments[2]:void 0}:k(r)?r:{},N(this).subscriber)}}),z(W,H,function(){return this}),j({global:!0,constructor:!0,forced:!0},{Observable:V}),C(I),r}export{j as __require};